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