Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/examples/extended/radioactivedecay/rdecay01/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/radioactivedecay/rdecay01/src/Run.cc (Version 11.3.0) and /examples/extended/radioactivedecay/rdecay01/src/Run.cc (Version 10.1.p3)


  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 electromagnetic/TestEm11/src/Run.cc
 27 /// \brief Implementation of the Run class         27 /// \brief Implementation of the Run class
 28 //                                                 28 //
 29 //                                             <<  29 // $Id: Run.cc 71376 2013-06-14 07:44:50Z maire $
                                                   >>  30 // 
 30 //....oooOO0OOooo........oooOO0OOooo........oo     31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 31 //....oooOO0OOooo........oooOO0OOooo........oo     32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 32                                                    33 
 33 #include "Run.hh"                                  34 #include "Run.hh"
 34                                                << 
 35 #include "HistoManager.hh"                     << 
 36 #include "PrimaryGeneratorAction.hh"               35 #include "PrimaryGeneratorAction.hh"
                                                   >>  36 #include "HistoManager.hh"
 37                                                    37 
 38 #include "G4PhysicalConstants.hh"              << 
 39 #include "G4SystemOfUnits.hh"                      38 #include "G4SystemOfUnits.hh"
 40 #include "G4UnitsTable.hh"                         39 #include "G4UnitsTable.hh"
                                                   >>  40 #include "G4PhysicalConstants.hh"
 41                                                    41 
 42 //....oooOO0OOooo........oooOO0OOooo........oo     42 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 43                                                    43 
 44 void Run::SetPrimary(G4ParticleDefinition* par <<  44 Run::Run()
                                                   >>  45 : G4Run(),
                                                   >>  46   fParticle(0), fEkin(0.),
                                                   >>  47   fDecayCount(0), fTimeCount(0), fPrimaryTime(0.)
 45 {                                                  48 {
                                                   >>  49   fEkinTot[0] = fPbalance[0] = fEventTime[0] = 0. ;
                                                   >>  50   fEkinTot[1] = fPbalance[1] = fEventTime[1] = DBL_MAX;
                                                   >>  51   fEkinTot[2] = fPbalance[2] = fEventTime[2] = 0. ;     
                                                   >>  52 }
                                                   >>  53 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >>  54 
                                                   >>  55 Run::~Run()
                                                   >>  56 { }
                                                   >>  57 
                                                   >>  58 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >>  59 
                                                   >>  60 void Run::SetPrimary(G4ParticleDefinition* particle, G4double energy)
                                                   >>  61 { 
 46   fParticle = particle;                            62   fParticle = particle;
 47   fEkin = energy;                                  63   fEkin = energy;
 48 }                                              <<  64 } 
 49                                                    65 
 50 //....oooOO0OOooo........oooOO0OOooo........oo     66 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 51                                                    67 
 52 void Run::ParticleCount(G4String name, G4doubl <<  68 void Run::ParticleCount(G4String name, G4double Ekin)
 53 {                                                  69 {
 54   std::map<G4String, ParticleData>::iterator i     70   std::map<G4String, ParticleData>::iterator it = fParticleDataMap.find(name);
 55   if (it == fParticleDataMap.end()) {          <<  71   if ( it == fParticleDataMap.end()) {
 56     fParticleDataMap[name] = ParticleData(1, E <<  72     fParticleDataMap[name] = ParticleData(1, Ekin, Ekin, Ekin);
 57   }                                                73   }
 58   else {                                           74   else {
 59     ParticleData& data = it->second;               75     ParticleData& data = it->second;
 60     data.fCount++;                                 76     data.fCount++;
 61     data.fEmean += Ekin;                           77     data.fEmean += Ekin;
 62     // update min max                          <<  78     //update min max
 63     G4double emin = data.fEmin;                    79     G4double emin = data.fEmin;
 64     if (Ekin < emin) data.fEmin = Ekin;            80     if (Ekin < emin) data.fEmin = Ekin;
 65     G4double emax = data.fEmax;                    81     G4double emax = data.fEmax;
 66     if (Ekin > emax) data.fEmax = Ekin;        <<  82     if (Ekin > emax) data.fEmax = Ekin; 
 67     data.fTmean = meanLife;                    <<  83   }   
 68   }                                            << 
 69 }                                              << 
 70                                                << 
 71 //....oooOO0OOooo........oooOO0OOooo........oo << 
 72                                                << 
 73 void Run::SetTimeWindow(G4double t1, G4double  << 
 74 {                                              << 
 75   fTimeWindow1 = t1;                           << 
 76   fTimeWindow2 = t2;                           << 
 77 }                                              << 
 78                                                << 
 79 //....oooOO0OOooo........oooOO0OOooo........oo << 
 80                                                << 
 81 void Run::CountInTimeWindow(G4String name, G4b << 
 82 {                                              << 
 83   std::map<G4String, ActivityData>::iterator i << 
 84   if (it == fActivityMap.end()) {              << 
 85     G4int n1(0), n2(0), nd(0);                 << 
 86     if (life1) n1 = 1;                         << 
 87     if (life2) n2 = 1;                         << 
 88     if (decay) nd = 1;                         << 
 89     fActivityMap[name] = ActivityData(n1, n2,  << 
 90   }                                            << 
 91   else {                                       << 
 92     ActivityData& data = it->second;           << 
 93     if (life1) data.fNlife_t1++;               << 
 94     if (life2) data.fNlife_t2++;               << 
 95     if (decay) data.fNdecay_t1t2++;            << 
 96   }                                            << 
 97 }                                                  84 }
 98                                                    85 
 99 //....oooOO0OOooo........oooOO0OOooo........oo     86 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
100                                                    87 
101 void Run::Balance(G4double Ekin, G4double Pbal     88 void Run::Balance(G4double Ekin, G4double Pbal)
102 {                                                  89 {
103   fDecayCount++;                                   90   fDecayCount++;
104   fEkinTot[0] += Ekin;                             91   fEkinTot[0] += Ekin;
105   // update min max                            <<  92   //update min max  
106   if (fDecayCount == 1) fEkinTot[1] = fEkinTot     93   if (fDecayCount == 1) fEkinTot[1] = fEkinTot[2] = Ekin;
107   if (Ekin < fEkinTot[1]) fEkinTot[1] = Ekin;      94   if (Ekin < fEkinTot[1]) fEkinTot[1] = Ekin;
108   if (Ekin > fEkinTot[2]) fEkinTot[2] = Ekin;      95   if (Ekin > fEkinTot[2]) fEkinTot[2] = Ekin;
109                                                <<  96   
110   fPbalance[0] += Pbal;                            97   fPbalance[0] += Pbal;
111   // update min max                            <<  98   //update min max   
112   if (fDecayCount == 1) fPbalance[1] = fPbalan <<  99   if (fDecayCount == 1) fPbalance[1] = fPbalance[2] = Pbal;  
113   if (Pbal < fPbalance[1]) fPbalance[1] = Pbal    100   if (Pbal < fPbalance[1]) fPbalance[1] = Pbal;
114   if (Pbal > fPbalance[2]) fPbalance[2] = Pbal << 101   if (Pbal > fPbalance[2]) fPbalance[2] = Pbal;    
115 }                                                 102 }
116                                                   103 
117 //....oooOO0OOooo........oooOO0OOooo........oo    104 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
118                                                   105 
119 void Run::EventTiming(G4double time)              106 void Run::EventTiming(G4double time)
120 {                                                 107 {
121   fTimeCount++;                                << 108   fTimeCount++;  
122   fEventTime[0] += time;                          109   fEventTime[0] += time;
123   if (fTimeCount == 1) fEventTime[1] = fEventT << 110   if (fTimeCount == 1) fEventTime[1] = fEventTime[2] = time;  
124   if (time < fEventTime[1]) fEventTime[1] = ti    111   if (time < fEventTime[1]) fEventTime[1] = time;
125   if (time > fEventTime[2]) fEventTime[2] = ti << 112   if (time > fEventTime[2]) fEventTime[2] = time;             
126 }                                                 113 }
127                                                   114 
128 //....oooOO0OOooo........oooOO0OOooo........oo    115 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
129                                                   116 
130 void Run::PrimaryTiming(G4double ptime)           117 void Run::PrimaryTiming(G4double ptime)
131 {                                                 118 {
132   fPrimaryTime += ptime;                          119   fPrimaryTime += ptime;
133 }                                                 120 }
134                                                   121 
135 //....oooOO0OOooo........oooOO0OOooo........oo    122 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
136                                                   123 
137 void Run::EvisEvent(G4double Evis)             << 
138 {                                              << 
139   fEvisEvent[0] += Evis;                       << 
140   if (fTimeCount == 1) fEvisEvent[1] = fEvisEv << 
141   if (Evis < fEvisEvent[1]) fEvisEvent[1] = Ev << 
142   if (Evis > fEvisEvent[2]) fEvisEvent[2] = Ev << 
143 }                                              << 
144                                                << 
145 //....oooOO0OOooo........oooOO0OOooo........oo << 
146                                                << 
147 void Run::Merge(const G4Run* run)                 124 void Run::Merge(const G4Run* run)
148 {                                                 125 {
149   const Run* localRun = static_cast<const Run*    126   const Run* localRun = static_cast<const Run*>(run);
150                                                   127 
151   // primary particle info                     << 128   //primary particle info
152   //                                              129   //
153   fParticle = localRun->fParticle;                130   fParticle = localRun->fParticle;
154   fEkin = localRun->fEkin;                     << 131   fEkin     = localRun->fEkin;
155                                                << 132    
156   // accumulate sums                              133   // accumulate sums
157   //                                              134   //
158   fDecayCount += localRun->fDecayCount;        << 135   fDecayCount  += localRun->fDecayCount;
159   fTimeCount += localRun->fTimeCount;          << 136   fTimeCount   += localRun->fTimeCount;  
160   fPrimaryTime += localRun->fPrimaryTime;         137   fPrimaryTime += localRun->fPrimaryTime;
161                                                   138 
162   fEkinTot[0] += localRun->fEkinTot[0];        << 139   fEkinTot[0]   += localRun->fEkinTot[0];
163   fPbalance[0] += localRun->fPbalance[0];      << 140   fPbalance[0]  += localRun->fPbalance[0];
164   fEventTime[0] += localRun->fEventTime[0];       141   fEventTime[0] += localRun->fEventTime[0];
165   fEvisEvent[0] += localRun->fEvisEvent[0];    << 142   
166                                                << 143   G4double min,max;  
167   G4double min, max;                           << 144   min = localRun->fEkinTot[1]; max = localRun->fEkinTot[2];
168   min = localRun->fEkinTot[1];                 << 
169   max = localRun->fEkinTot[2];                 << 
170   if (fEkinTot[1] > min) fEkinTot[1] = min;       145   if (fEkinTot[1] > min) fEkinTot[1] = min;
171   if (fEkinTot[2] < max) fEkinTot[2] = max;       146   if (fEkinTot[2] < max) fEkinTot[2] = max;
172   //                                              147   //
173   min = localRun->fPbalance[1];                << 148   min = localRun->fPbalance[1]; max = localRun->fPbalance[2];
174   max = localRun->fPbalance[2];                << 
175   if (fPbalance[1] > min) fPbalance[1] = min;     149   if (fPbalance[1] > min) fPbalance[1] = min;
176   if (fPbalance[2] < max) fPbalance[2] = max;     150   if (fPbalance[2] < max) fPbalance[2] = max;
177   //                                              151   //
178   min = localRun->fEventTime[1];               << 152   min = localRun->fEventTime[1]; max = localRun->fEventTime[2];
179   max = localRun->fEventTime[2];               << 
180   if (fEventTime[1] > min) fEventTime[1] = min    153   if (fEventTime[1] > min) fEventTime[1] = min;
181   if (fEventTime[2] < max) fEventTime[2] = max    154   if (fEventTime[2] < max) fEventTime[2] = max;
182   //                                           << 155                 
183   min = localRun->fEvisEvent[1];               << 156   //maps
184   max = localRun->fEvisEvent[2];               << 157   std::map<G4String,ParticleData>::const_iterator itn;
185   if (fEvisEvent[1] > min) fEvisEvent[1] = min << 158   for (itn = localRun->fParticleDataMap.begin(); 
186   if (fEvisEvent[2] < max) fEvisEvent[2] = max << 159        itn != localRun->fParticleDataMap.end(); ++itn) {
187                                                << 160     
188   // maps                                      << 
189   std::map<G4String, ParticleData>::const_iter << 
190   for (itn = localRun->fParticleDataMap.begin( << 
191     G4String name = itn->first;                   161     G4String name = itn->first;
192     const ParticleData& localData = itn->secon << 162     const ParticleData& localData = itn->second;   
193     if (fParticleDataMap.find(name) == fPartic << 163     if ( fParticleDataMap.find(name) == fParticleDataMap.end()) {
194       fParticleDataMap[name] = ParticleData(lo << 164       fParticleDataMap[name]
195                                             lo << 165        = ParticleData(localData.fCount, 
                                                   >> 166                       localData.fEmean, 
                                                   >> 167                       localData.fEmin, 
                                                   >> 168                       localData.fEmax);
196     }                                             169     }
197     else {                                        170     else {
198       ParticleData& data = fParticleDataMap[na << 171       ParticleData& data = fParticleDataMap[name];   
199       data.fCount += localData.fCount;            172       data.fCount += localData.fCount;
200       data.fEmean += localData.fEmean;            173       data.fEmean += localData.fEmean;
201       G4double emin = localData.fEmin;            174       G4double emin = localData.fEmin;
202       if (emin < data.fEmin) data.fEmin = emin    175       if (emin < data.fEmin) data.fEmin = emin;
203       G4double emax = localData.fEmax;            176       G4double emax = localData.fEmax;
204       if (emax > data.fEmax) data.fEmax = emax << 177       if (emax > data.fEmax) data.fEmax = emax; 
205       data.fTmean = localData.fTmean;          << 178     }   
206     }                                          << 
207   }                                               179   }
208                                                   180 
209   // activity                                  << 181   G4Run::Merge(run); 
210   fTimeWindow1 = localRun->fTimeWindow1;       << 182 } 
211   fTimeWindow2 = localRun->fTimeWindow2;       << 183     
212                                                << 
213   std::map<G4String, ActivityData>::const_iter << 
214   for (ita = localRun->fActivityMap.begin(); i << 
215     G4String name = ita->first;                << 
216     const ActivityData& localData = ita->secon << 
217     if (fActivityMap.find(name) == fActivityMa << 
218       fActivityMap[name] =                     << 
219         ActivityData(localData.fNlife_t1, loca << 
220     }                                          << 
221     else {                                     << 
222       ActivityData& data = fActivityMap[name]; << 
223       data.fNlife_t1 += localData.fNlife_t1;   << 
224       data.fNlife_t2 += localData.fNlife_t2;   << 
225       data.fNdecay_t1t2 += localData.fNdecay_t << 
226     }                                          << 
227   }                                            << 
228                                                << 
229   G4Run::Merge(run);                           << 
230 }                                              << 
231                                                << 
232 //....oooOO0OOooo........oooOO0OOooo........oo    184 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
233                                                   185 
234 void Run::EndOfRun()                           << 186 void Run::EndOfRun() 
235 {                                                 187 {
236   G4int nbEvents = numberOfEvent;              << 188  G4int nbEvents = numberOfEvent;
237   G4String partName = fParticle->GetParticleNa << 189  G4String partName = fParticle->GetParticleName();
238                                                << 190  
239   G4cout << "\n ======================== run s << 191  G4cout << "\n ======================== run summary ======================";  
240   G4cout << "\n The run was " << nbEvents << " << 192  G4cout << "\n The run was " << nbEvents << " " << partName << " of "
241          << G4BestUnit(fEkin, "Energy");       << 193         << G4BestUnit(fEkin,"Energy");
242   G4cout << "\n ============================== << 194  G4cout << "\n ===========================================================\n";
243   G4cout << G4endl;                            << 195  G4cout << G4endl;
244   if (nbEvents == 0) {                         << 196  if (nbEvents == 0) { return; }
245     return;                                    << 197  
246   }                                            << 198  G4int prec = 4, wid = prec + 2;
247                                                << 199  G4int dfprec = G4cout.precision(prec);
248   G4int prec = 4, wid = prec + 2;              << 200       
249   G4int dfprec = G4cout.precision(prec);       << 201  //particle count
250                                                << 202  //
251   // particle count                            << 203  G4cout << " Nb of generated particles: \n" << G4endl;
252   //                                           << 204      
253   G4cout << " Nb of generated particles: \n" < << 205  std::map<G4String,ParticleData>::iterator it;               
254                                                << 206  for (it = fParticleDataMap.begin(); it != fParticleDataMap.end(); it++) { 
255   std::map<G4String, ParticleData>::iterator i << 207     G4String name     = it->first;
256   for (it = fParticleDataMap.begin(); it != fP << 
257     G4String name = it->first;                 << 
258     ParticleData data = it->second;               208     ParticleData data = it->second;
259     G4int count = data.fCount;                 << 209     G4int count    = data.fCount;
260     G4double eMean = data.fEmean / count;      << 210     G4double eMean = data.fEmean/count;
261     G4double eMin = data.fEmin;                << 211     G4double eMin  = data.fEmin;
262     G4double eMax = data.fEmax;                << 212     G4double eMax  = data.fEmax;    
263     G4double meanLife = data.fTmean;           << 213          
264                                                << 214     G4cout << "  " << std::setw(13) << name << ": " << std::setw(7) << count
265     G4cout << "  " << std::setw(15) << name << << 215            << "  Emean = " << std::setw(wid) << G4BestUnit(eMean, "Energy")
266            << "  Emean = " << std::setw(wid) < << 216            << "\t( "  << G4BestUnit(eMin, "Energy")
267            << G4BestUnit(eMin, "Energy") << "  << 217            << " --> " << G4BestUnit(eMax, "Energy") 
268     if (meanLife > 0.)                         << 218            << ")" << G4endl;           
269       G4cout << "\tmean life = " << G4BestUnit << 219  }
270     else if (meanLife < 0.)                    << 220  
271       G4cout << "\tstable" << G4endl;          << 221  //energy momentum balance
272     else                                       << 222  //
273       G4cout << G4endl;                        << 223 
274   }                                            << 224  if (fDecayCount > 0) {
275                                                << 225     G4double Ebmean = fEkinTot[0]/fDecayCount;
276   // energy momentum balance                   << 226     G4double Pbmean = fPbalance[0]/fDecayCount;
277   //                                           << 227          
278                                                << 228     G4cout << "\n   Ekin Total (Q): mean = "
279   if (fDecayCount > 0) {                       << 229            << std::setw(wid) << G4BestUnit(Ebmean, "Energy")
280     G4double Ebmean = fEkinTot[0] / fDecayCoun << 230            << "\t( "  << G4BestUnit(fEkinTot[1], "Energy")
281     G4double Pbmean = fPbalance[0] / fDecayCou << 231            << " --> " << G4BestUnit(fEkinTot[2], "Energy")
282                                                << 232            << ")" << G4endl;    
283     G4cout << "\n   Ekin Total (Q single decay << 233            
284            << G4BestUnit(Ebmean, "Energy") <<  << 234     G4cout << "\n   Momentum balance (excluding gamma desexcitation): mean = " 
285            << G4BestUnit(fEkinTot[2], "Energy" << 235            << std::setw(wid) << G4BestUnit(Pbmean, "Energy")
286                                                << 236            << "\t( "  << G4BestUnit(fPbalance[1], "Energy")
287     G4cout << "\n   Momentum balance (excludin << 237            << " --> " << G4BestUnit(fPbalance[2], "Energy")
288            << G4BestUnit(Pbmean, "Energy") <<  << 238            << ")" << G4endl;
289            << " --> " << G4BestUnit(fPbalance[ << 239  }
290   }                                            << 240             
291                                                << 241  //total time of life
292   // total time of life                        << 242  //
293   //                                           << 243  if (fTimeCount > 0) {
294   if (fTimeCount > 0) {                        << 244     G4double Tmean = fEventTime[0]/fTimeCount;
295     G4double Tmean = fEventTime[0] / fTimeCoun << 245     G4double halfLife = Tmean*std::log(2.);
296     G4double halfLife = Tmean * std::log(2.);  << 246    
297                                                << 247     G4cout << "\n   Total time of life : mean = "
298     G4cout << "\n   Total time of life (full c << 248            << std::setw(wid) << G4BestUnit(Tmean, "Time")
299            << G4BestUnit(Tmean, "Time") << "   << 249            << "  half-life = "
300            << G4BestUnit(halfLife, "Time") <<  << 250            << std::setw(wid) << G4BestUnit(halfLife, "Time")
301            << " --> " << G4BestUnit(fEventTime << 251            << "   ( "  << G4BestUnit(fEventTime[1], "Time")
302   }                                            << 252            << " --> "  << G4BestUnit(fEventTime[2], "Time")
303                                                << 253            << ")" << G4endl;
304   // total visible Energy                      << 254  }
305   //                                           << 255             
306   if (fTimeCount > 0) {                        << 256  //activity of primary ion
307     G4double Evmean = fEvisEvent[0] / fTimeCou << 257  //
308                                                << 258  G4double pTimeMean = fPrimaryTime/nbEvents;
309     G4cout << "\n   Total visible energy (full << 259  G4double molMass = fParticle->GetAtomicMass()*g/mole;
310            << G4BestUnit(Evmean, "Energy") <<  << 260  G4double nAtoms_perUnitOfMass = Avogadro/molMass;
311            << " --> " << G4BestUnit(fEvisEvent << 261  G4double Activity_perUnitOfMass = 0.0;
312   }                                            << 262  if (pTimeMean > 0.0)
313                                                << 263    { Activity_perUnitOfMass = nAtoms_perUnitOfMass/pTimeMean; }
314   // activity of primary ion                   << 264    
315   //                                           << 265  G4cout << "\n   Activity of " << partName << " = "
316   G4double pTimeMean = fPrimaryTime / nbEvents << 266             << std::setw(wid)  << Activity_perUnitOfMass*g/becquerel
317   G4double molMass = fParticle->GetAtomicMass( << 267             << " Bq/g   ("     << Activity_perUnitOfMass*g/curie
318   G4double nAtoms_perUnitOfMass = Avogadro / m << 268             << " Ci/g) \n" 
319   G4double Activity_perUnitOfMass = 0.0;       << 269             << G4endl;
320   if (pTimeMean > 0.0) {                       << 270             
321     Activity_perUnitOfMass = nAtoms_perUnitOfM << 271  //normalize histograms
322   }                                            << 272  //
323                                                << 273  G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
324   G4cout << "\n   Activity of " << partName << << 274  G4double factor = 100./nbEvents;
325          << Activity_perUnitOfMass * g / becqu << 275  analysisManager->ScaleH1(1,factor);
326          << Activity_perUnitOfMass * g / curie << 276  analysisManager->ScaleH1(2,factor);
327          << G4endl;                            << 277  analysisManager->ScaleH1(3,factor);
328                                                << 278  analysisManager->ScaleH1(4,factor);
329   // activities in time window                 << 279  analysisManager->ScaleH1(5,factor);
330   //                                           << 280                                                 
331   if (fTimeWindow2 > 0.) {                     << 281  // remove all contents in fParticleDataMap
332     G4double dt = fTimeWindow2 - fTimeWindow1; << 282  // 
333     G4cout << "   Activities in time window [t << 283  fParticleDataMap.clear(); 
334            << ", " << G4BestUnit(fTimeWindow2, << 284 
335            << "]  (delta time = " << G4BestUni << 285  // restore default precision
336            << G4endl;                          << 286  // 
337                                                << 287  G4cout.precision(dfprec);
338     std::map<G4String, ActivityData>::iterator << 
339     for (ita = fActivityMap.begin(); ita != fA << 
340       G4String name = ita->first;              << 
341       ActivityData data = ita->second;         << 
342       G4int n1 = data.fNlife_t1;               << 
343       G4int n2 = data.fNlife_t2;               << 
344       G4int ndecay = data.fNdecay_t1t2;        << 
345       G4double actv = ndecay / dt;             << 
346                                                << 
347       G4cout << "  " << std::setw(15) << name  << 
348              << "  n(t1) = " << std::setw(7) < << 
349              << "\t   decays = " << std::setw( << 
350              << "   ---> <actv> = " << G4BestU << 
351     }                                          << 
352   }                                            << 
353   G4cout << G4endl;                            << 
354                                                << 
355   // normalize histograms                      << 
356   //                                           << 
357   G4AnalysisManager* analysisManager = G4Analy << 
358   G4double factor = 100. / nbEvents;           << 
359   analysisManager->ScaleH1(1, factor);         << 
360   analysisManager->ScaleH1(2, factor);         << 
361   analysisManager->ScaleH1(3, factor);         << 
362   analysisManager->ScaleH1(4, factor);         << 
363   analysisManager->ScaleH1(5, factor);         << 
364                                                << 
365   // remove all contents in fParticleDataMap   << 
366   //                                           << 
367   fParticleDataMap.clear();                    << 
368   fActivityMap.clear();                        << 
369                                                << 
370   // restore default precision                 << 
371   //                                           << 
372   G4cout.precision(dfprec);                    << 
373 }                                                 288 }
374                                                   289 
375 //....oooOO0OOooo........oooOO0OOooo........oo    290 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
376                                                   291