35 #include "DetectorConstruction.hh"
36 #include "PrimaryGeneratorAction.hh"
37 #include "HistoManager.hh"
52 :
G4Run(),fDetector(det), fKinematic(kin), fProcCounter(0),
53 fEdepCavity(0.), fEdepCavity2(0.),
54 fTrkSegmCavity(0.), fNbEventCavity(0),
55 fStepWall(0.), fStepWall2(0.),
56 fStepCavity(0.), fStepCavity2(0.),
57 fNbStepWall(0), fNbStepCavity(0),
58 fEnergyGun(0.), fMassWall(0.),
59 fMassCavity(0.),fIsMaster(isMaster)
83 G4double effWallThick = factor*RangeWall;
84 if ((effWallThick > wallThickness)||(effWallThick <= 0.))
85 effWallThick = wallThickness;
102 std::ios::fmtflags mode =
G4cout.flags();
103 G4cout.setf(std::ios::fixed,std::ios::floatfield);
106 G4cout <<
"\n ===================== run conditions =====================\n";
110 <<
G4BestUnit(effWallThick,
"Length") <<
" of "
111 << mateWall->
GetName() <<
" (density: "
112 <<
G4BestUnit(densityWall,
"Volumic Mass") <<
"); Mass/cm2 = "
116 G4cout <<
"\n the cavity is "
117 <<
G4BestUnit(cavityThickness,
"Length") <<
" of "
118 << mateCavity->
GetName() <<
" (density: "
119 <<
G4BestUnit(densityCavity,
"Volumic Mass") <<
"); Mass/cm2 = "
121 <<
" --> massRatio = "<< std::setprecision(6) << massRatio <<
G4endl;
125 <<
"; range in cavity: " <<
G4BestUnit(RangeCavity,
"Length")
128 G4cout <<
"\n ==========================================================\n";
134 dedxWall /= densityWall;
137 dedxCavity /= densityCavity;
139 G4cout << std::setprecision(4)
140 <<
"\n StoppingPower in wall = "
143 <<
G4BestUnit(dedxCavity,
"Energy*Surface/Mass")
167 G4cout.setf(mode,std::ios::floatfield);
173 if ( analysisManager->IsActive() ) {
174 analysisManager->OpenFile();
193 while ((i<nbProc)&&((*
fProcCounter)[i]->GetName()!=procName)) i++;
196 (*fProcCounter)[i]->Count();
203 if (NbofEvents == 0)
return;
221 G4double ratio = doseCavity/energyFluence;
224 std::ios::fmtflags mode =
G4cout.flags();
225 G4cout.setf(std::ios::fixed,std::ios::floatfield);
228 G4cout <<
"\n--->evntNb= " << NbofEvents
229 <<
" Nwall= " << Nwall
230 <<
" Ncav= " << Ncavity
231 <<
" Ic/Iw= " << Iratio
233 <<
" doseCavity/Ebeam= " << ratio
234 <<
" (100*(ratio-1) = " << err <<
" %)"
238 G4cout.setf(mode,std::ios::floatfield);
248 std::ios::fmtflags mode =
G4cout.flags();
249 G4cout.setf(std::ios::fixed,std::ios::floatfield);
257 G4cout <<
"\n Process calls frequency --->";
259 G4String procName = (*fProcCounter)[i]->GetName();
260 G4int count = (*fProcCounter)[i]->GetCounter();
261 G4cout <<
" " << procName <<
"= " << count;
268 <<
"\n Charged particle flow in cavity :"
289 <<
"\n beamFluence in wall = " << Nwall
290 <<
"\t in cavity = " << Ncavity
291 <<
"\t Icav/Iwall = " << Iratio
292 <<
"\t energyFluence = " << energyFluence/(
MeV*
cm2/
mg) <<
" MeV*cm2/mg"
300 G4double varianceEdep = meanEdep2 - meanEdep*meanEdep;
302 if(varianceEdep>0.) dEoverE = std::sqrt(varianceEdep/
fNbEventCavity)/meanEdep;
308 G4double ratio = doseCavity/energyFluence,
error = ratio*dEoverE;
312 <<
" +- " << 100*dEoverE <<
" %"
313 <<
"\n Total dose in cavity = " << doseCavity/(
MeV*
cm2/
mg) <<
" MeV*cm2/mg"
314 <<
" +- " << 100*dEoverE <<
" %"
315 <<
"\n\n DoseCavity/EnergyFluence = " << ratio
316 <<
" +- " << error << G4endl;
324 <<
"\n Total charged trackLength in cavity = "
326 <<
" (mean value = " <<
G4BestUnit(meantrack,
"Length") <<
")"
333 if (rms>0.) rms = std::sqrt(rms);
else rms = 0.;
337 <<
"\n StepSize of ch. tracks in wall = "
339 <<
"\t (nbSteps/track = " << double(
fNbStepWall)/nbTrackWall <<
")";
343 if (rms>0.) rms = std::sqrt(rms);
else rms = 0.;
346 <<
"\n StepSize of ch. tracks in cavity = "
353 G4cout.setf(mode,std::ios::floatfield);
372 const Run* localRun =
static_cast<const Run*
>(run);
395 std::vector<OneProcessCount*>::iterator it;
G4Material * GetWallMaterial()
DetectorConstruction * fDetector
static constexpr double MeV
G4double GetCavityThickness()
std::vector< OneProcessCount * > ProcessesCount
G4double GetDEDX(G4double kinEnergy, const G4ParticleDefinition *, const G4Material *, const G4Region *r=nullptr)
const G4String & GetParticleName() const
G4ParticleGun * GetParticleGun()
G4Material * GetCavityMaterial()
const G4String & GetName() const
G4long fPartFlowCavity[2]
G4double GetWorldRadius()
static constexpr double cm2
G4double GetWallThickness()
void AddWallCount(G4int wc)
static constexpr double mg
virtual void Merge(const G4Run *)
The primary generator action class with particle gun.
G4CsvAnalysisManager G4AnalysisManager
void RunInitialisation(G4double, G4double)
static G4Electron * Electron()
std::map< G4String, G4int > fProcCounter
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
void CountProcesses(G4String procName)
void AddCavityCount(G4int cc)
G4double GetParticleEnergy() const
G4double GetCSDARange(G4double kinEnergy, const G4ParticleDefinition *, const G4Material *, const G4Region *r=nullptr)
G4double fEnerFlowCavity[2]
G4GLOB_DLL std::ostream G4cout
static PROLOG_HANDLER error
virtual void Merge(const G4Run *)
void SurveyConvergence(G4int)
G4ParticleDefinition * GetParticleDefinition() const
static void showEngineStatus()
PrimaryGeneratorAction * fKinematic
Simple detector construction with a box volume placed in a world.
G4double GetDensity() const