35 #include "DetectorConstruction.hh"
36 #include "PrimaryGeneratorAction.hh"
50 fParticle(0), fEkin(0.)
69 std::map<G4String,G4int>::iterator it = fProcCounter.find(procName);
70 if ( it == fProcCounter.end()) {
71 fProcCounter[procName] = 1;
74 fProcCounter[procName]++;
82 const Run* localRun =
static_cast<const Run*
>(run);
85 fParticle = localRun->fParticle;
86 fEkin = localRun->fEkin;
89 std::map<G4String,G4int>::const_iterator it;
90 for (it = localRun->fProcCounter.begin();
91 it !=localRun->fProcCounter.end(); ++it) {
94 G4int localCount = it->second;
95 if ( fProcCounter.find(procName) == fProcCounter.end()) {
96 fProcCounter[procName] = localCount;
99 fProcCounter[procName] += localCount;
120 G4cout <<
"\n ======================== run summary ======================\n";
124 << material->
GetName() <<
" (density: "
128 G4int totalCount = 0;
130 G4cout <<
"\n Process calls frequency --->";
131 std::map<G4String,G4int>::iterator it;
132 for (it = fProcCounter.begin(); it != fProcCounter.end(); it++) {
134 G4int count = it->second;
136 G4cout <<
"\t" << procName <<
" = " << count;
137 if (procName ==
"Transportation") survive = count;
141 if (totalCount == 0) {
G4cout.precision(dfprec);
return;};
142 G4double ratio = double(survive)/totalCount;
144 G4cout <<
"\n Nb of incident particles unaltered after "
146 << material->
GetName() <<
" : " << survive
147 <<
" over " << totalCount <<
" incident particles."
148 <<
" Ratio = " << 100*ratio <<
" %" <<
G4endl;
150 if (ratio == 0.)
return;
154 G4double CrossSection = - std::log(ratio)/tickness;
155 G4double massicCS = CrossSection/density;
157 G4cout <<
" ---> CrossSection per volume:\t" << CrossSection*
cm <<
" cm^-1 "
158 <<
"\tCrossSection per mass: " <<
G4BestUnit(massicCS,
"Surface/Mass")
163 G4cout <<
"\n Verification from G4EmCalculator: \n";
166 for (it = fProcCounter.begin(); it != fProcCounter.end(); it++) {
170 procName,material)/density;
174 procName,material)/density;
176 if (procName !=
"Transportation")
177 G4cout <<
"\t" << procName <<
"= "
184 G4double Ratio = std::exp(-sumc*density*tickness);
185 G4cout <<
"\tExpected ratio of transmitted particles= "
186 << 100*Ratio <<
" %" <<
G4endl;
189 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
G4Material * GetMaterial()
static constexpr double cm
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 *)