|
|
|||
File indexing completed on 2026-06-25 07:54:04
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 FinalStateHistoManager.hh 0027 /// \brief Definition of the FinalStateHistoManager class 0028 /// 0029 /// Create a set of histos for final state study. 0030 0031 // 0032 // Author: G.Hugo, 08 December 2022 0033 // 0034 // *************************************************************************** 0035 // 0036 /// \class FinalStateHistoManager 0037 /// 0038 /// Create a set of histos for final state study. 0039 /// In practice, the interactions studied here are hadron nuclear inelastic interactions 0040 /// (though the code is fully generic). 0041 /// 0042 /// Energy spectra are plotted for all encountered secondaries 0043 /// (one histo per secondary). 0044 /// In addition, the residual nuclei Z and A distributions are plotted. 0045 /// 0046 /// All histograms are G4H1. 0047 /// They are created and filled via the G4VAnalysisManager. 0048 /// 0049 /// The histograms can be dumped to all usual formats, including ROOT 0050 /// (via G4VAnalysisManager). 0051 /// An interesting added feature here, is that the plots, while being allocated 0052 /// and filled via G4VAnalysisManager, are also dumped 0053 /// in a Flair-compatible format (via tools::histo::flair). 0054 /// 0055 /// NB 1: Note that instead of a hardcoded number associated to a hardcoded set of particles, 0056 /// particle PDG IDs are used to index the histos. 0057 /// This allows a dynamic storage of all particles encountered in the final states. 0058 /// 0059 /// NB 2: tools::histo::flair code, which allows the dump of any G4H1 0060 /// into Flair-compatible format, is fully application-agnostic, 0061 /// and is placed in FlukaCern/utils. 0062 /// It could also be added as an extension of core G4 Analysis Manager. 0063 // 0064 // *************************************************************************** 0065 0066 #ifndef FINAL_STATE_HISTO_MANAGER_HH 0067 #define FINAL_STATE_HISTO_MANAGER_HH 0068 0069 #include "G4H1Wrapper.hh" 0070 #include "G4SystemOfUnits.hh" 0071 #include "globals.hh" 0072 0073 #include <memory> 0074 #include <unordered_map> 0075 #include <vector> 0076 0077 class G4DynamicParticle; 0078 class G4VAnalysisManager; 0079 0080 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 0081 0082 class FinalStateHistoManager 0083 { 0084 public: 0085 FinalStateHistoManager(); 0086 0087 void Book(); 0088 void BeginOfEvent(); 0089 void ScoreSecondary(const G4DynamicParticle* const secondary); 0090 void EndOfEvent(); 0091 void EndOfRun() const; 0092 0093 private: 0094 void DumpAllG4H1IntoRootFile() const; 0095 void 0096 DumpAllG4H1IntoFlairFile(const std::map<G4String, const G4H1Wrapper*>& particlesHistos) const; 0097 0098 G4String fOutputFileName = "all_secondaries"; 0099 G4String fRootOutputFileName = fOutputFileName + ".root"; 0100 G4String fFlairOutputFileName = fOutputFileName + ".hist"; 0101 0102 G4int fNumBins = 90; 0103 G4double fMinKineticEnergy = 10. * keV; 0104 G4double fMaxKineticEnergy = 10. * TeV; 0105 G4String fFunctionName = "none"; 0106 G4String fBinSchemeName = "log"; 0107 G4String fRootEnergyUnit = "MeV"; 0108 0109 G4int fNucleiZMax = 25; 0110 G4int fNucleiAMax = 50; 0111 0112 G4int fNumEvents = 0; 0113 0114 G4VAnalysisManager* fAnalysisManager = nullptr; 0115 0116 // key is particle PDG ID: 0117 std::unordered_map<G4int, std::unique_ptr<G4H1Wrapper>> fParticleData; 0118 // key is nuclei Z or A score index: 0119 std::unordered_map<G4int, std::unique_ptr<G4H1Wrapper>> fNucleiData; 0120 G4int fNucleiZScoreIndex = 0; 0121 G4int fNucleiAScoreIndex = 1; 0122 }; 0123 0124 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 0125 0126 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|