35 #include "DetectorConstruction.hh"
36 #include "PrimaryGeneratorAction.hh"
50 fParticle(0), fEkin(0.),
51 fTotalCount(0), fSumTrack(0.), fSumTrack2(0.), fEnTransfer(0.)
70 std::map<G4String,G4int>::iterator it = fProcCounter.find(procName);
71 if ( it == fProcCounter.end()) {
72 fProcCounter[procName] = 1;
75 fProcCounter[procName]++;
85 fSumTrack2 += track*track;
99 const Run* localRun =
static_cast<const Run*
>(run);
102 fParticle = localRun->fParticle;
103 fEkin = localRun->fEkin;
106 std::map<G4String,G4int>::const_iterator it;
107 for (it = localRun->fProcCounter.begin();
108 it !=localRun->fProcCounter.end(); ++it) {
111 G4int localCount = it->second;
112 if ( fProcCounter.find(procName) == fProcCounter.end()) {
113 fProcCounter[procName] = localCount;
116 fProcCounter[procName] += localCount;
120 fTotalCount += localRun->fTotalCount;
121 fSumTrack += localRun->fSumTrack;
122 fSumTrack2 += localRun->fSumTrack2;
123 fEnTransfer += localRun->fEnTransfer;
142 G4cout <<
"\n ======================== run summary ======================\n";
146 << material->
GetName() <<
" (density: "
151 G4cout <<
"\n Process calls frequency --->";
152 std::map<G4String,G4int>::iterator it;
153 for (it = fProcCounter.begin(); it != fProcCounter.end(); it++) {
155 G4int count = it->second;
156 G4cout <<
"\t" << procName <<
" = " << count;
157 if (procName ==
"Transportation") survive = count;
161 G4cout <<
"\n\n Nb of incident particles surviving after "
166 if (fTotalCount == 0) fTotalCount = 1;
170 G4double MeanFreePath = fSumTrack /fTotalCount;
171 G4double MeanTrack2 = fSumTrack2/fTotalCount;
172 G4double rms = std::sqrt(std::fabs(MeanTrack2 - MeanFreePath*MeanFreePath));
173 G4double CrossSection = 1./MeanFreePath;
174 G4double massicMFP = MeanFreePath*density;
179 <<
"\tmassic: " <<
G4BestUnit(massicMFP,
"Mass/Surface")
180 <<
"\n CrossSection:\t" << CrossSection*
cm <<
" cm^-1 "
181 <<
"\t\t\tmassic: " <<
G4BestUnit(massicCS,
"Surface/Mass")
186 G4double MeanTransfer = fEnTransfer/fTotalCount;
187 G4double massTransfCoef = massicCS*MeanTransfer/fEkin;
189 G4cout <<
"\n mean energy of charged secondaries: "
191 <<
"\tmass_energy_transfer coef: "
197 G4cout <<
"\n Verification : "
198 <<
"crossSections from G4EmCalculator \n";
202 for (it = fProcCounter.begin(); it != fProcCounter.end(); it++) {
206 procName,material)/density;
210 procName,material)/density;
212 G4cout <<
"\t" << procName <<
"= "
219 fProcCounter.clear();
virtual void Merge(const G4Run *)
void CountProcesses(G4String procName)
const G4String & GetName() const
G4double GetDensity() const
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
const G4String & GetParticleName() const
G4GLOB_DLL std::ostream G4cout
void SumTrack(G4double track)
G4Material * GetMaterial()
static constexpr double cm
void SumeTransf(G4double energy)
G4double GetCrossSectionPerVolume(G4double kinEnergy, const G4ParticleDefinition *, const G4String &processName, const G4Material *, const G4Region *r=nullptr)
G4double energy(const ThreeVector &p, const G4double m)
G4double ComputeCrossSectionPerVolume(G4double kinEnergy, const G4ParticleDefinition *, const G4String &processName, const G4Material *, G4double cut=0.0)
Detector construction class to define materials and geometry.
void SetPrimary(G4ParticleDefinition *particle, G4double energy)
virtual void Merge(const G4Run *)