34 #include "RunAction.hh"
35 #include "DetectorConstruction.hh"
36 #include "PrimaryGeneratorAction.hh"
37 #include "HistoManager.hh"
52 :fDetector(det),fKinematic(kin),fProcCounter(0),fHistoManager(0)
70 CLHEP::HepRandom::showEngineStatus();
75 if (NbofEvents == 0)
return;
98 G4double effWallThick = factor*RangeWall;
99 if ((effWallThick > wallThickness)||(effWallThick <= 0.))
100 effWallThick = wallThickness;
114 std::ios::fmtflags mode =
G4cout.flags();
115 G4cout.setf(std::ios::fixed,std::ios::floatfield);
118 G4cout <<
"\n ======================== run conditions =====================\n";
120 G4cout <<
"\n The run will be " << NbofEvents <<
" "<< partName <<
" of "
122 <<
G4BestUnit(effWallThick,
"Length") <<
" of "
123 << mateWall->
GetName() <<
" (density: "
124 <<
G4BestUnit(densityWall,
"Volumic Mass") <<
"); Mass/cm2 = "
128 G4cout <<
"\n the cavity is "
129 <<
G4BestUnit(cavityThickness,
"Length") <<
" of "
130 << mateCavity->
GetName() <<
" (density: "
131 <<
G4BestUnit(densityCavity,
"Volumic Mass") <<
"); Mass/cm2 = "
133 <<
" --> massRatio = " << std::setprecision(6) << massRatio <<
G4endl;
137 <<
"; range in cavity: " <<
G4BestUnit(RangeCavity,
"Length")
140 G4cout <<
"\n ============================================================\n";
146 dedxWall /= densityWall;
149 dedxCavity /= densityCavity;
151 G4cout << std::setprecision(4)
152 <<
"\n StoppingPower in wall = "
155 <<
G4BestUnit(dedxCavity,
"Energy*Surface/Mass")
180 if ( analysisManager->IsActive() ) {
181 analysisManager->OpenFile();
185 G4cout.setf(mode,std::ios::floatfield);
196 while ((i<nbProc)&&((*
fProcCounter)[i]->GetName()!=procName)) i++;
199 (*fProcCounter)[i]->Count();
206 if (NbofEvents == 0)
return;
222 G4double ratio = doseCavity/energyFluence;
225 std::ios::fmtflags mode =
G4cout.flags();
226 G4cout.setf(std::ios::fixed,std::ios::floatfield);
229 G4cout <<
"\n--->evntNb= " << NbofEvents
230 <<
" Nwall= " << Nwall
231 <<
" Ncav= " << Ncavity
232 <<
" Ic/Iw= " << Iratio
234 <<
" doseCavity/Ebeam= " << ratio
235 <<
" (100*(ratio-1) = " << err <<
" %)"
239 G4cout.setf(mode,std::ios::floatfield);
247 std::ios::fmtflags mode =
G4cout.flags();
248 G4cout.setf(std::ios::fixed,std::ios::floatfield);
252 if (NbofEvents == 0)
return;
256 G4cout <<
"\n Process calls frequency --->";
258 G4String procName = (*fProcCounter)[i]->GetName();
259 G4int count = (*fProcCounter)[i]->GetCounter();
260 G4cout <<
" " << procName <<
"= " << count;
267 <<
"\n Charged particle flow in cavity :"
288 <<
"\n beamFluence in wall = " << Nwall
289 <<
"\t in cavity = " << Ncavity
290 <<
"\t Icav/Iwall = " << Iratio
291 <<
"\t energyFluence = " << energyFluence/(
MeV*
cm2/
mg) <<
" MeV*cm2/mg"
299 G4double varianceEdep = meanEdep2 - meanEdep*meanEdep;
301 if(varianceEdep>0.) dEoverE = std::sqrt(varianceEdep/
fNbEventCavity)/meanEdep;
306 G4double ratio = doseCavity/energyFluence,
error = ratio*dEoverE;
310 <<
" +- " << 100*dEoverE <<
" %"
311 <<
"\n Total dose in cavity = " << doseCavity/(
MeV*
cm2/
mg) <<
" MeV*cm2/mg"
312 <<
" +- " << 100*dEoverE <<
" %"
313 <<
"\n\n DoseCavity/EnergyFluence = " << ratio
314 <<
" +- " << error << G4endl;
322 <<
"\n Total charged trackLength in cavity = "
324 <<
" (mean value = " <<
G4BestUnit(meantrack,
"Length") <<
")"
331 if (rms>0.) rms = std::sqrt(rms);
else rms = 0.;
335 <<
"\n StepSize of ch. tracks in wall = "
337 <<
"\t (nbSteps/track = " << double(
fNbStepWall)/nbTrackWall <<
")";
341 if (rms>0.) rms = std::sqrt(rms);
else rms = 0.;
344 <<
"\n StepSize of ch. tracks in cavity = "
351 G4cout.setf(mode,std::ios::floatfield);
364 if ( analysisManager->IsActive() ) {
365 analysisManager->Write();
366 analysisManager->CloseFile();
370 CLHEP::HepRandom::showEngineStatus();
std::vector< OneProcessCount * > ProcessesCount
G4Material * GetCavityMaterial()
void BeginOfRunAction(const G4Run *)
G4Material * GetWallMaterial()
const G4String & GetName() const
G4double GetDensity() const
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
void SetRandomNumberStore(G4bool flag)
DetectorConstruction * fDetector
const G4String & GetParticleName() const
HistoManager * fHistoManager
G4double GetDEDX(G4double kinEnergy, const G4ParticleDefinition *, const G4Material *, const G4Region *r=0)
G4double GetWallThickness()
G4double GetCSDARange(G4double kinEnergy, const G4ParticleDefinition *, const G4Material *, const G4Region *r=0)
PrimaryGeneratorAction * fKinematic
G4GLOB_DLL std::ostream G4cout
G4int GetNumberOfEvent() const
void EndOfRunAction(const G4Run *)
ExG4HbookAnalysisManager G4AnalysisManager
G4double GetCavityThickness()
void CountProcesses(G4String)
G4long fPartFlowCavity[2]
ProcessesCount * fProcCounter
static G4RunManager * GetRunManager()
G4double GetWorldRadius()
static const G4double factor
G4ParticleGun * GetParticleGun()
void RunInitialisation(G4double, G4double)
G4double fEnerFlowCavity[2]
void SurveyConvergence(G4int)
G4ParticleDefinition * GetParticleDefinition() const
G4int GetNumberOfEventToBeProcessed() const
static G4Electron * Electron()
Detector construction class to demonstrate various ways of placement.
static PROLOG_HANDLER error
G4double GetParticleEnergy() const