34 #include "RunAction.hh"
35 #include "DetectorConstruction.hh"
36 #include "PrimaryGeneratorAction.hh"
37 #include "HistoManager.hh"
53 :fDetector(det),fKinematic(kin),fProcCounter(0),fHistoManager(histo)
72 if (NbofEvents == 0)
return;
86 fMassCavity = cavityThickness*densityCavity;
95 G4double effWallThick = factor*RangeWall;
96 if ((effWallThick > wallThickness)||(effWallThick <= 0.))
97 effWallThick = wallThickness;
98 fMassWall = 2*effWallThick*densityWall;
100 G4double massTotal = fMassWall + fMassCavity;
101 G4double fMassWallRatio = fMassWall/massTotal;
104 G4double massRatio = fMassCavity/fMassWall;
111 std::ios::fmtflags mode =
G4cout.flags();
112 G4cout.setf(std::ios::fixed,std::ios::floatfield);
115 G4cout <<
"\n ======================== run conditions =====================\n";
117 G4cout <<
"\n The run will be " << NbofEvents <<
" "<< partName <<
" of "
118 <<
G4BestUnit(fEnergyGun,
"Energy") <<
" through 2*"
119 <<
G4BestUnit(effWallThick,
"Length") <<
" of "
120 << mateWall->
GetName() <<
" (density: "
121 <<
G4BestUnit(densityWall,
"Volumic Mass") <<
"); Mass/cm2 = "
125 G4cout <<
"\n the cavity is "
126 <<
G4BestUnit(cavityThickness,
"Length") <<
" of "
127 << mateCavity->
GetName() <<
" (density: "
128 <<
G4BestUnit(densityCavity,
"Volumic Mass") <<
"); Mass/cm2 = "
130 <<
" --> massRatio = " << std::setprecision(6) << massRatio <<
G4endl;
134 <<
"; range in cavity: " <<
G4BestUnit(RangeCavity,
"Length")
137 G4cout <<
"\n ============================================================\n";
143 dedxWall /= densityWall;
146 dedxCavity /= densityCavity;
148 G4cout << std::setprecision(4)
149 <<
"\n StoppingPower in wall = "
152 <<
G4BestUnit(dedxCavity,
"Energy*Surface/Mass")
161 fPartFlowCavity[0] = fPartFlowCavity[1] = 0;
162 fEnerFlowCavity[0] = fEnerFlowCavity[1] = 0.;
166 fEdepCavity = fEdepCavity2 = fTrkSegmCavity = 0.;
171 fStepWall = fStepWall2 = fStepCavity = fStepCavity2 =0.;
172 fNbStepWall = fNbStepCavity = 0;
176 fHistoManager->
book();
179 G4cout.setf(mode,std::ios::floatfield);
188 size_t nbProc = fProcCounter->size();
190 while ((i<nbProc)&&((*fProcCounter)[i]->GetName()!=procName)) i++;
191 if (i == nbProc) fProcCounter->push_back(
new OneProcessCount(procName));
193 (*fProcCounter)[i]->Count();
200 if (NbofEvents == 0)
return;
208 G4double Icavity = Ncavity/fMassCavity;
210 G4double Itot = NbofEvents/(fMassWall+fMassCavity);
211 G4double energyFluence = fEnergyGun*Itot;
215 G4double doseCavity = fEdepCavity/fMassCavity;
216 G4double ratio = doseCavity/energyFluence;
219 std::ios::fmtflags mode =
G4cout.flags();
220 G4cout.setf(std::ios::fixed,std::ios::floatfield);
223 G4cout <<
"\n--->evntNb= " << NbofEvents
224 <<
" Nwall= " << Nwall
225 <<
" Ncav= " << Ncavity
226 <<
" Ic/Iw= " << Iratio
227 <<
" Ne-_cav= " << fPartFlowCavity[0]
228 <<
" doseCavity/Ebeam= " << ratio
229 <<
" (100*(ratio-1) = " << err <<
" %)"
233 G4cout.setf(mode,std::ios::floatfield);
241 std::ios::fmtflags mode =
G4cout.flags();
242 G4cout.setf(std::ios::fixed,std::ios::floatfield);
246 if (NbofEvents == 0)
return;
250 G4cout <<
"\n Process calls frequency --->";
251 for (
size_t i=0; i< fProcCounter->size();i++) {
252 G4String procName = (*fProcCounter)[i]->GetName();
253 G4int count = (*fProcCounter)[i]->GetCounter();
254 G4cout <<
" " << procName <<
"= " << count;
261 <<
"\n Charged particle flow in cavity :"
262 <<
"\n Enter --> nbParticles = " << fPartFlowCavity[0]
263 <<
"\t Energy = " <<
G4BestUnit (fEnerFlowCavity[0],
"Energy")
264 <<
"\n Exit --> nbParticles = " << fPartFlowCavity[1]
265 <<
"\t Energy = " <<
G4BestUnit (fEnerFlowCavity[1],
"Energy")
268 if (fPartFlowCavity[0] == 0)
return;
275 G4double Icavity = Ncavity/fMassCavity;
277 G4double Itot = NbofEvents/(fMassWall+fMassCavity);
278 G4double energyFluence = fEnergyGun*Itot;
282 <<
"\n beamFluence in wall = " << Nwall
283 <<
"\t in cavity = " << Ncavity
284 <<
"\t Icav/Iwall = " << Iratio
285 <<
"\t energyFluence = " << energyFluence/(
MeV*
cm2/
mg) <<
" MeV*cm2/mg"
290 if (fNbEventCavity == 0)
return;
291 G4double meanEdep = fEdepCavity/fNbEventCavity;
292 G4double meanEdep2 = fEdepCavity2/fNbEventCavity;
293 G4double varianceEdep = meanEdep2 - meanEdep*meanEdep;
295 if(varianceEdep>0.) dEoverE = std::sqrt(varianceEdep/fNbEventCavity)/meanEdep;
299 G4double doseCavity = fEdepCavity/fMassCavity;
300 G4double ratio = doseCavity/energyFluence, error = ratio*dEoverE;
303 <<
"\n Total edep in cavity = " <<
G4BestUnit(fEdepCavity,
"Energy")
304 <<
" +- " << 100*dEoverE <<
" %"
305 <<
"\n Total dose in cavity = " << doseCavity/(
MeV*
cm2/
mg) <<
" MeV*cm2/mg"
306 <<
" +- " << 100*dEoverE <<
" %"
307 <<
"\n\n DoseCavity/EnergyFluence = " << ratio
308 <<
" +- " << error << G4endl;
312 G4double meantrack = fTrkSegmCavity/fPartFlowCavity[0];
316 <<
"\n Total charged trackLength in cavity = "
318 <<
" (mean value = " <<
G4BestUnit(meantrack,
"Length") <<
")"
323 fStepWall /= fNbStepWall; fStepWall2 /= fNbStepWall;
324 G4double rms = fStepWall2 - fStepWall*fStepWall;
325 if (rms>0.) rms = std::sqrt(rms);
else rms = 0.;
329 <<
"\n StepSize of ch. tracks in wall = "
331 <<
"\t (nbSteps/track = " << double(fNbStepWall)/nbTrackWall <<
")";
333 fStepCavity /= fNbStepCavity; fStepCavity2 /= fNbStepCavity;
334 rms = fStepCavity2 - fStepCavity*fStepCavity;
335 if (rms>0.) rms = std::sqrt(rms);
else rms = 0.;
338 <<
"\n StepSize of ch. tracks in cavity = "
340 <<
"\t (nbSteps/track = " << double(fNbStepCavity)/fPartFlowCavity[0] <<
")";
345 G4cout.setf(mode,std::ios::floatfield);
349 while (fProcCounter->size()>0){
351 fProcCounter->pop_back();
357 fHistoManager->
save();