Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-04-10 08:05:57

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 ///  \file tools_histo_flair.hh
0027 ///  \brief Tools to dump any G4H1 into Flair-compatible format.
0028 //
0029 //  Author: G.Hugo, 08 December 2022
0030 //
0031 // ***************************************************************************
0032 //
0033 //      tools_histo_flair
0034 //
0035 ///  Tools to dump any G4H1 into Flair-compatible format.
0036 ///
0037 ///  These tools are fully application-agnostic,
0038 ///  and could also be placed outside of the G4 examples,
0039 ///  as a core G4 Analysis Manager extension.
0040 //
0041 // ***************************************************************************
0042 
0043 #ifndef TOOLS_HISTO_FLAIR_HH
0044 #define TOOLS_HISTO_FLAIR_HH
0045 
0046 #include "g4hntools_defs.hh"
0047 #include "globals.hh"
0048 
0049 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0050 
0051 namespace tools
0052 {
0053 namespace histo
0054 {
0055 namespace flair
0056 {
0057 
0058 // Supported abscissa types (can be extended)
0059 enum Abscissa
0060 {
0061   KineticEnergy,
0062   Z,
0063   A
0064 };
0065 
0066 G4String getAbscissaName(const Abscissa abscissaKind);
0067 G4String getAbscissaUnit(const Abscissa abscissaKind);
0068 G4double getAbscissaUnitValue(const Abscissa abscissaKind);
0069 
0070 G4String sformat(const char* fmt, ...);
0071 
0072 G4double computeError(const G4double mean, const G4double sumSquares, const G4int numEvents);
0073 
0074 // Dump G4H1 (histo mode) to a Flair-compatible format.
0075 void dumpG4H1HistoInFlairFormat(std::ofstream& output, const G4int indexInOutputFile,
0076                                 const G4String& histoName, G4H1* const histo,
0077                                 const Abscissa abscissaKind, const G4String& binSchemeName,
0078                                 const G4int numEvents, const G4double sumSquaredEventTotals = 0.,
0079                                 const G4double sumSquaredEventInRangeTotals = 0.);
0080 
0081 // Dump G4H1 (profile mode, ie no stats) to a Flair-compatible format.
0082 void dumpG4H1ProfileInFlairFormat(std::ofstream& output, const G4int indexInOutputFile,
0083                                   const G4String& histoName, G4H1* const histo,
0084                                   const Abscissa abscissaKind, const G4String& binSchemeName);
0085 
0086 void dumpG4H1InFlairFormat(std::ofstream& output, const G4int indexInOutputFile,
0087                            const G4String& histoName, G4H1* const histo,
0088                            const Abscissa abscissaKind, const G4String& binSchemeName,
0089                            const G4int numEvents, const G4bool isProfile = false,
0090                            const G4double sumSquaredEventTotals = 0.,
0091                            const G4double sumSquaredEventInRangeTotals = 0.);
0092 }  // namespace flair
0093 }  // namespace histo
0094 }  // namespace tools
0095 
0096 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0097 
0098 #endif