48 #include "HistoManager.hh"
98 fPrimaryKineticEnergy(0.0),
107 fHisto =
new Histo();
108 fHisto->SetVerbose(fVerbose);
124 fHisto->Add1D(
"1",
"Energy deposition (MeV/mm/event) in the target",
125 fNSlices,0.0,fLength/
mm,
MeV/
mm);
126 fHisto->Add1D(
"2",
"Log10 Energy (MeV) of gammas",fNBinsE,-5.,5.,1.0);
127 fHisto->Add1D(
"3",
"Log10 Energy (MeV) of electrons",fNBinsE,-5.,5.,1.0);
128 fHisto->Add1D(
"4",
"Log10 Energy (MeV) of positrons",fNBinsE,-5.,5.,1.0);
129 fHisto->Add1D(
"5",
"Log10 Energy (MeV) of protons",fNBinsE,-5.,5.,1.0);
130 fHisto->Add1D(
"6",
"Log10 Energy (MeV) of neutrons",fNBinsE,-5.,5.,1.0);
131 fHisto->Add1D(
"7",
"Log10 Energy (MeV) of charged pions",fNBinsE,-4.,6.,1.0);
132 fHisto->Add1D(
"8",
"Log10 Energy (MeV) of pi0",fNBinsE,-4.,6.,1.0);
133 fHisto->Add1D(
"9",
"Log10 Energy (MeV) of charged kaons",fNBinsE,-4.,6.,1.0);
134 fHisto->Add1D(
"10",
"Log10 Energy (MeV) of neutral kaons",fNBinsE,-4.,6.,1.0);
135 fHisto->Add1D(
"11",
"Log10 Energy (MeV) of deuterons and tritons",
137 fHisto->Add1D(
"12",
"Log10 Energy (MeV) of He3 and alpha",fNBinsE,-5.,5.,1.0);
138 fHisto->Add1D(
"13",
"Log10 Energy (MeV) of Generic Ions",fNBinsE,-5.,5.,1.0);
139 fHisto->Add1D(
"14",
"Log10 Energy (MeV) of muons",fNBinsE,-4.,6.,1.0);
140 fHisto->Add1D(
"15",
"log10 Energy (MeV) of side-leaked neutrons",
142 fHisto->Add1D(
"16",
"log10 Energy (MeV) of forward-leaked neutrons",
144 fHisto->Add1D(
"17",
"log10 Energy (MeV) of backward-leaked neutrons",
146 fHisto->Add1D(
"18",
"log10 Energy (MeV) of leaking protons",
148 fHisto->Add1D(
"19",
"log10 Energy (MeV) of leaking charged pions",
150 fHisto->Add1D(
"20",
"Log10 Energy (MeV) of pi+",fNBinsE,-4.,6.,1.0);
151 fHisto->Add1D(
"21",
"Log10 Energy (MeV) of pi-",fNBinsE,-4.,6.,1.0);
153 "Energy deposition in the target normalized to beam energy",
156 "EM energy deposition in the target normalized to beam energy",
159 "Pion energy deposition in the target normalized to beam energy",
162 "Proton energy deposition in the target normalized to beam energy",
170 fAbsZ0 = -0.5*fLength;
199 G4cout <<
"HistoManager: Histograms are booked and run has been started"
209 G4cout <<
"HistoManager: End of run actions are started" <<
G4endl;
212 G4cout<<
"========================================================"<<
G4endl;
215 if(fNevt > 0) { x = 1.0/
x; }
239 fEdepSum2 -= fEdepSum*fEdepSum;
240 if(fEdepSum2 > 0.0) { fEdepSum2 = std::sqrt(fEdepSum2); }
241 else { fEdepSum2 = 0.0; }
243 G4cout <<
"Beam particle "
245 G4cout <<
"Beam Energy(MeV) "
247 G4cout <<
"Number of events "
249 G4cout << std::setprecision(4) <<
"Average energy deposit (MeV) "
251 <<
" RMS(MeV) " << fEdepSum2/
MeV <<
G4endl;
252 G4cout << std::setprecision(4) <<
"Average number of steps "
254 G4cout << std::setprecision(4) <<
"Average number of gamma "
256 G4cout << std::setprecision(4) <<
"Average number of e- "
258 G4cout << std::setprecision(4) <<
"Average number of e+ "
260 G4cout << std::setprecision(4) <<
"Average number of neutrons "
262 G4cout << std::setprecision(4) <<
"Average number of protons "
264 G4cout << std::setprecision(4) <<
"Average number of antiprotons "
266 G4cout << std::setprecision(4) <<
"Average number of pi+ & pi- "
268 G4cout << std::setprecision(4) <<
"Average number of pi0 "
270 G4cout << std::setprecision(4) <<
"Average number of kaons "
272 G4cout << std::setprecision(4) <<
"Average number of muons "
274 G4cout << std::setprecision(4) <<
"Average number of deuterons+tritons "
276 G4cout << std::setprecision(4) <<
"Average number of He3+alpha "
278 G4cout << std::setprecision(4) <<
"Average number of ions "
280 G4cout << std::setprecision(4) <<
"Average number of forward neutrons "
282 G4cout << std::setprecision(4) <<
"Average number of reflected neutrons "
284 G4cout << std::setprecision(4) <<
"Average number of leaked neutrons "
286 G4cout << std::setprecision(4) <<
"Average number of proton leak "
288 G4cout << std::setprecision(4) <<
"Average number of pion leak "
290 G4cout<<
"========================================================"<<
G4endl;
294 for(
G4int i=0; i<fNHisto; i++) {
295 fHisto->ScaleH1(i,x);
315 fEdepSum += fEdepEvt;
316 fEdepSum2 += fEdepEvt*fEdepEvt;
317 fHisto->Fill(21,fEdepEvt/fPrimaryKineticEnergy,1.0);
318 fHisto->Fill(22,fEdepEM/fPrimaryKineticEnergy,1.0);
319 fHisto->Fill(23,fEdepPI/fPrimaryKineticEnergy,1.0);
320 fHisto->Fill(24,fEdepP/fPrimaryKineticEnergy,1.0);
335 fPrimaryKineticEnergy = e;
339 G4cout <<
"### Primary " << name
340 <<
" kinE(MeV)= " << e/
MeV
349 G4cout <<
"=== Secondary " << name
350 <<
" kinE(MeV)= " << e/
MeV
355 e = std::log10(e/
MeV);
358 fHisto->Fill(1,e,1.0);
361 fHisto->Fill(2,e,1.0);
364 fHisto->Fill(3,e,1.0);
367 fHisto->Fill(4,e,1.0);
368 }
else if ( pd == fNeutron) {
370 fHisto->Fill(5,e,1.0);
375 fHisto->Fill(6,e,1.0);
376 fHisto->Fill(19,e,1.0);
380 fHisto->Fill(6,e,1.0);
381 fHisto->Fill(20,e,1.0);
385 fHisto->Fill(7,e,1.0);
389 fHisto->Fill(8,e,1.0);
393 fHisto->Fill(9,e,1.0);
396 fHisto->Fill(10,e,1.0);
399 fHisto->Fill(11,e,1.0);
402 fHisto->Fill(12,e,1.0);
406 fHisto->Fill(13,e,1.0);
418 G4cout <<
"TargetSD::ProcessHits: beta1= "
435 fHisto->Fill(0,z,fEdep);
450 G4cout <<
"HistoManager::AddEnergy: e(keV)= " << fEdep/
keV
451 <<
"; z(mm)= " << z/
mm
476 if(z > -fAbsZ0 && dir.
z() > 0.0) {
480 fHisto->Fill(15,e,1.0);
481 }
else isLeaking =
true;
484 }
else if (z < fAbsZ0 && dir.
z() < 0.0) {
488 fHisto->Fill(16,e,1.0);
489 }
else isLeaking =
true;
492 }
else if (std::abs(z) <= -fAbsZ0 && x*dir.
x() + y*dir.
y() > 0.0) {
496 fHisto->Fill(14,e,1.0);
497 }
else isLeaking =
true;
503 fHisto->Fill(17,e,1.0);
507 fHisto->Fill(18,e,1.0);
518 fHisto->SetVerbose(val);
525 fHisto->Fill(
id, x, w);
G4ParticleDefinition * GetDefinition() const
G4int GetParentID() const
void AddTargetStep(const G4Step *)
static G4MuonPlus * MuonPlus()
static constexpr double mm
G4double GetStepLength() const
const G4ThreeVector & GetPosition() const
static G4KaonZeroLong * KaonZeroLong()
G4double GetVelocity() const
const G4String & GetParticleName() const
static G4KaonMinus * KaonMinus()
G4StepPoint * GetPreStepPoint() const
G4double GetKineticEnergy() const
G4GLOB_DLL std::ostream G4cout
void AddLeakingParticle(const G4Track *)
const G4ThreeVector & GetPosition() const
static G4KaonZeroShort * KaonZeroShort()
static G4AntiProton * AntiProton()
static G4Triton * Triton()
static G4Proton * Proton()
static G4PionPlus * PionPlus()
const G4String & GetParticleType() const
static G4Neutron * Neutron()
void Fill(G4int id, G4double x, G4double w)
static G4PionZero * PionZero()
static G4Deuteron * Deuteron()
G4double GetTotalEnergyDeposit() const
static G4Positron * Positron()
const G4ThreeVector & GetMomentumDirection() const
G4double GetPDGMass() const
static G4PionMinus * PionMinus()
G4StepPoint * GetPostStepPoint() const
static constexpr double GeV
G4double GetWeight() const
void ScoreNewTrack(const G4Track *aTrack)
void SetVerbose(G4int val)
static G4MuonMinus * MuonMinus()
static G4Electron * Electron()
static constexpr double MeV
static HistoManager * GetPointer()
static G4KaonPlus * KaonPlus()
G4Track * GetTrack() const
static constexpr double keV
static const G4double pos