35 #include "DetectorConstruction.hh"
36 #include "PrimaryGeneratorAction.hh"
49 fParticle(0), fEkin(0.),
50 fNbOfTraks0(0), fNbOfTraks1(0),
51 fNbOfSteps0(0), fNbOfSteps1(0),
53 fTrueRange(0.), fTrueRange2(0.),
54 fProjRange(0.), fProjRange2(0.),
55 fTransvDev(0.), fTransvDev2(0.)
74 std::map<G4String,G4int>::iterator it = fProcCounter.find(procName);
75 if ( it == fProcCounter.end()) {
76 fProcCounter[procName] = 1;
79 fProcCounter[procName]++;
87 const Run* localRun =
static_cast<const Run*
>(run);
90 fParticle = localRun->fParticle;
91 fEkin = localRun->fEkin;
95 fNbOfTraks0 += localRun->fNbOfTraks0;
96 fNbOfTraks1 += localRun->fNbOfTraks1;
97 fNbOfSteps0 += localRun->fNbOfSteps0;
98 fNbOfSteps1 += localRun->fNbOfSteps1;
99 fEdep += localRun->fEdep;
100 fTrueRange += localRun->fTrueRange;
101 fTrueRange2 += localRun->fTrueRange2;
102 fProjRange += localRun->fProjRange;
103 fProjRange2 += localRun->fProjRange2;
104 fTransvDev += localRun->fTransvDev;
105 fTransvDev2 += localRun->fTransvDev2;
108 std::map<G4String,G4int>::const_iterator it;
109 for (it = localRun->fProcCounter.begin();
110 it !=localRun->fProcCounter.end(); ++it) {
113 G4int localCount = it->second;
114 if ( fProcCounter.find(procName) == fProcCounter.end()) {
115 fProcCounter[procName] = localCount;
118 fProcCounter[procName] += localCount;
138 G4cout <<
"\n ======================== run summary ======================\n";
142 << material->
GetName() <<
" (density: "
148 G4cout <<
"\n total energy deposit: "
153 G4cout <<
"\n nb tracks/event"
154 <<
" neutral: " << std::setw(wid) << fNbOfTraks0/dNbOfEvents
155 <<
" charged: " << std::setw(wid) << fNbOfTraks1/dNbOfEvents
156 <<
"\n nb steps/event"
157 <<
" neutral: " << std::setw(wid) << fNbOfSteps0/dNbOfEvents
158 <<
" charged: " << std::setw(wid) << fNbOfSteps1/dNbOfEvents
165 std::map<G4String,G4int>::iterator it;
166 for (it = fProcCounter.begin(); it != fProcCounter.end(); it++) {
168 G4int count = it->second;
169 G4String space =
" ";
if (++index%3 == 0) space =
"\n";
170 G4cout <<
" " << std::setw(20) << procName <<
"="<< std::setw(7) << count
178 G4double trueRms = fTrueRange2 - fTrueRange*fTrueRange;
179 if (trueRms>0.) trueRms = std::sqrt(trueRms);
else trueRms = 0.;
182 G4double projRms = fProjRange2 - fProjRange*fProjRange;
183 if (projRms>0.) projRms = std::sqrt(projRms);
else projRms = 0.;
186 G4double trvsRms = fTransvDev2 - fTransvDev*fTransvDev;
187 if (trvsRms>0.) trvsRms = std::sqrt(trvsRms);
else trvsRms = 0.;
194 rangeTable = emCalculator.
GetCSDARange(fEkin,fParticle,material);
196 G4cout <<
"\n---------------------------------------------------------\n";
197 G4cout <<
" Primary particle : " ;
199 <<
" rms = " <<
G4BestUnit(trueRms,
"Length");
202 <<
" rms = " <<
G4BestUnit(projRms,
"Length");
204 G4cout <<
"\n proj/true = " << fProjRange/fTrueRange;
206 G4cout <<
"\n transverse dispersion at end = "
209 G4cout <<
"\n mass true Range from simulation = "
210 <<
G4BestUnit(fTrueRange*density,
"Mass/Surface")
211 <<
"\n from PhysicsTable (csda range) = "
212 <<
G4BestUnit(rangeTable*density,
"Mass/Surface");
213 G4cout <<
"\n---------------------------------------------------------\n";
217 fProcCounter.clear();
virtual void Merge(const G4Run *)
void CountProcesses(G4String procName)
const G4String & GetName() const
G4double GetDensity() const
G4double GetCSDARange(G4double kinEnergy, const G4ParticleDefinition *, const G4Material *, const G4Region *r=nullptr)
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
const G4String & GetParticleName() const
G4GLOB_DLL std::ostream G4cout
G4Material * GetMaterial()
G4double energy(const ThreeVector &p, const G4double m)
Detector construction class to define materials and geometry.
void SetPrimary(G4ParticleDefinition *particle, G4double energy)
G4double GetPDGCharge() const
virtual void Merge(const G4Run *)