48 #include "HistoManager.hh"
101 fHistoBooked =
false;
102 fHisto =
new Histo();
105 fPrimaryKineticEnergy = 0.0;
121 fHisto->
Add1D(
"1",
"Energy deposition (MeV/mm/event) in the target",
122 fNSlices,0.0,fLength/
mm,
MeV/
mm);
123 fHisto->
Add1D(
"2",
"Log10 Energy (MeV) of gammas",fNBinsE,-5.,5.,1.0);
124 fHisto->
Add1D(
"3",
"Log10 Energy (MeV) of electrons",fNBinsE,-5.,5.,1.0);
125 fHisto->
Add1D(
"4",
"Log10 Energy (MeV) of positrons",fNBinsE,-5.,5.,1.0);
126 fHisto->
Add1D(
"5",
"Log10 Energy (MeV) of protons",fNBinsE,-5.,5.,1.0);
127 fHisto->
Add1D(
"6",
"Log10 Energy (MeV) of neutrons",fNBinsE,-5.,5.,1.0);
128 fHisto->
Add1D(
"7",
"Log10 Energy (MeV) of charged pions",fNBinsE,-4.,6.,1.0);
129 fHisto->
Add1D(
"8",
"Log10 Energy (MeV) of pi0",fNBinsE,-4.,6.,1.0);
130 fHisto->
Add1D(
"9",
"Log10 Energy (MeV) of charged kaons",fNBinsE,-4.,6.,1.0);
131 fHisto->
Add1D(
"10",
"Log10 Energy (MeV) of neutral kaons",fNBinsE,-4.,6.,1.0);
132 fHisto->
Add1D(
"11",
"Log10 Energy (MeV) of deuterons and tritons",fNBinsE,-5.,5.,1.0);
133 fHisto->
Add1D(
"12",
"Log10 Energy (MeV) of He3 and alpha",fNBinsE,-5.,5.,1.0);
134 fHisto->
Add1D(
"13",
"Log10 Energy (MeV) of Generic Ions",fNBinsE,-5.,5.,1.0);
135 fHisto->
Add1D(
"14",
"Log10 Energy (MeV) of muons",fNBinsE,-4.,6.,1.0);
136 fHisto->
Add1D(
"15",
"log10 Energy (MeV) of side-leaked neutrons",fNBinsE,-5.,5.,1.0);
137 fHisto->
Add1D(
"16",
"log10 Energy (MeV) of forward-leaked neutrons",fNBinsE,-5.,5.,1.0);
138 fHisto->
Add1D(
"17",
"log10 Energy (MeV) of backward-leaked neutrons",fNBinsE,-5.,5.,1.0);
139 fHisto->
Add1D(
"18",
"log10 Energy (MeV) of leaking protons",fNBinsE,-4.,6.,1.0);
140 fHisto->
Add1D(
"19",
"log10 Energy (MeV) of leaking charged pions",fNBinsE,-4.,6.,1.0);
141 fHisto->
Add1D(
"20",
"Log10 Energy (MeV) of pi+",fNBinsE,-4.,6.,1.0);
142 fHisto->
Add1D(
"21",
"Log10 Energy (MeV) of pi-",fNBinsE,-4.,6.,1.0);
143 fHisto->
Add1D(
"22",
"Energy deposition in the target normalized to beam energy",
145 fHisto->
Add1D(
"23",
"EM energy deposition in the target normalized to beam energy",
147 fHisto->
Add1D(
"24",
"Pion energy deposition in the target normalized to beam energy",
149 fHisto->
Add1D(
"25",
"Proton energy deposition in the target normalized to beam energy",
157 fAbsZ0 = -0.5*fLength;
186 G4cout <<
"HistoManager: Histograms are booked and run has been started"
196 G4cout <<
"HistoManager: End of run actions are started" <<
G4endl;
199 G4cout<<
"========================================================"<<
G4endl;
202 if(fNevt > 0) { x = 1.0/
x; }
226 fEdepSum2 -= fEdepSum*fEdepSum;
227 if(fEdepSum2 > 0.0) { fEdepSum2 = std::sqrt(fEdepSum2); }
228 else { fEdepSum2 = 0.0; }
230 G4cout <<
"Beam particle "
232 G4cout <<
"Beam Energy(MeV) "
235 G4cout << std::setprecision(4) <<
"Average energy deposit (MeV) " << fEdepSum/
MeV
236 <<
" RMS(MeV) " << fEdepSum2/
MeV <<
G4endl;
237 G4cout << std::setprecision(4) <<
"Average number of steps " << xs <<
G4endl;
238 G4cout << std::setprecision(4) <<
"Average number of gamma " << xg <<
G4endl;
239 G4cout << std::setprecision(4) <<
"Average number of e- " << xe <<
G4endl;
240 G4cout << std::setprecision(4) <<
"Average number of e+ " << xp <<
G4endl;
241 G4cout << std::setprecision(4) <<
"Average number of neutrons " << xn <<
G4endl;
242 G4cout << std::setprecision(4) <<
"Average number of protons " << xpn <<
G4endl;
243 G4cout << std::setprecision(4) <<
"Average number of antiprotons " << xap <<
G4endl;
244 G4cout << std::setprecision(4) <<
"Average number of pi+ & pi- " << xpc <<
G4endl;
245 G4cout << std::setprecision(4) <<
"Average number of pi0 " << xp0 <<
G4endl;
246 G4cout << std::setprecision(4) <<
"Average number of kaons " << xpk <<
G4endl;
247 G4cout << std::setprecision(4) <<
"Average number of muons " << xpm <<
G4endl;
248 G4cout << std::setprecision(4) <<
"Average number of deuterons+tritons " << xid <<
G4endl;
249 G4cout << std::setprecision(4) <<
"Average number of He3+alpha " << xia <<
G4endl;
250 G4cout << std::setprecision(4) <<
"Average number of ions " << xio <<
G4endl;
251 G4cout << std::setprecision(4) <<
"Average number of forward neutrons " << xnf <<
G4endl;
252 G4cout << std::setprecision(4) <<
"Average number of reflected neutrons " << xnb <<
G4endl;
253 G4cout << std::setprecision(4) <<
"Average number of leaked neutrons " << xnbw <<
G4endl;
254 G4cout << std::setprecision(4) <<
"Average number of proton leak " << xpl <<
G4endl;
255 G4cout << std::setprecision(4) <<
"Average number of pion leak " << xal <<
G4endl;
256 G4cout<<
"========================================================"<<
G4endl;
260 for(
G4int i=0; i<fNHisto; i++) {
281 fEdepSum += fEdepEvt;
282 fEdepSum2 += fEdepEvt*fEdepEvt;
283 fHisto->
Fill(21,fEdepEvt/fPrimaryKineticEnergy,1.0);
284 fHisto->
Fill(22,fEdepEM/fPrimaryKineticEnergy,1.0);
285 fHisto->
Fill(23,fEdepPI/fPrimaryKineticEnergy,1.0);
286 fHisto->
Fill(24,fEdepP/fPrimaryKineticEnergy,1.0);
301 fPrimaryKineticEnergy =
e;
305 G4cout <<
"### Primary " << name
306 <<
" kinE(MeV)= " << e/
MeV
315 G4cout <<
"=== Secondary " << name
316 <<
" kinE(MeV)= " << e/
MeV
321 e = std::log10(e/
MeV);
324 fHisto->
Fill(1,e,1.0);
327 fHisto->
Fill(2,e,1.0);
330 fHisto->
Fill(3,e,1.0);
333 fHisto->
Fill(4,e,1.0);
334 }
else if ( pd == fNeutron) {
336 fHisto->
Fill(5,e,1.0);
341 fHisto->
Fill(6,e,1.0);
342 fHisto->
Fill(19,e,1.0);
346 fHisto->
Fill(6,e,1.0);
347 fHisto->
Fill(20,e,1.0);
351 fHisto->
Fill(7,e,1.0);
354 fHisto->
Fill(8,e,1.0);
357 fHisto->
Fill(9,e,1.0);
360 fHisto->
Fill(10,e,1.0);
363 fHisto->
Fill(11,e,1.0);
366 fHisto->
Fill(12,e,1.0);
369 fHisto->
Fill(13,e,1.0);
391 fHisto->
Fill(0,z,fEdep);
404 G4cout <<
"HistoManager::AddEnergy: e(keV)= " << fEdep/
keV
405 <<
"; z(mm)= " << z/
mm
430 if(z > -fAbsZ0 && dir.
z() > 0.0) {
434 fHisto->
Fill(15,e,1.0);
435 }
else isLeaking =
true;
438 }
else if (z < fAbsZ0 && dir.
z() < 0.0) {
442 fHisto->
Fill(16,e,1.0);
443 }
else isLeaking =
true;
446 }
else if (std::abs(z) <= -fAbsZ0 && x*dir.
x() + y*dir.
y() > 0.0) {
450 fHisto->
Fill(14,e,1.0);
451 }
else isLeaking =
true;
457 fHisto->
Fill(17,e,1.0);
460 fHisto->
Fill(18,e,1.0);
478 fHisto->
Fill(
id, x, w);