35 #include "DetectorConstruction.hh"
37 #include "HistoManager.hh"
38 #include "PrimaryGeneratorAction.hh"
49 fParticle(0), fEkin(0.),
50 fNbInelastic(0), fNbInelastic2(0),
51 fEdeposit(0.), fEdeposit2(0.),
52 fTrackLen(0.), fTrackLen2(0.),
53 fProjRange(0.), fProjRange2(0.),
54 fNbOfSteps(0), fNbOfSteps2(0),
55 fStepSize(0.), fStepSize2(0.)
76 fNbInelastic2 += nb*nb;
108 fNbOfSteps2 += nb*nb;
117 const Run* localRun =
static_cast<const Run*
>(run);
120 fParticle = localRun->fParticle;
121 fEkin = localRun->fEkin;
124 fNbInelastic += localRun->fNbInelastic;
125 fNbInelastic2 += localRun->fNbInelastic2;
126 fEdeposit += localRun->fEdeposit;
127 fEdeposit2 += localRun->fEdeposit2;
128 fTrackLen += localRun->fTrackLen;
129 fTrackLen2 += localRun->fTrackLen2;
130 fProjRange += localRun->fProjRange;
131 fProjRange2 += localRun->fProjRange2;
132 fNbOfSteps += localRun->fNbOfSteps ;
133 fNbOfSteps2 += localRun->fNbOfSteps2;
134 fStepSize += localRun->fStepSize;
135 fStepSize2 += localRun->fStepSize2;
144 std::ios::fmtflags mode =
G4cout.flags();
145 G4cout.setf(std::ios::fixed,std::ios::floatfield);
154 G4cout <<
"\n ======================== run summary =====================\n";
156 <<
"\n The run is " <<
numberOfEvent <<
" "<< partName <<
" of "
157 <<
G4BestUnit(fEkin,
"Energy") <<
" through a sphere of radius "
159 << material->
GetName() <<
" (density: "
163 G4cout.setf(mode,std::ios::floatfield);
170 G4double rms = fNbInelastic2 - fNbInelastic*fNbInelastic;
171 if (rms>0.) rms = std::sqrt(rms);
else rms = 0.;
175 <<
"\n Nb of ionisations = " << fNbInelastic
181 <<
"\n w = " <<
G4BestUnit((fEkin)/fNbInelastic,
"Energy")
182 <<
" +- " <<
G4BestUnit((fEkin)*rms/(fNbInelastic*fNbInelastic),
"Energy")
189 myFile = fopen (
"wvalue.txt",
"a");
190 fprintf (myFile,
"%e %e %e %e %e \n", fEkin/
eV, fNbInelastic, rms, fEkin/
eV/fNbInelastic,
191 (fEkin/
eV)*rms/(fNbInelastic*fNbInelastic) );
197 rms = fEdeposit2 - fEdeposit*fEdeposit;
198 if (rms>0.) rms = std::sqrt(rms);
else rms = 0.;
202 <<
"\n Total Energy deposited = " <<
G4BestUnit(fEdeposit,
"Energy")
209 rms = fTrackLen2 - fTrackLen*fTrackLen;
210 if (rms>0.) rms = std::sqrt(rms);
else rms = 0.;
214 <<
"\n Track length of primary track = " <<
G4BestUnit(fTrackLen,
"Length")
220 rms = fProjRange2 - fProjRange*fProjRange;
221 if (rms>0.) rms = std::sqrt(rms);
else rms = 0.;
224 <<
"\n Projected range = " <<
G4BestUnit(fProjRange,
"Length")
231 G4double fNbSteps = fNbOfSteps/dNofEvents,
232 fNbSteps2 = fNbOfSteps2/dNofEvents;
233 rms = fNbSteps2 - fNbSteps*fNbSteps;
234 if (rms>0.) rms = std::sqrt(rms);
else rms = 0.;
237 G4cout <<
"\n Nb of steps of primary track = " << fNbSteps <<
" +- " << rms
241 rms = fStepSize2 - fStepSize*fStepSize;
242 if (rms>0.) rms = std::sqrt(rms);
else rms = 0.;
246 <<
"\n Step size = " <<
G4BestUnit(fStepSize,
"Length")
254 G4double binWidth = analysisManager->GetH1Width(ih);
256 analysisManager->ScaleH1(ih,fac);
259 G4cout.setf(mode,std::ios::floatfield);
virtual void Merge(const G4Run *)
static constexpr double mm
const G4String & GetName() const
G4double GetDensity() const
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
void AddInelastic(G4int nb)
const G4String & GetParticleName() const
G4Material * GetAbsorMaterial(G4int i)
void AddEdep(G4double val)
G4GLOB_DLL std::ostream G4cout
G4double GetAbsorRadius()
static constexpr double eV
G4double energy(const ThreeVector &p, const G4double m)
static const G4double fac
Detector construction class to define materials and geometry.
static constexpr double MeV
void AddTrackLength(G4double t)
void AddStepSize(G4int nb, G4double st)
void SetPrimary(G4ParticleDefinition *particle, G4double energy)
virtual void Merge(const G4Run *)
G4CsvAnalysisManager G4AnalysisManager
void AddProjRange(G4double x)