47 #include "HistoManager.hh"
62 #include "HistoManagerMessenger.hh"
69 fHistoName =
"hadr00";
75 fParticleName =
"proton";
80 fMinKinEnergy = 0.1*
MeV;
81 fMaxKinEnergy = 10*
TeV;
83 fMaxMomentum = 10*
TeV;
107 fAnalysisManager = G4AnalysisManager::Instance();
108 fAnalysisManager->OpenFile(fHistoName+
".root");
109 fAnalysisManager->SetFirstHistoId(1);
111 fAnalysisManager->CreateH1(
"h1",
112 "Elastic cross section (barn) as a functions of log10(p/GeV)",
114 fAnalysisManager->CreateH1(
"h2",
115 "Elastic cross section (barn) as a functions of log10(E/MeV)",
117 fAnalysisManager->CreateH1(
"h3",
118 "Inelastic cross section (barn) as a functions of log10(p/GeV)",
120 fAnalysisManager->CreateH1(
"h4",
121 "Inelastic cross section (barn) as a functions of log10(E/MeV)",
123 fAnalysisManager->CreateH1(
"h5",
124 "Capture cross section (barn) as a functions of log10(E/MeV)",
126 fAnalysisManager->CreateH1(
"h6",
127 "Fission cross section (barn) as a functions of log10(E/MeV)",
129 fAnalysisManager->CreateH1(
"h7",
130 "Charge exchange cross section (barn) as a functions of log10(E/MeV)",
132 fAnalysisManager->CreateH1(
"h8",
133 "Total cross section (barn) as a functions of log10(E/MeV)",
135 fAnalysisManager->CreateH1(
"h9",
136 "Inelastic cross section per volume as a functions of log10(E/MeV)",
138 fAnalysisManager->CreateH1(
"h10",
139 "Elastic cross section per volume as a functions of log10(E/MeV)",
148 G4cout <<
"HistoManager: End of run actions are started" <<
G4endl;
158 G4cout <<
"### Fill Cross Sections for " << fParticleName
159 <<
" off " << fElementName
162 G4cout <<
"-------------------------------------------------------------"
164 G4cout <<
" N E(MeV) Elastic(b) Inelastic(b)";
165 if(particle == fNeutron) {
G4cout <<
" Capture(b) Fission(b)"; }
167 G4cout <<
"-------------------------------------------------------------"
170 if(!particle || !elm) {
171 G4cout <<
"HistoManager WARNING Particle or element undefined" <<
G4endl;
195 if(fTargetMaterial) { coeff = fTargetMaterial->
GetDensity()*
cm2/
g; }
197 for(i=0; i<fBinsE; i++) {
199 e = std::pow(10.,x)*
MeV;
200 if(fVerbose>0)
G4cout << std::setw(5) << i << std::setw(12) << e;
203 if(fVerbose>0)
G4cout << std::setw(12) << xs/
barn;
204 fAnalysisManager->FillH1(2, x, xs/
barn);
207 if(fVerbose>0)
G4cout <<
" " << std::setw(12) << xs/
barn;
208 fAnalysisManager->FillH1(4, x, xs/
barn);
209 if(fTargetMaterial) {
212 fAnalysisManager->FillH1(9, x, xs/coeff);
215 fAnalysisManager->FillH1(10, x, xs/coeff);
217 if(particle == fNeutron) {
220 if(fVerbose>0)
G4cout <<
" " << std::setw(12) << xs/
barn;
221 fAnalysisManager->FillH1(5, x, xs/
barn);
224 if(fVerbose>0)
G4cout <<
" " << std::setw(12) << xs/
barn;
225 fAnalysisManager->FillH1(6, x, xs/
barn);
229 fAnalysisManager->FillH1(7, x, xs/
barn);
230 fAnalysisManager->FillH1(8, x, xtot/
barn);
234 for(i=0; i<fBinsP; i++) {
236 p = std::pow(10.,x)*
GeV;
237 e = std::sqrt(p*p + mass*mass) - mass;
239 fAnalysisManager->FillH1(1, x, xs/
barn);
241 fAnalysisManager->FillH1(3, x, xs/
barn);
244 G4cout <<
"-------------------------------------------------------------"
248 fAnalysisManager->Write();
249 fAnalysisManager->CloseFile();
252 if(fTargetMaterial && extra) {
256 if(cross <= 0.0) { cross = 1.e-100; }
258 <<
" GeV on " << fTargetMaterial->
GetName()
259 <<
" xs/X0= " << 1.0/(cross*fTargetMaterial->
GetRadlen()) << G4endl;
261 delete fAnalysisManager;
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
static constexpr double cm2
static G4HadronicProcessStore * Instance()
G4double GetElasticCrossSectionPerAtom(const G4ParticleDefinition *aParticle, G4double kineticEnergy, const G4Element *anElement, const G4Material *mat=0)
const G4String & GetName() const
G4double GetDensity() const
G4double GetFissionCrossSectionPerAtom(const G4ParticleDefinition *aParticle, G4double kineticEnergy, const G4Element *anElement, const G4Material *mat=0)
static G4NistManager * Instance()
const G4String & GetParticleName() const
static constexpr double TeV
G4GLOB_DLL std::ostream G4cout
G4double GetInelasticCrossSectionPerAtom(const G4ParticleDefinition *aParticle, G4double kineticEnergy, const G4Element *anElement, const G4Material *mat=0)
G4double GetChargeExchangeCrossSectionPerAtom(const G4ParticleDefinition *aParticle, G4double kineticEnergy, const G4Element *anElement, const G4Material *mat=0)
static G4Neutron * Neutron()
G4double GetRadlen() const
G4double GetPDGMass() const
static G4ParticleTable * GetParticleTable()
static constexpr double GeV
void SetVerbose(G4int val)
static constexpr double MeV
G4double GetElasticCrossSectionPerVolume(const G4ParticleDefinition *aParticle, G4double kineticEnergy, const G4Material *material)
G4double GetInelasticCrossSectionPerVolume(const G4ParticleDefinition *aParticle, G4double kineticEnergy, const G4Material *material)
static constexpr double barn
G4Element * FindOrBuildElement(G4int Z, G4bool isotopes=true)
G4double GetCaptureCrossSectionPerAtom(const G4ParticleDefinition *aParticle, G4double kineticEnergy, const G4Element *anElement, const G4Material *mat=0)