Geant4 Cross Reference |
1 // 2 // ******************************************************************** 3 // * License and Disclaimer * 4 // * * 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. * 10 // * * 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitation of liability. * 17 // * * 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************************************** 25 // 26 /// \file XSHistoManager.hh 27 /// \brief Create a set of profiles for XS study. 28 // 29 // Adapted from hadronic/Hadr00/include/HistoManager.hh 30 // Author: G.Hugo, 06 January 2023 31 // 32 // *************************************************************************** 33 // 34 // XSHistoManager 35 // 36 /// Create a set of profiles for XS study. 37 /// 38 /// All profiles are G4H1. 39 /// They are created and filled via G4VAnalysisManager. 40 /// 41 /// The profiles can be dumped to all usual formats, including ROOT 42 /// (via G4VAnalysisManager). 43 /// An interesting added feature here, is that the plots, while being allocated 44 /// and filled via G4VAnalysisManager, are also dumped 45 /// in a Flair-compatible format (via tools::histo::flair). 46 /// 47 /// NB: tools::histo::flair code, which allows the dump of any G4H1 48 /// into Flair-compatible format, is fully application-agnostic, 49 /// and is placed in FlukaCern/utils. 50 /// It could also be added as an extension of core G4 Analysis Manager. 51 // 52 // *************************************************************************** 53 54 #ifndef XS_HISTO_MANAGER_HH 55 #define XS_HISTO_MANAGER_HH 56 57 #include "XSHistoManagerMessenger.hh" 58 59 #include "G4SystemOfUnits.hh" 60 #include "globals.hh" 61 62 #include <unordered_map> 63 64 class G4ParticleDefinition; 65 class G4Element; 66 class G4Material; 67 class G4VAnalysisManager; 68 69 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 70 71 class XSHistoManager 72 { 73 public: 74 XSHistoManager(); 75 76 void SetOutputFileName(const G4String& outputFileName); 77 void SetParticle(const G4String& particleName); 78 void SetElement(const G4String& elementName); 79 void SetMaterial(const G4String& materialName); 80 void SetNumberOfBins(const G4int numBins) { fNumBins = numBins; } 81 void SetMinKinEnergy(const G4double minKineticEnergy) { fMinKineticEnergy = minKineticEnergy; } 82 void SetMaxKinEnergy(const G4double maxKineticEnergy) { fMaxKineticEnergy = maxKineticEnergy; } 83 84 void Book(); 85 void EndOfRun(); 86 87 private: 88 void CheckInput(); 89 void DumpAllG4H1IntoRootFile() const; 90 void DumpAllG4H1IntoFlairFile() const; 91 92 XSHistoManagerMessenger* fMessenger = nullptr; 93 94 G4String fOutputFileName = "all_XS"; 95 G4String fRootOutputFileName = "all_XS.root"; 96 G4String fFlairOutputFileName = "all_XS.hist"; 97 const G4ParticleDefinition* fParticle = nullptr; 98 const G4Element* fElement = nullptr; 99 const G4Material* fMaterial = nullptr; 100 G4int fNumBins = 10000; 101 G4double fMinKineticEnergy = 1. * keV; 102 G4double fMaxKineticEnergy = 10. * TeV; 103 G4String fFunctionName = "none"; 104 G4String fBinSchemeName = "log"; 105 G4String fRootEnergyUnit = "MeV"; 106 107 G4VAnalysisManager* fAnalysisManager = nullptr; 108 std::unordered_map<G4int, G4int> fXSProfileIndex; // key: XS index 109 // value: histo index from G4VAnalysisManager 110 111 G4int fElasticXSIndex = 0; 112 G4int fInelasticXSIndex = 1; 113 G4int fCaptureXSIndex = 2; 114 G4int fFissionXSIndex = 3; 115 G4int fChargeExchangeXSIndex = 4; 116 G4int fTotalXSIndex = 5; 117 G4int fElasticPerVolumeXSIndex = 6; 118 G4int fInelasticPerVolumeXSIndex = 7; 119 }; 120 121 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 122 123 #endif 124