35 #include "DetectorConstruction.hh"
37 #include "EventAction.hh"
38 #include "HistoManager.hh"
39 #include "PrimaryGeneratorAction.hh"
52 fParticle(0), fEkin(0.),
53 fTrackLen(0.), fTrackLen2(0.),
54 fProjRange(0.), fProjRange2(0.),
55 fNbOfSteps(0), fNbOfSteps2(0),
56 fStepSize(0.), fStepSize2(0.)
58 for (
G4int i=0; i<3; ++i) { fStatus[i] = 0; fTotEdep[i] = 0.; }
61 fEdeposit[i] = 0.; fEmin[i] =
joule; fEmax[i] = 0.;
62 fCsdaRange[i] = 0.; fXfrontNorm[i] = 0.;
85 if (e < fEmin[i]) fEmin[i] = e;
86 if (e > fEmax[i]) fEmax[i] = e;
96 if (e < fTotEdep[1]) fTotEdep[1] = e;
97 if (e > fTotEdep[2]) fTotEdep[2] = e;
121 fNbOfSteps2 += nb*nb;
137 fCsdaRange[i] =
value;
144 fXfrontNorm[i] =
value;
151 return fCsdaRange[i];
158 return fXfrontNorm[i];
165 const Run* localRun =
static_cast<const Run*
>(run);
168 fParticle = localRun->fParticle;
169 fEkin = localRun->fEkin;
172 fTrackLen += localRun->fTrackLen;
173 fTrackLen2 += localRun->fTrackLen2;
174 fProjRange += localRun->fProjRange;
175 fProjRange2 += localRun->fProjRange2;
176 fNbOfSteps += localRun->fNbOfSteps ;
177 fNbOfSteps2 += localRun->fNbOfSteps2;
178 fStepSize += localRun->fStepSize;
179 fStepSize2 += localRun->fStepSize2;
182 for (
G4int i=1; i<=nbOfAbsor; ++i) {
183 fEdeposit[i] += localRun->fEdeposit[i];
184 fCsdaRange[i] = localRun->fCsdaRange[i];
185 fXfrontNorm[i] = localRun->fXfrontNorm[i];
188 min = localRun->fEmin[i]; max = localRun->fEmax[i];
189 if (fEmin[i] > min) fEmin[i] =
min;
190 if (fEmax[i] < max) fEmax[i] =
max;
193 for (
G4int i=0; i<3; ++i) fStatus[i] += localRun->fStatus[i];
196 fTotEdep[0] += localRun->fTotEdep[0];
198 min = localRun->fTotEdep[1]; max = localRun->fTotEdep[2];
199 if (fTotEdep[1] > min) fTotEdep[1] =
min;
200 if (fTotEdep[2] < max) fTotEdep[2] =
max;
209 std::ios::fmtflags mode =
G4cout.flags();
210 G4cout.setf(std::ios::fixed,std::ios::floatfield);
218 G4cout <<
"\n ======================== run summary =====================\n";
220 <<
"\n The run is " <<
numberOfEvent <<
" "<< partName <<
" of "
222 <<
" through " << nbOfAbsor <<
" absorbers: \n";
223 for (
G4int i=1; i<= nbOfAbsor; i++) {
227 G4cout << std::setw(5) << i
228 << std::setw(10) <<
G4BestUnit(thickness,
"Length") <<
" of "
229 << material->
GetName() <<
" (density: "
234 G4cout.setf(mode,std::ios::floatfield);
242 for (
G4int i=1; i<= nbOfAbsor; i++) {
246 <<
"\n Edep in absorber " << i <<
" = "
257 <<
"\n Edep in all absorbers = " <<
G4BestUnit(fTotEdep[0],
"Energy")
266 rms = fTrackLen2 - fTrackLen*fTrackLen;
267 if (rms>0.) rms = std::sqrt(rms);
else rms = 0.;
271 <<
"\n Track length of primary track = " <<
G4BestUnit(fTrackLen,
"Length")
277 if (NbOfAbsor == 1) {
279 <<
"\n Range from EmCalculator = " <<
G4BestUnit(fCsdaRange[1],
"Length")
280 <<
" (from full dE/dx)" <<
G4endl;
286 rms = fProjRange2 - fProjRange*fProjRange;
287 if (rms>0.) rms = std::sqrt(rms);
else rms = 0.;
290 <<
"\n Projected range = " <<
G4BestUnit(fProjRange,
"Length")
297 G4double fNbSteps = fNbOfSteps/dNofEvents,
298 fNbSteps2 = fNbOfSteps2/dNofEvents;
299 rms = fNbSteps2 - fNbSteps*fNbSteps;
300 if (rms>0.) rms = std::sqrt(rms);
else rms = 0.;
303 G4cout <<
"\n Nb of steps of primary track = " << fNbSteps <<
" +- " << rms;
306 rms = fStepSize2 - fStepSize*fStepSize;
307 if (rms>0.) rms = std::sqrt(rms);
else rms = 0.;
311 <<
"\t Step size= " <<
G4BestUnit(fStepSize,
"Length")
318 G4double transmit = 100.*fStatus[1]/dNofEvents;
319 G4double reflected = 100.*fStatus[2]/dNofEvents;
323 <<
"\n absorbed = " << absorbed <<
" %"
324 <<
" transmit = " << transmit <<
" %"
325 <<
" reflected = " << reflected <<
" %" <<
G4endl;
331 G4double binWidth = analysisManager->GetH1Width(ih)
332 *analysisManager->GetH1Unit(ih);
334 analysisManager->ScaleH1(ih,fac);
337 binWidth = analysisManager->GetH1Width(ih);
339 analysisManager->ScaleH1(ih,fac);
342 G4cout.setf(mode,std::ios::floatfield);
virtual void Merge(const G4Run *)
static constexpr double mm
static constexpr double cm2
const G4String & GetName() const
void SetCsdaRange(G4int i, G4double value)
G4double GetDensity() const
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
const G4String & GetParticleName() const
G4Material * GetAbsorMaterial(G4int i)
void AddEdep(G4double val)
G4GLOB_DLL std::ostream G4cout
const XML_Char int const XML_Char * value
void SetXfrontNorm(G4int i, G4double value)
G4double GetAbsorThickness(G4int i)
G4double GetXfrontNorm(G4int i)
T max(const T t1, const T t2)
brief Return the largest of the two arguments
G4double energy(const ThreeVector &p, const G4double m)
static constexpr double joule
void AddTrackStatus(G4int i)
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
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)
void AddTotEdep(G4double e)
virtual void Merge(const G4Run *)
G4CsvAnalysisManager G4AnalysisManager
void AddProjRange(G4double x)