35 #include "RunAction.hh"
36 #include "HistoManager.hh"
37 #include "PrimaryGeneratorAction.hh"
50 fHistoManager(0), fPrimary(kin)
68 fDecayCount = fTimeCount = 0;
69 for (
G4int i=0; i<3; i++) fEkinTot[i] = fPbalance[i] = fEventTime[i] = 0. ;
75 if ( analysisManager->IsActive() ) {
76 analysisManager->OpenFile();
88 fParticleCount[
name]++;
91 if (fParticleCount[name] == 1) fEmin[
name] = fEmax[
name] = Ekin;
92 if (Ekin < fEmin[name]) fEmin[
name] = Ekin;
93 if (Ekin > fEmax[name]) fEmax[
name] = Ekin;
103 if (fDecayCount == 1) fEkinTot[1] = fEkinTot[2] = Ekin;
104 if (Ekin < fEkinTot[1]) fEkinTot[1] = Ekin;
105 if (Ekin > fEkinTot[2]) fEkinTot[2] = Ekin;
107 fPbalance[0] += Pbal;
109 if (fDecayCount == 1) fPbalance[1] = fPbalance[2] = Pbal;
110 if (Pbal < fPbalance[1]) fPbalance[1] = Pbal;
111 if (Pbal > fPbalance[2]) fPbalance[2] = Pbal;
119 fEventTime[0] += time;
120 if (fTimeCount == 1) fEventTime[1] = fEventTime[2] = time;
121 if (time < fEventTime[1]) fEventTime[1] = time;
122 if (time > fEventTime[2]) fEventTime[2] = time;
129 fPrimaryTime += ptime;
137 if (nbEvents == 0) {
return; }
144 G4cout <<
"\n ======================== run summary ======================";
145 G4cout <<
"\n The run was " << nbEvents <<
" " << partName <<
" of "
147 G4cout <<
"\n ===========================================================\n";
150 G4int prec = 4, wid = prec + 2;
157 std::map<G4String,G4int>::iterator it;
158 for (it = fParticleCount.begin(); it != fParticleCount.end(); it++) {
160 G4int count = it->second;
164 G4cout <<
" " << std::setw(13) << name <<
": " << std::setw(7) << count
165 <<
" Emean = " << std::setw(wid) <<
G4BestUnit(eMean,
"Energy")
174 if (fDecayCount > 0) {
175 G4double Ebmean = fEkinTot[0]/fDecayCount;
176 G4double Pbmean = fPbalance[0]/fDecayCount;
178 G4cout <<
"\n Ekin Total (Q): mean = "
179 << std::setw(wid) <<
G4BestUnit(Ebmean,
"Energy")
180 <<
"\t( " <<
G4BestUnit(fEkinTot[1],
"Energy")
181 <<
" --> " <<
G4BestUnit(fEkinTot[2],
"Energy")
184 G4cout <<
"\n Momentum balance (excluding gamma desexcitation): mean = "
185 << std::setw(wid) <<
G4BestUnit(Pbmean,
"Energy")
186 <<
"\t( " <<
G4BestUnit(fPbalance[1],
"Energy")
187 <<
" --> " <<
G4BestUnit(fPbalance[2],
"Energy")
193 if (fTimeCount > 0) {
194 G4double Tmean = fEventTime[0]/fTimeCount;
195 G4double halfLife = Tmean*std::log(2.);
197 G4cout <<
"\n Total time of life : mean = "
198 << std::setw(wid) <<
G4BestUnit(Tmean,
"Time")
200 << std::setw(wid) <<
G4BestUnit(halfLife,
"Time")
202 <<
" --> " <<
G4BestUnit(fEventTime[2],
"Time")
208 G4double pTimeMean = fPrimaryTime/nbEvents;
211 G4double Activity_perUnitOfMass = 0.0;
213 { Activity_perUnitOfMass = nAtoms_perUnitOfMass/pTimeMean; }
215 G4cout <<
"\n Activity of " << partName <<
" = "
216 << std::setw(wid) << Activity_perUnitOfMass*
g/
becquerel
217 <<
" Bq/g (" << Activity_perUnitOfMass*
g/
curie
223 fParticleCount.clear();
224 fEmean.clear(); fEmin.clear(); fEmax.clear();
234 analysisManager->ScaleH1(1,factor);
235 analysisManager->ScaleH1(2,factor);
236 analysisManager->ScaleH1(3,factor);
237 analysisManager->ScaleH1(4,factor);
238 analysisManager->ScaleH1(5,factor);
239 if ( analysisManager->IsActive() ) {
240 analysisManager->Write();
241 analysisManager->CloseFile();
void BeginOfRunAction(const G4Run *)
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
void SetRandomNumberStore(G4bool flag)
const G4String & GetParticleName() const
void PrimaryTiming(G4double)
G4GLOB_DLL std::ostream G4cout
G4int GetNumberOfEvent() const
void EndOfRunAction(const G4Run *)
ExG4HbookAnalysisManager G4AnalysisManager
G4int GetAtomicMass() const
static G4RunManager * GetRunManager()
G4ParticleGun * GetParticleGun()
void ParticleCount(G4String, G4double)
G4ParticleDefinition * GetParticleDefinition() const
void EventTiming(G4double)
G4double GetParticleEnergy() const