34 #include "RunAction.hh"
36 #include "DetectorConstruction.hh"
37 #include "PrimaryGeneratorAction.hh"
38 #include "HistoManager.hh"
52 : fDetector(det), fPrimary(prim)
74 fTotalCount = fGammaCount = 0;
75 fSumTrack = fSumTrack2 = 0.;
76 for (
G4int i=0; i<3; i++) { fPbalance[i] = 0. ; }
77 for (
G4int i=0; i<3; i++) { fNbGamma[i] = 0 ; }
82 if ( analysisManager->IsActive() ) {
83 analysisManager->OpenFile();
91 fParticleCount[
name]++;
94 if (fParticleCount[name] == 1) fEmin[
name] = fEmax[
name] = Ekin;
95 if (Ekin < fEmin[name]) fEmin[
name] = Ekin;
96 if (Ekin > fEmax[name]) fEmax[
name] = Ekin;
103 fNuclChannelCount[
name]++;
104 fNuclChannelQ[
name] += Q;
111 fPbalance[0] += Pbal;
113 if (fTotalCount == 1) fPbalance[1] = fPbalance[2] = Pbal;
114 if (Pbal < fPbalance[1]) fPbalance[1] = Pbal;
115 if (Pbal > fPbalance[2]) fPbalance[2] = Pbal;
123 fNbGamma[0] += nGamma;
125 if (fGammaCount == 1) fNbGamma[1] = fNbGamma[2] = nGamma;
126 if (nGamma < fNbGamma[1]) fNbGamma[1] = nGamma;
127 if (nGamma > fNbGamma[2]) fNbGamma[2] = nGamma;
134 if (NbOfEvents == 0)
return;
136 G4int prec = 5, wid = prec + 2;
147 G4cout <<
"\n The run consists of " << NbOfEvents <<
" "<< Particle <<
" of "
150 << material->
GetName() <<
" (density: "
154 G4cout <<
"\n Process calls frequency --->";
155 std::map<const G4VProcess*,G4int>::iterator it;
156 for (it = fProcCounter.begin(); it != fProcCounter.end(); it++) {
158 G4int count = it->second;
159 G4cout <<
"\t" << procName <<
"= " << count;
160 if (procName ==
"Transportation") survive = count;
164 G4cout <<
"\n\n Nb of incident particles surviving after "
169 if (fTotalCount == 0) fTotalCount = 1;
173 G4double MeanFreePath = fSumTrack /fTotalCount;
174 G4double MeanTrack2 = fSumTrack2/fTotalCount;
175 G4double rms = std::sqrt(std::fabs(MeanTrack2 - MeanFreePath*MeanFreePath));
177 if(MeanFreePath > 0.0) { CrossSection = 1./MeanFreePath; }
180 if(massicMFP > 0.0) { massicCS = 1./massicMFP; }
184 <<
"\tmassic: " <<
G4BestUnit(massicMFP,
"Mass/Surface")
185 <<
"\n CrossSection:\t" << CrossSection*
cm <<
" cm^-1 "
186 <<
"\t\tmassic: " <<
G4BestUnit(massicCS,
"Surface/Mass")
191 G4cout <<
"\n Verification : "
192 <<
"crossSections from G4HadronicProcessStore:";
196 for (it = fProcCounter.begin(); it != fProcCounter.end(); it++) {
203 G4cout <<
"\n " << procName <<
"= "
213 std::map<G4String,G4int>::iterator ic;
214 for (ic = fNuclChannelCount.begin(); ic != fNuclChannelCount.end(); ic++) {
216 G4int count = ic->second;
219 G4cout <<
" " << std::setw(50) << name <<
": " << std::setw(7) << count
220 <<
" Q = " << std::setw(wid) <<
G4BestUnit(Q,
"Energy")
226 if (fGammaCount > 0) {
227 G4cout <<
"\n" << std::setw(58) <<
"Number of gamma: N = "
228 << fNbGamma[1] <<
" --> " << fNbGamma[2] <<
G4endl;
233 G4cout <<
"\n List of generated particles: \n" <<
G4endl;
235 std::map<G4String,G4int>::iterator ip;
236 for (ip = fParticleCount.begin(); ip != fParticleCount.end(); ip++) {
238 G4int count = ip->second;
242 G4cout <<
" " << std::setw(13) << name <<
": " << std::setw(7) << count
243 <<
" Emean = " << std::setw(wid) <<
G4BestUnit(eMean,
"Energy")
251 if (fTotalCount > 1) {
252 G4double Pbmean = fPbalance[0]/fTotalCount;
253 G4cout <<
"\n Momentum balance: Pmean = "
254 << std::setw(wid) <<
G4BestUnit(Pbmean,
"Energy")
255 <<
"\t( " <<
G4BestUnit(fPbalance[1],
"Energy")
256 <<
" --> " <<
G4BestUnit(fPbalance[2],
"Energy")
264 fProcCounter.clear();
266 fNuclChannelCount.clear();
267 fNuclChannelQ.clear();
269 fParticleCount.clear();
270 fEmean.clear(); fEmin.clear(); fEmax.clear();
274 if ( analysisManager->IsActive() ) {
275 analysisManager->Write();
276 analysisManager->CloseFile();