Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/examples/extended/hadronic/Hadr03/src/Run.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /examples/extended/hadronic/Hadr03/src/Run.cc (Version 11.3.0) and /examples/extended/hadronic/Hadr03/src/Run.cc (Version 10.5)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 /// \file Run.cc                                   26 /// \file Run.cc
 27 /// \brief Implementation of the Run class         27 /// \brief Implementation of the Run class
 28 //                                                 28 //
 29 //                                             <<  29 // 
 30 //....oooOO0OOooo........oooOO0OOooo........oo     30 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 31 //....oooOO0OOooo........oooOO0OOooo........oo     31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 32                                                    32 
 33 #include "Run.hh"                                  33 #include "Run.hh"
 34                                                << 
 35 #include "DetectorConstruction.hh"                 34 #include "DetectorConstruction.hh"
 36 #include "HistoManager.hh"                     << 
 37 #include "PrimaryGeneratorAction.hh"               35 #include "PrimaryGeneratorAction.hh"
                                                   >>  36 #include "HistoManager.hh"
 38                                                    37 
 39 #include "G4HadronicProcess.hh"                << 
 40 #include "G4HadronicProcessStore.hh"           << 
 41 #include "G4Neutron.hh"                        << 
 42 #include "G4ProcessTable.hh"                       38 #include "G4ProcessTable.hh"
 43 #include "G4SystemOfUnits.hh"                  <<  39 #include "G4HadronicProcessStore.hh"
 44 #include "G4UnitsTable.hh"                         40 #include "G4UnitsTable.hh"
                                                   >>  41 #include "G4SystemOfUnits.hh"
 45                                                    42 
 46 //....oooOO0OOooo........oooOO0OOooo........oo     43 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 47                                                    44 
 48 Run::Run(DetectorConstruction* det) : fDetecto <<  45 Run::Run(DetectorConstruction* det)
                                                   >>  46 : G4Run(),
                                                   >>  47   fDetector(det), fParticle(0), fEkin(0.),
                                                   >>  48   fTotalCount(0), fGammaCount(0),
                                                   >>  49   fSumTrack(0.), fSumTrack2(0.),
                                                   >>  50   fTargetXXX(false)
 49 {                                                  51 {
 50   for (G4int i = 0; i < 3; i++) {              <<  52   for (G4int i=0; i<3; i++) { fPbalance[i] = 0. ; }
 51     fPbalance[i] = 0.;                         <<  53   for (G4int i=0; i<3; i++) { fNbGamma[i] = 0 ; }
 52   }                                            << 
 53   for (G4int i = 0; i < 3; i++) {              << 
 54     fNbGamma[i] = 0;                           << 
 55   }                                            << 
 56   fPbalance[1] = DBL_MAX;                          54   fPbalance[1] = DBL_MAX;
 57   fNbGamma[1] = 10000;                         <<  55   fNbGamma[1]  = 10000;
 58 }                                                  56 }
                                                   >>  57 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >>  58 
                                                   >>  59 Run::~Run()
                                                   >>  60 { }
 59                                                    61 
 60 //....oooOO0OOooo........oooOO0OOooo........oo     62 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 61                                                    63 
 62 void Run::SetPrimary(G4ParticleDefinition* par     64 void Run::SetPrimary(G4ParticleDefinition* particle, G4double energy)
 63 {                                              <<  65 { 
 64   fParticle = particle;                            66   fParticle = particle;
 65   fEkin = energy;                                  67   fEkin = energy;
 66 }                                              <<  68 } 
 67                                                    69 
 68 //....oooOO0OOooo........oooOO0OOooo........oo     70 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 69                                                    71 
 70 void Run::SetTargetXXX(G4bool flag)                72 void Run::SetTargetXXX(G4bool flag)
 71 {                                              <<  73 { 
 72   fTargetXXX = flag;                               74   fTargetXXX = flag;
 73 }                                                  75 }
 74                                                <<  76  
 75 //....oooOO0OOooo........oooOO0OOooo........oo     77 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 76                                                    78 
 77 void Run::CountProcesses(G4VProcess* process)  <<  79 void Run::CountProcesses(G4VProcess* process) 
 78 {                                                  80 {
 79   if (process == nullptr) return;              << 
 80   G4String procName = process->GetProcessName(     81   G4String procName = process->GetProcessName();
 81   std::map<G4String, G4int>::iterator it = fPr <<  82   std::map<G4String,G4int>::iterator it = fProcCounter.find(procName);
 82   if (it == fProcCounter.end()) {              <<  83   if ( it == fProcCounter.end()) {
 83     fProcCounter[procName] = 1;                    84     fProcCounter[procName] = 1;
 84   }                                                85   }
 85   else {                                           86   else {
 86     fProcCounter[procName]++;                  <<  87     fProcCounter[procName]++; 
 87   }                                                88   }
 88 }                                              <<  89 }                 
 89                                                << 
 90 //....oooOO0OOooo........oooOO0OOooo........oo     90 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 91                                                    91 
 92 void Run::SumTrack(G4double trackl)                92 void Run::SumTrack(G4double trackl)
 93 {                                                  93 {
 94   fTotalCount++;                                   94   fTotalCount++;
 95   fSumTrack += trackl;                         <<  95   fSumTrack += trackl; fSumTrack2 += trackl*trackl;  
 96   fSumTrack2 += trackl * trackl;               << 
 97 }                                                  96 }
 98                                                    97 
 99 //....oooOO0OOooo........oooOO0OOooo........oo     98 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
100                                                    99 
101 void Run::CountNuclearChannel(G4String name, G    100 void Run::CountNuclearChannel(G4String name, G4double Q)
102 {                                                 101 {
103   std::map<G4String, NuclChannel>::iterator it    102   std::map<G4String, NuclChannel>::iterator it = fNuclChannelMap.find(name);
104   if (it == fNuclChannelMap.end()) {           << 103   if ( it == fNuclChannelMap.end()) {
105     fNuclChannelMap[name] = NuclChannel(1, Q);    104     fNuclChannelMap[name] = NuclChannel(1, Q);
106   }                                               105   }
107   else {                                          106   else {
108     NuclChannel& data = it->second;               107     NuclChannel& data = it->second;
109     data.fCount++;                                108     data.fCount++;
110     data.fQ += Q;                                 109     data.fQ += Q;
111   }                                            << 110   }       
112 }                                                 111 }
113                                                << 112                   
114 //....oooOO0OOooo........oooOO0OOooo........oo    113 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
115                                                   114 
116 void Run::ParticleCount(G4String name, G4doubl    115 void Run::ParticleCount(G4String name, G4double Ekin)
117 {                                                 116 {
118   std::map<G4String, ParticleData>::iterator i    117   std::map<G4String, ParticleData>::iterator it = fParticleDataMap.find(name);
119   if (it == fParticleDataMap.end()) {          << 118   if ( it == fParticleDataMap.end()) {
120     fParticleDataMap[name] = ParticleData(1, E    119     fParticleDataMap[name] = ParticleData(1, Ekin, Ekin, Ekin);
121   }                                               120   }
122   else {                                          121   else {
123     ParticleData& data = it->second;              122     ParticleData& data = it->second;
124     data.fCount++;                                123     data.fCount++;
125     data.fEmean += Ekin;                          124     data.fEmean += Ekin;
126     // update min max                          << 125     //update min max
127     G4double emin = data.fEmin;                   126     G4double emin = data.fEmin;
128     if (Ekin < emin) data.fEmin = Ekin;           127     if (Ekin < emin) data.fEmin = Ekin;
129     G4double emax = data.fEmax;                   128     G4double emax = data.fEmax;
130     if (Ekin > emax) data.fEmax = Ekin;        << 129     if (Ekin > emax) data.fEmax = Ekin; 
131   }                                            << 130   }   
132 }                                                 131 }
133 //....oooOO0OOooo........oooOO0OOooo........oo    132 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
134                                                   133 
135 void Run::Balance(G4double Pbal)                  134 void Run::Balance(G4double Pbal)
136 {                                              << 135 { 
137   fPbalance[0] += Pbal;                           136   fPbalance[0] += Pbal;
138   // update min max                            << 137   //update min max   
139   if (fTotalCount == 1) fPbalance[1] = fPbalan << 138   if (fTotalCount == 1) fPbalance[1] = fPbalance[2] = Pbal;  
140   if (Pbal < fPbalance[1]) fPbalance[1] = Pbal    139   if (Pbal < fPbalance[1]) fPbalance[1] = Pbal;
141   if (Pbal > fPbalance[2]) fPbalance[2] = Pbal << 140   if (Pbal > fPbalance[2]) fPbalance[2] = Pbal;    
142 }                                                 141 }
143                                                   142 
144 //....oooOO0OOooo........oooOO0OOooo........oo    143 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
145                                                   144 
146 void Run::CountGamma(G4int nGamma)                145 void Run::CountGamma(G4int nGamma)
147 {                                              << 146 { 
148   fGammaCount++;                                  147   fGammaCount++;
149   fNbGamma[0] += nGamma;                          148   fNbGamma[0] += nGamma;
150   // update min max                            << 149   //update min max   
151   if (fGammaCount == 1) fNbGamma[1] = fNbGamma << 150   if (fGammaCount == 1) fNbGamma[1] = fNbGamma[2] = nGamma;  
152   if (nGamma < fNbGamma[1]) fNbGamma[1] = nGam    151   if (nGamma < fNbGamma[1]) fNbGamma[1] = nGamma;
153   if (nGamma > fNbGamma[2]) fNbGamma[2] = nGam << 152   if (nGamma > fNbGamma[2]) fNbGamma[2] = nGamma;    
154 }                                                 153 }
155                                                   154 
156 //....oooOO0OOooo........oooOO0OOooo........oo    155 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
157                                                   156 
158 void Run::Merge(const G4Run* run)                 157 void Run::Merge(const G4Run* run)
159 {                                                 158 {
160   const Run* localRun = static_cast<const Run*    159   const Run* localRun = static_cast<const Run*>(run);
161                                                << 160   
162   // primary particle info                     << 161   //primary particle info
163   //                                              162   //
164   fParticle = localRun->fParticle;                163   fParticle = localRun->fParticle;
165   fEkin = localRun->fEkin;                     << 164   fEkin     = localRun->fEkin;
166                                                << 165   
167   // accumulate sums                              166   // accumulate sums
168   //                                              167   //
169   fTotalCount += localRun->fTotalCount;        << 168   fTotalCount   += localRun->fTotalCount;
170   fGammaCount += localRun->fGammaCount;        << 169   fGammaCount   += localRun->fGammaCount;
171   fSumTrack += localRun->fSumTrack;               170   fSumTrack += localRun->fSumTrack;
172   fSumTrack2 += localRun->fSumTrack2;             171   fSumTrack2 += localRun->fSumTrack2;
173                                                   172 
174   fPbalance[0] += localRun->fPbalance[0];         173   fPbalance[0] += localRun->fPbalance[0];
175   G4double min, max;                           << 174   G4double min,max;
176   min = localRun->fPbalance[1];                << 175   min = localRun->fPbalance[1]; max = localRun->fPbalance[2];
177   max = localRun->fPbalance[2];                << 
178   if (fPbalance[1] > min) fPbalance[1] = min;     176   if (fPbalance[1] > min) fPbalance[1] = min;
179   if (fPbalance[2] < max) fPbalance[2] = max;     177   if (fPbalance[2] < max) fPbalance[2] = max;
180                                                   178 
181   fNbGamma[0] += localRun->fNbGamma[0];           179   fNbGamma[0] += localRun->fNbGamma[0];
182   G4int nbmin, nbmax;                          << 180   G4int nbmin, nbmax; 
183   nbmin = localRun->fNbGamma[1];               << 181   nbmin = localRun->fNbGamma[1]; nbmax = localRun->fNbGamma[2];
184   nbmax = localRun->fNbGamma[2];               << 
185   if (fNbGamma[1] > nbmin) fNbGamma[1] = nbmin    182   if (fNbGamma[1] > nbmin) fNbGamma[1] = nbmin;
186   if (fNbGamma[2] < nbmax) fNbGamma[2] = nbmax    183   if (fNbGamma[2] < nbmax) fNbGamma[2] = nbmax;
                                                   >> 184   
                                                   >> 185   //map: processes count
                                                   >> 186   std::map<G4String,G4int>::const_iterator itp;
                                                   >> 187   for ( itp = localRun->fProcCounter.begin();
                                                   >> 188         itp != localRun->fProcCounter.end(); ++itp ) {
187                                                   189 
188   // map: processes count                      << 
189   std::map<G4String, G4int>::const_iterator it << 
190   for (itp = localRun->fProcCounter.begin(); i << 
191     G4String procName = itp->first;               190     G4String procName = itp->first;
192     G4int localCount = itp->second;               191     G4int localCount = itp->second;
193     if (fProcCounter.find(procName) == fProcCo << 192     if ( fProcCounter.find(procName) == fProcCounter.end()) {
194       fProcCounter[procName] = localCount;        193       fProcCounter[procName] = localCount;
195     }                                             194     }
196     else {                                        195     else {
197       fProcCounter[procName] += localCount;       196       fProcCounter[procName] += localCount;
198     }                                          << 197     }  
199   }                                               198   }
200                                                << 199       
201   // map: nuclear channels                     << 200   //map: nuclear channels
202   std::map<G4String, NuclChannel>::const_itera << 201   std::map<G4String,NuclChannel>::const_iterator itc;
203   for (itc = localRun->fNuclChannelMap.begin() << 202   for (itc = localRun->fNuclChannelMap.begin(); 
                                                   >> 203        itc != localRun->fNuclChannelMap.end(); ++itc) {
                                                   >> 204     
204     G4String name = itc->first;                   205     G4String name = itc->first;
205     const NuclChannel& localData = itc->second << 206     const NuclChannel& localData = itc->second;   
206     if (fNuclChannelMap.find(name) == fNuclCha << 207     if ( fNuclChannelMap.find(name) == fNuclChannelMap.end()) {
207       fNuclChannelMap[name] = NuclChannel(loca << 208       fNuclChannelMap[name]
                                                   >> 209        = NuclChannel(localData.fCount, localData.fQ);
208     }                                             210     }
209     else {                                        211     else {
210       NuclChannel& data = fNuclChannelMap[name << 212       NuclChannel& data = fNuclChannelMap[name];   
211       data.fCount += localData.fCount;            213       data.fCount += localData.fCount;
212       data.fQ += localData.fQ;                 << 214       data.fQ     += localData.fQ;
213     }                                          << 215     }   
214   }                                            << 216   } 
215                                                << 217         
216   // map: particles count                      << 218   //map: particles count
217   std::map<G4String, ParticleData>::const_iter << 219   std::map<G4String,ParticleData>::const_iterator itn;
218   for (itn = localRun->fParticleDataMap.begin( << 220   for (itn = localRun->fParticleDataMap.begin(); 
                                                   >> 221        itn != localRun->fParticleDataMap.end(); ++itn) {
                                                   >> 222     
219     G4String name = itn->first;                   223     G4String name = itn->first;
220     const ParticleData& localData = itn->secon << 224     const ParticleData& localData = itn->second;   
221     if (fParticleDataMap.find(name) == fPartic << 225     if ( fParticleDataMap.find(name) == fParticleDataMap.end()) {
222       fParticleDataMap[name] =                 << 226       fParticleDataMap[name]
223         ParticleData(localData.fCount, localDa << 227        = ParticleData(localData.fCount, 
                                                   >> 228                       localData.fEmean, 
                                                   >> 229                       localData.fEmin, 
                                                   >> 230                       localData.fEmax);
224     }                                             231     }
225     else {                                        232     else {
226       ParticleData& data = fParticleDataMap[na << 233       ParticleData& data = fParticleDataMap[name];   
227       data.fCount += localData.fCount;            234       data.fCount += localData.fCount;
228       data.fEmean += localData.fEmean;            235       data.fEmean += localData.fEmean;
229       G4double emin = localData.fEmin;            236       G4double emin = localData.fEmin;
230       if (emin < data.fEmin) data.fEmin = emin    237       if (emin < data.fEmin) data.fEmin = emin;
231       G4double emax = localData.fEmax;            238       G4double emax = localData.fEmax;
232       if (emax > data.fEmax) data.fEmax = emax << 239       if (emax > data.fEmax) data.fEmax = emax; 
233     }                                          << 240     }   
234   }                                               241   }
235                                                << 242   
236   G4Run::Merge(run);                           << 243   G4Run::Merge(run); 
237 }                                              << 244 } 
238                                                   245 
239 //....oooOO0OOooo........oooOO0OOooo........oo    246 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
240                                                   247 
241 void Run::EndOfRun(G4bool print)               << 248 void Run::EndOfRun(G4bool print) 
242 {                                                 249 {
243   G4int prec = 5, wid = prec + 2;              << 250   G4int prec = 5, wid = prec + 2;  
244   G4int dfprec = G4cout.precision(prec);          251   G4int dfprec = G4cout.precision(prec);
245                                                << 252   
246   // run condition                             << 253   //run condition
247   //                                              254   //
248   const G4Material* material = fDetector->GetM << 255   G4Material* material = fDetector->GetMaterial();
249   G4double density = material->GetDensity();      256   G4double density = material->GetDensity();
250                                                << 257    
251   G4String Particle = fParticle->GetParticleNa << 258   G4String Particle = fParticle->GetParticleName();    
252   G4cout << "\n The run is " << numberOfEvent  << 259   G4cout << "\n The run is " << numberOfEvent << " "<< Particle << " of "
253          << G4BestUnit(fEkin, "Energy") << " t << 260          << G4BestUnit(fEkin,"Energy") << " through " 
254          << " of " << material->GetName() << " << 261          << G4BestUnit(fDetector->GetSize(),"Length") << " of "
255          << ")" << G4endl;                     << 262          << material->GetName() << " (density: " 
256                                                << 263          << G4BestUnit(density,"Volumic Mass") << ")" << G4endl;
257   if (numberOfEvent == 0) {                    << 264 
258     G4cout.precision(dfprec);                  << 265   if (numberOfEvent == 0) { G4cout.precision(dfprec);   return;}
259     return;                                    << 266              
260   }                                            << 267   //frequency of processes
261                                                << 
262   // frequency of processes                    << 
263   //                                              268   //
264   G4cout << "\n Process calls frequency:" << G << 269   G4cout << "\n Process calls frequency:" << G4endl;  
265   G4int survive = 0;                              270   G4int survive = 0;
266   std::map<G4String, G4int>::iterator it;      << 271   std::map<G4String,G4int>::iterator it;    
267   for (it = fProcCounter.begin(); it != fProcC    272   for (it = fProcCounter.begin(); it != fProcCounter.end(); it++) {
268     G4String procName = it->first;             << 273      G4String procName = it->first;
269     G4int count = it->second;                  << 274      G4int    count    = it->second;
270     G4cout << "\t" << procName << "= " << coun << 275      G4cout << "\t" << procName << "= " << count;
271     if (procName == "Transportation") survive  << 276      if (procName == "Transportation") survive = count;
272   }                                               277   }
273   G4cout << G4endl;                               278   G4cout << G4endl;
274                                                << 279       
275   if (survive > 0) {                              280   if (survive > 0) {
276     G4cout << "\n Nb of incident particles sur    281     G4cout << "\n Nb of incident particles surviving after "
277            << G4BestUnit(fDetector->GetSize(), << 282            << G4BestUnit(fDetector->GetSize(),"Length") << " of "
278            << survive << G4endl;               << 283            << material->GetName() << " : " << survive << G4endl;
279   }                                               284   }
280                                                << 285   
281   if (fTotalCount == 0) fTotalCount = 1;  // f << 286   if (fTotalCount == 0) fTotalCount = 1;   //force printing anyway
282                                                << 287   
283   // compute mean free path and related quanti << 288   //compute mean free path and related quantities
284   //                                           << 289   //
285   G4double MeanFreePath = fSumTrack / fTotalCo << 290   G4double MeanFreePath = fSumTrack /fTotalCount;     
286   G4double MeanTrack2 = fSumTrack2 / fTotalCou << 291   G4double MeanTrack2   = fSumTrack2/fTotalCount;     
287   G4double rms = std::sqrt(std::fabs(MeanTrack << 292   G4double rms = std::sqrt(std::fabs(MeanTrack2 - MeanFreePath*MeanFreePath));
288   G4double CrossSection = 0.0;                    293   G4double CrossSection = 0.0;
289   if (MeanFreePath > 0.0) {                    << 294   if(MeanFreePath > 0.0) { CrossSection = 1./MeanFreePath; }
290     CrossSection = 1. / MeanFreePath;          << 295   G4double massicMFP = MeanFreePath*density;
291   }                                            << 296   G4double massicCS  = 0.0;
292   G4double massicMFP = MeanFreePath * density; << 297   if(massicMFP > 0.0) { massicCS = 1./massicMFP; }
293   G4double massicCS = 0.0;                     << 298    
294   if (massicMFP > 0.0) {                       << 299   G4cout << "\n\n MeanFreePath:\t"   << G4BestUnit(MeanFreePath,"Length")
295     massicCS = 1. / massicMFP;                 << 300          << " +- "                   << G4BestUnit( rms,"Length")
296   }                                            << 301          << "\tmassic: "             << G4BestUnit(massicMFP, "Mass/Surface")
297                                                << 302          << "\n CrossSection:\t"     << CrossSection*cm << " cm^-1 "
298   G4cout << "\n\n MeanFreePath:\t" << G4BestUn << 303          << "\t\tmassic: "           << G4BestUnit(massicCS, "Surface/Mass")
299          << G4BestUnit(rms, "Length") << "\tma << 304          << G4endl;
300          << "\n CrossSection:\t" << CrossSecti << 305          
301          << "\t\tmassic: " << G4BestUnit(massi << 306   //cross section per atom (only for single material)
302                                                << 
303   // cross section per atom (only for single m << 
304   //                                              307   //
305   if (material->GetNumberOfElements() == 1) {     308   if (material->GetNumberOfElements() == 1) {
306     G4double nbAtoms = material->GetTotNbOfAto    309     G4double nbAtoms = material->GetTotNbOfAtomsPerVolume();
307     G4double crossSection = CrossSection / nbA << 310     G4double crossSection = CrossSection/nbAtoms;
308     G4cout << " crossSection per atom:\t" << G << 311     G4cout << " crossSection per atom:\t"
309   }                                            << 312            << G4BestUnit(crossSection,"Surface") << G4endl;     
310   // check cross section from G4HadronicProces << 313   }         
                                                   >> 314   //check cross section from G4HadronicProcessStore
311   //                                              315   //
312   G4cout << "\n Verification: "                   316   G4cout << "\n Verification: "
313          << "crossSections from G4HadronicProc << 317          << "crossSections from G4HadronicProcessStore:";
314                                                << 318   
315   G4ProcessTable* processTable = G4ProcessTabl << 319   G4ProcessTable* processTable  = G4ProcessTable::GetProcessTable();
316   G4HadronicProcessStore* store = G4HadronicPr    320   G4HadronicProcessStore* store = G4HadronicProcessStore::Instance();
317   G4double sumc1 = 0.0, sumc2 = 0.0;           << 321   G4double sumc1 = 0.0, sumc2 = 0.0; 
318   const G4Element* element =                   << 322   if (material->GetNumberOfElements() == 1) {
319     (material->GetNumberOfElements() == 1) ? m << 323     const G4Element* element = material->GetElement(0);
320   for (it = fProcCounter.begin(); it != fProcC << 324     for (it = fProcCounter.begin(); it != fProcCounter.end(); it++) {
321     G4String procName = it->first;             << 325       G4String procName = it->first;
322     const G4VProcess* process = processTable-> << 326       G4VProcess* process = processTable->FindProcess(procName, fParticle);
323     PrintXS(process, material, element, store, << 327       G4double xs1 =
324   }                                            << 328       store->GetCrossSectionPerVolume(fParticle,fEkin,process,material);
325   if (sumc1 > 0.0) {                           << 329       G4double massSigma = xs1/density;
326     G4cout << "\n"                             << 330       sumc1 += massSigma;      
327            << std::setw(20) << "total"         << 331       G4double xs2 =
328            << " = " << G4BestUnit(sumc1, "Surf << 332       store->GetCrossSectionPerAtom(fParticle,fEkin,process,element,material);
329     if (sumc2 > 0.0) {                         << 333       sumc2 += xs2;
330       G4cout << G4BestUnit(sumc2, "Surface");  << 334       G4cout << "\n" << std::setw(20) << procName << "= "
331     }                                          << 335              << G4BestUnit(massSigma, "Surface/Mass") << "\t"
332     G4cout << G4endl;                          << 336              << G4BestUnit(xs2, "Surface");
333   }                                            << 337       
334   else {                                       << 338     }             
335     G4cout << " not available" << G4endl;      << 339     G4cout << "\n" << std::setw(20) << "total" << "= "
336   }                                            << 340            << G4BestUnit(sumc1, "Surface/Mass") << "\t" 
337                                                << 341            << G4BestUnit(sumc2, "Surface") << G4endl;  
338   // nuclear channel count                     << 342   } else {
339   //                                           << 343     for (it = fProcCounter.begin(); it != fProcCounter.end(); it++) {
340   G4cout << "\n List of nuclear reactions: \n" << 344       G4String procName = it->first;
341   std::map<G4String, NuclChannel>::iterator ic << 345       G4VProcess* process = processTable->FindProcess(procName, fParticle);
342   for (ic = fNuclChannelMap.begin(); ic != fNu << 346       G4double xs =
343     G4String name = ic->first;                 << 347       store->GetCrossSectionPerVolume(fParticle,fEkin,process,material);
                                                   >> 348       G4double massSigma = xs/density;
                                                   >> 349       sumc1 += massSigma;
                                                   >> 350       G4cout << "\n" << std::setw(20)  << procName << "= " 
                                                   >> 351              << G4BestUnit(massSigma, "Surface/Mass");
                                                   >> 352     }             
                                                   >> 353     G4cout << "\n" << std::setw(20) << "total" << "= " 
                                                   >> 354            << G4BestUnit(sumc1, "Surface/Mass") << G4endl;  
                                                   >> 355   }
                                                   >> 356               
                                                   >> 357  //nuclear channel count
                                                   >> 358  //
                                                   >> 359  G4cout << "\n List of nuclear reactions: \n" << G4endl; 
                                                   >> 360  std::map<G4String,NuclChannel>::iterator ic;               
                                                   >> 361  for (ic = fNuclChannelMap.begin(); ic != fNuclChannelMap.end(); ic++) { 
                                                   >> 362     G4String name    = ic->first;
344     NuclChannel data = ic->second;                363     NuclChannel data = ic->second;
345     G4int count = data.fCount;                    364     G4int count = data.fCount;
346     G4double Q = data.fQ / count;              << 365     G4double Q  = data.fQ/count; 
347     if (print)                                 << 366     if (print)         
348       G4cout << "  " << std::setw(60) << name     367       G4cout << "  " << std::setw(60) << name << ": " << std::setw(7) << count
349              << "   Q = " << std::setw(wid) << << 368              << "   Q = " << std::setw(wid) << G4BestUnit(Q, "Energy")
350   }                                            << 369              << G4endl;           
351                                                << 370  } 
352   // Gamma count                               << 371  
353   //                                           << 372  //Gamma count
354   if (print && (fGammaCount > 0)) {            << 373  //
355     G4cout << "\n"                             << 374  if (print && (fGammaCount > 0)) {       
356            << std::setw(58) << "number of gamm << 375    G4cout << "\n" << std::setw(58) << "number of gamma or e- (ic): N = " 
357            << fNbGamma[2] << G4endl;           << 376            << fNbGamma[1] << " --> " << fNbGamma[2] << G4endl;
358   }                                            << 377  }
359                                                << 378  
360   if (print && fTargetXXX) {                   << 379  if (print && fTargetXXX) {
361     G4cout << "\n   --> NOTE: XXXX because neu << 380    G4cout 
362   }                                            << 381    << "\n   --> NOTE: XXXX because neutronHP is unable to return target nucleus"
363                                                << 382    << G4endl;
364   // particles count                           << 383  }
365   //                                           << 384             
366   G4cout << "\n List of generated particles:"  << 385  //particles count
367                                                << 386  //
368   std::map<G4String, ParticleData>::iterator i << 387  G4cout << "\n List of generated particles:" << G4endl;
369   for (itn = fParticleDataMap.begin(); itn !=  << 388      
                                                   >> 389  std::map<G4String,ParticleData>::iterator itn;               
                                                   >> 390  for (itn = fParticleDataMap.begin(); itn != fParticleDataMap.end(); itn++) { 
370     G4String name = itn->first;                   391     G4String name = itn->first;
371     ParticleData data = itn->second;              392     ParticleData data = itn->second;
372     G4int count = data.fCount;                    393     G4int count = data.fCount;
373     G4double eMean = data.fEmean / count;      << 394     G4double eMean = data.fEmean/count;
374     G4double eMin = data.fEmin;                   395     G4double eMin = data.fEmin;
375     G4double eMax = data.fEmax;                << 396     G4double eMax = data.fEmax;    
376     if (print)                                 << 397     if (print)         
377       G4cout << "  " << std::setw(13) << name  << 398     G4cout << "  " << std::setw(13) << name << ": " << std::setw(7) << count
378              << "  Emean = " << std::setw(wid) << 399            << "  Emean = " << std::setw(wid) << G4BestUnit(eMean, "Energy")
379              << G4BestUnit(eMin, "Energy") <<  << 400            << "\t( "  << G4BestUnit(eMin, "Energy")
380              << G4endl;                        << 401            << " --> " << G4BestUnit(eMax, "Energy") 
381   }                                            << 402            << ")" << G4endl;           
382                                                << 403  }
383   // energy momentum balance                   << 404  
384   //                                           << 405  //energy momentum balance
385   if (fTotalCount > 1) {                       << 406  //
386     G4double Pbmean = fPbalance[0] / fTotalCou << 407  if (fTotalCount > 1) {
387     G4cout << "\n   Momentum balance: Pmean =  << 408     G4double Pbmean = fPbalance[0]/fTotalCount;           
388            << "\t( " << G4BestUnit(fPbalance[1 << 409     G4cout << "\n   Momentum balance: Pmean = " 
389            << G4BestUnit(fPbalance[2], "Energy << 410            << std::setw(wid) << G4BestUnit(Pbmean, "Energy")
390            << G4endl;                          << 411            << "\t( "  << G4BestUnit(fPbalance[1], "Energy")
391   }                                            << 412            << " --> " << G4BestUnit(fPbalance[2], "Energy")
392                                                << 413            << ") \n" << G4endl;
393   // normalize histograms                      << 414  }
                                                   >> 415   
                                                   >> 416   //normalize histograms      
394   ////G4AnalysisManager* analysisManager = G4A    417   ////G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
395   ////G4double factor = 1./numberOfEvent;         418   ////G4double factor = 1./numberOfEvent;
396   ////analysisManager->ScaleH1(3,factor);         419   ////analysisManager->ScaleH1(3,factor);
397                                                << 420            
398   // remove all contents in fProcCounter, fCou << 421   //remove all contents in fProcCounter, fCount 
399   fProcCounter.clear();                           422   fProcCounter.clear();
400   fNuclChannelMap.clear();                     << 423   fNuclChannelMap.clear();      
401   fParticleDataMap.clear();                       424   fParticleDataMap.clear();
402                                                << 425                           
403   // restore default format                    << 426   //restore default format         
404   G4cout.precision(dfprec);                    << 427   G4cout.precision(dfprec);   
405 }                                              << 
406                                                << 
407 //....oooOO0OOooo........oooOO0OOooo........oo << 
408                                                << 
409 void Run::PrintXS(const G4VProcess* proc, cons << 
410                   G4HadronicProcessStore* stor << 
411 {                                              << 
412   if (nullptr == proc) {                       << 
413     return;                                    << 
414   }                                            << 
415   G4double xs1 = store->GetCrossSectionPerVolu << 
416   G4double massSigma = xs1 / density;          << 
417   sum1 += massSigma;                           << 
418   if (nullptr != elm) {                        << 
419     G4double xs2 = store->GetCrossSectionPerAt << 
420     sum2 += xs2;                               << 
421     G4cout << "\n"                             << 
422            << std::setw(20) << proc->GetProces << 
423            << G4BestUnit(massSigma, "Surface/M << 
424   }                                            << 
425   else {                                       << 
426     G4cout << "\n"                             << 
427            << std::setw(20) << proc->GetProces << 
428            << G4BestUnit(massSigma, "Surface/M << 
429   }                                            << 
430 }                                                 428 }
431                                                   429 
432 //....oooOO0OOooo........oooOO0OOooo........oo    430 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
433                                                   431