35 #include "DetectorConstruction.hh"
36 #include "PrimaryGeneratorAction.hh"
50 fParticle(0), fEkin(0.)
69 std::map<G4String,G4int>::iterator it =
fProcCounter.find(procName);
82 const Run* localRun =
static_cast<const Run*
>(run);
89 std::map<G4String,G4int>::const_iterator it;
94 G4int localCount = it->second;
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;
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";
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;
void SetPrimary(G4ParticleDefinition *particle, G4double energy)
DetectorConstruction * fDetector
const G4String & GetParticleName() const
const G4String & GetName() const
virtual void Merge(const G4Run *)
std::map< G4String, G4int > fProcCounter
G4ParticleDefinition * fParticle
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
G4double ComputeCrossSectionPerVolume(G4double kinEnergy, const G4ParticleDefinition *, const G4String &processName, const G4Material *, G4double cut=0.0)
void CountProcesses(G4String procName)
G4double GetCrossSectionPerVolume(G4double kinEnergy, const G4ParticleDefinition *, const G4String &processName, const G4Material *, const G4Region *r=nullptr)
static constexpr double cm
G4GLOB_DLL std::ostream G4cout
virtual void Merge(const G4Run *)
G4Material * GetMaterial()
Simple detector construction with a box volume placed in a world.
G4double GetDensity() const