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 // 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" >> 35 36 #include "EventAction.hh" 36 #include "EventAction.hh" 37 #include "HistoManager.hh" 37 #include "HistoManager.hh" 38 #include "PrimaryGeneratorAction.hh" 38 #include "PrimaryGeneratorAction.hh" 39 39 40 #include "G4Event.hh" << 41 #include "G4Material.hh" 40 #include "G4Material.hh" >> 41 #include "G4Event.hh" 42 #include "G4SystemOfUnits.hh" 42 #include "G4SystemOfUnits.hh" 43 #include "G4UnitsTable.hh" 43 #include "G4UnitsTable.hh" 44 << 45 #include <iomanip> 44 #include <iomanip> 46 45 47 //....oooOO0OOooo........oooOO0OOooo........oo 46 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 48 47 49 Run::Run(DetectorConstruction* detector) : fDe << 48 Run::Run(DetectorConstruction* detector) 50 { << 49 : G4Run(), 51 fTotEdep[1] = fEleak[1] = fEtotal[1] = joule << 50 fDetector(detector), 52 << 51 fParticle(0), fEkin(0.) 53 for (G4int i = 0; i < kMaxAbsor; ++i) { << 52 { 54 fEdeposit[i] = 0.; << 53 for (G4int i=0; i<3; ++i) { fStatus[i] = 0; fTotEdep[i] = 0.; } 55 fEmin[i] = joule; << 54 fTotEdep[1] = joule; 56 fEmax[i] = 0.; << 55 for (G4int i=0; i<kMaxAbsor; ++i) { 57 } << 56 fEdeposit[i] = 0.; fEmin[i] = joule; fEmax[i] = 0.; >> 57 } 58 } 58 } 59 59 60 //....oooOO0OOooo........oooOO0OOooo........oo 60 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 61 61 62 void Run::SetPrimary(G4ParticleDefinition* par << 62 Run::~Run() 63 { << 63 { } >> 64 >> 65 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 66 >> 67 void Run::SetPrimary (G4ParticleDefinition* particle, G4double energy) >> 68 { 64 fParticle = particle; 69 fParticle = particle; 65 fEkin = energy; << 70 fEkin = energy; 66 } 71 } 67 72 68 //....oooOO0OOooo........oooOO0OOooo........oo 73 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 69 74 70 void Run::CountProcesses(const G4VProcess* pro << 75 void Run::CountProcesses(const G4VProcess* process) 71 { 76 { 72 if (process == nullptr) return; << 73 G4String procName = process->GetProcessName( 77 G4String procName = process->GetProcessName(); 74 std::map<G4String, G4int>::iterator it = fPr << 78 std::map<G4String,G4int>::iterator it = fProcCounter.find(procName); 75 if (it == fProcCounter.end()) { << 79 if ( it == fProcCounter.end()) { 76 fProcCounter[procName] = 1; 80 fProcCounter[procName] = 1; 77 } 81 } 78 else { 82 else { 79 fProcCounter[procName]++; << 83 fProcCounter[procName]++; 80 } 84 } 81 } 85 } 82 86 83 //....oooOO0OOooo........oooOO0OOooo........oo 87 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 84 88 85 void Run::ParticleCount(G4int k, G4String name << 89 void Run::ParticleCount(G4int k, G4String name, G4double Ekin) 86 { 90 { 87 std::map<G4String, ParticleData>::iterator i << 91 std::map<G4String, ParticleData>::iterator it = fParticleDataMap[k].find(name); 88 if (it == fParticleDataMap[k].end()) { << 92 if ( it == fParticleDataMap[k].end()) { 89 (fParticleDataMap[k])[name] = ParticleData << 93 (fParticleDataMap[k])[name] = ParticleData(1, Ekin, Ekin, Ekin); 90 } 94 } 91 else { 95 else { 92 ParticleData& data = it->second; 96 ParticleData& data = it->second; 93 data.fCount++; 97 data.fCount++; 94 data.fEmean += Ekin; 98 data.fEmean += Ekin; 95 // update min max << 99 //update min max 96 G4double emin = data.fEmin; 100 G4double emin = data.fEmin; 97 if (Ekin < emin) data.fEmin = Ekin; 101 if (Ekin < emin) data.fEmin = Ekin; 98 G4double emax = data.fEmax; 102 G4double emax = data.fEmax; 99 if (Ekin > emax) data.fEmax = Ekin; << 103 if (Ekin > emax) data.fEmax = Ekin; 100 data.fTmean = meanLife; << 104 } 101 } << 102 } 105 } 103 106 104 //....oooOO0OOooo........oooOO0OOooo........oo 107 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 105 108 106 void Run::AddEdep(G4int i, G4double e) << 109 void Run::AddEdep (G4int i, G4double e) 107 { 110 { 108 if (e > 0.) { 111 if (e > 0.) { 109 fEdeposit[i] += e; << 112 fEdeposit[i] += e; 110 if (e < fEmin[i]) fEmin[i] = e; 113 if (e < fEmin[i]) fEmin[i] = e; 111 if (e > fEmax[i]) fEmax[i] = e; 114 if (e > fEmax[i]) fEmax[i] = e; 112 } 115 } 113 } 116 } 114 117 115 //....oooOO0OOooo........oooOO0OOooo........oo 118 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 116 119 117 void Run::AddTotEdep(G4double e) << 120 void Run::AddTotEdep (G4double e) 118 { 121 { 119 if (e > 0.) { 122 if (e > 0.) { 120 fTotEdep[0] += e; << 123 fTotEdep[0] += e; 121 if (e < fTotEdep[1]) fTotEdep[1] = e; 124 if (e < fTotEdep[1]) fTotEdep[1] = e; 122 if (e > fTotEdep[2]) fTotEdep[2] = e; 125 if (e > fTotEdep[2]) fTotEdep[2] = e; 123 } 126 } 124 } 127 } 125 128 126 //....oooOO0OOooo........oooOO0OOooo........oo 129 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 127 << 130 128 void Run::AddEleak(G4double e) << 131 void Run::AddTrackStatus (G4int i) 129 { << 130 if (e > 0.) { << 131 fEleak[0] += e; << 132 if (e < fEleak[1]) fEleak[1] = e; << 133 if (e > fEleak[2]) fEleak[2] = e; << 134 } << 135 } << 136 << 137 //....oooOO0OOooo........oooOO0OOooo........oo << 138 << 139 void Run::AddEtotal(G4double e) << 140 { 132 { 141 if (e > 0.) { << 133 fStatus[i]++ ; 142 fEtotal[0] += e; << 143 if (e < fEtotal[1]) fEtotal[1] = e; << 144 if (e > fEtotal[2]) fEtotal[2] = e; << 145 } << 146 } << 147 << 148 //....oooOO0OOooo........oooOO0OOooo........oo << 149 << 150 void Run::AddTrackStatus(G4int i) << 151 { << 152 fStatus[i]++; << 153 } 134 } 154 135 155 //....oooOO0OOooo........oooOO0OOooo........oo 136 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 156 137 157 void Run::Merge(const G4Run* run) 138 void Run::Merge(const G4Run* run) 158 { 139 { 159 const Run* localRun = static_cast<const Run* 140 const Run* localRun = static_cast<const Run*>(run); 160 << 141 161 // pass information about primary particle 142 // pass information about primary particle 162 fParticle = localRun->fParticle; 143 fParticle = localRun->fParticle; 163 fEkin = localRun->fEkin; << 144 fEkin = localRun->fEkin; 164 145 165 // Edep in absorbers 146 // Edep in absorbers 166 // 147 // 167 G4int nbOfAbsor = fDetector->GetNbOfAbsor(); 148 G4int nbOfAbsor = fDetector->GetNbOfAbsor(); 168 for (G4int i = 1; i <= nbOfAbsor; ++i) { << 149 for (G4int i=1; i<=nbOfAbsor; ++i) { 169 fEdeposit[i] += localRun->fEdeposit[i]; << 150 fEdeposit[i] += localRun->fEdeposit[i]; 170 // min, max 151 // min, max 171 G4double min, max; << 152 G4double min,max; 172 min = localRun->fEmin[i]; << 153 min = localRun->fEmin[i]; max = localRun->fEmax[i]; 173 max = localRun->fEmax[i]; << 174 if (fEmin[i] > min) fEmin[i] = min; 154 if (fEmin[i] > min) fEmin[i] = min; 175 if (fEmax[i] < max) fEmax[i] = max; 155 if (fEmax[i] < max) fEmax[i] = max; 176 } 156 } 177 << 157 178 for (G4int i = 0; i < 3; ++i) << 158 for (G4int i=0; i<3; ++i) fStatus[i] += localRun->fStatus[i]; 179 fStatus[i] += localRun->fStatus[i]; << 159 180 << 181 // total Edep 160 // total Edep 182 fTotEdep[0] += localRun->fTotEdep[0]; 161 fTotEdep[0] += localRun->fTotEdep[0]; 183 G4double min, max; << 162 G4double min,max; 184 min = localRun->fTotEdep[1]; << 163 min = localRun->fTotEdep[1]; max = localRun->fTotEdep[2]; 185 max = localRun->fTotEdep[2]; << 186 if (fTotEdep[1] > min) fTotEdep[1] = min; 164 if (fTotEdep[1] > min) fTotEdep[1] = min; 187 if (fTotEdep[2] < max) fTotEdep[2] = max; 165 if (fTotEdep[2] < max) fTotEdep[2] = max; 188 166 189 // Eleak << 167 //map: processes count 190 fEleak[0] += localRun->fEleak[0]; << 168 std::map<G4String,G4int>::const_iterator itp; 191 min = localRun->fEleak[1]; << 169 for ( itp = localRun->fProcCounter.begin(); 192 max = localRun->fEleak[2]; << 170 itp != localRun->fProcCounter.end(); ++itp ) { 193 if (fEleak[1] > min) fEleak[1] = min; << 171 194 if (fEleak[2] < max) fEleak[2] = max; << 195 << 196 // Etotal << 197 fEtotal[0] += localRun->fEtotal[0]; << 198 min = localRun->fEtotal[1]; << 199 max = localRun->fEtotal[2]; << 200 if (fEtotal[1] > min) fEtotal[1] = min; << 201 if (fEtotal[2] < max) fEtotal[2] = max; << 202 << 203 // map: processes count << 204 std::map<G4String, G4int>::const_iterator it << 205 for (itp = localRun->fProcCounter.begin(); i << 206 G4String procName = itp->first; 172 G4String procName = itp->first; 207 G4int localCount = itp->second; 173 G4int localCount = itp->second; 208 if (fProcCounter.find(procName) == fProcCo << 174 if ( fProcCounter.find(procName) == fProcCounter.end()) { 209 fProcCounter[procName] = localCount; 175 fProcCounter[procName] = localCount; 210 } 176 } 211 else { 177 else { 212 fProcCounter[procName] += localCount; 178 fProcCounter[procName] += localCount; 213 } << 179 } 214 } 180 } >> 181 >> 182 //map: created particles in absorbers count >> 183 for (G4int k=0; k<=nbOfAbsor; ++k) { >> 184 std::map<G4String,ParticleData>::const_iterator itc; >> 185 for (itc = localRun->fParticleDataMap[k].begin(); >> 186 itc != localRun->fParticleDataMap[k].end(); ++itc) { 215 187 216 // map: created particles in absorbers count << 217 for (G4int k = 0; k <= nbOfAbsor; ++k) { << 218 std::map<G4String, ParticleData>::const_it << 219 for (itc = localRun->fParticleDataMap[k].b << 220 ++itc) << 221 { << 222 G4String name = itc->first; 188 G4String name = itc->first; 223 const ParticleData& localData = itc->sec << 189 const ParticleData& localData = itc->second; 224 if (fParticleDataMap[k].find(name) == fP << 190 if ( fParticleDataMap[k].find(name) == fParticleDataMap[k].end()) { 225 (fParticleDataMap[k])[name] = Particle << 191 (fParticleDataMap[k])[name] 226 localData.fCount, localData.fEmean, << 192 = ParticleData(localData.fCount, >> 193 localData.fEmean, >> 194 localData.fEmin, >> 195 localData.fEmax); 227 } 196 } 228 else { 197 else { 229 ParticleData& data = (fParticleDataMap << 198 ParticleData& data = (fParticleDataMap[k])[name]; 230 data.fCount += localData.fCount; 199 data.fCount += localData.fCount; 231 data.fEmean += localData.fEmean; 200 data.fEmean += localData.fEmean; 232 G4double emin = localData.fEmin; 201 G4double emin = localData.fEmin; 233 if (emin < data.fEmin) data.fEmin = em 202 if (emin < data.fEmin) data.fEmin = emin; 234 G4double emax = localData.fEmax; 203 G4double emax = localData.fEmax; 235 if (emax > data.fEmax) data.fEmax = em << 204 if (emax > data.fEmax) data.fEmax = emax; 236 data.fTmean = localData.fTmean; << 237 } 205 } 238 } 206 } 239 } 207 } 240 208 241 G4Run::Merge(run); << 209 G4Run::Merge(run); 242 } << 210 } 243 211 244 //....oooOO0OOooo........oooOO0OOooo........oo 212 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 245 213 246 void Run::EndOfRun() << 214 void Run::EndOfRun() 247 { 215 { 248 G4int prec = 5, wid = prec + 2; << 216 G4int prec = 5, wid = prec + 2; 249 G4int dfprec = G4cout.precision(prec); << 217 G4int dfprec = G4cout.precision(prec); 250 218 251 // run conditions << 219 //run conditions 252 // << 220 // 253 G4String partName = fParticle->GetParticleNa 221 G4String partName = fParticle->GetParticleName(); 254 G4int nbOfAbsor = fDetector->GetNbOfAbsor(); << 222 G4int nbOfAbsor = fDetector->GetNbOfAbsor(); 255 << 223 256 G4cout << "\n ======================== run s 224 G4cout << "\n ======================== run summary =====================\n"; 257 G4cout << "\n The run is " << numberOfEvent << 225 G4cout 258 << G4BestUnit(fEkin, "Energy") << " t << 226 << "\n The run is " << numberOfEvent << " "<< partName << " of " 259 for (G4int i = 1; i <= nbOfAbsor; i++) { << 227 << G4BestUnit(fEkin,"Energy") 260 G4Material* material = fDetector->GetAbsor << 228 << " through " << nbOfAbsor << " absorbers: \n"; 261 G4double thickness = fDetector->GetAbsorTh << 229 for (G4int i=1; i<= nbOfAbsor; i++) { 262 G4double density = material->GetDensity(); << 230 G4Material* material = fDetector->GetAbsorMaterial(i); 263 G4cout << std::setw(5) << i << std::setw(1 << 231 G4double thickness = fDetector->GetAbsorThickness(i); 264 << material->GetName() << " (densit << 232 G4double density = material->GetDensity(); 265 << G4endl; << 233 G4cout << std::setw(5) << i 266 } << 234 << std::setw(10) << G4BestUnit(thickness,"Length") << " of " 267 << 235 << material->GetName() << " (density: " 268 if (numberOfEvent == 0) { << 236 << G4BestUnit(density,"Volumic Mass") << ")" << G4endl; 269 G4cout.precision(dfprec); << 237 } 270 return; << 271 } << 272 238 >> 239 if (numberOfEvent == 0) { G4cout.precision(dfprec); return;} >> 240 273 G4cout.precision(3); 241 G4cout.precision(3); 274 << 242 275 // frequency of processes << 243 //frequency of processes 276 // 244 // 277 G4cout << "\n Process calls frequency :" << 245 G4cout << "\n Process calls frequency :" << G4endl; 278 G4int index = 0; 246 G4int index = 0; 279 std::map<G4String, G4int>::iterator it; << 247 std::map<G4String,G4int>::iterator it; 280 for (it = fProcCounter.begin(); it != fProcC 248 for (it = fProcCounter.begin(); it != fProcCounter.end(); it++) { 281 G4String procName = it->first; << 249 G4String procName = it->first; 282 G4int count = it->second; << 250 G4int count = it->second; 283 G4String space = " "; << 251 G4String space = " "; if (++index%3 == 0) space = "\n"; 284 if (++index % 3 == 0) space = "\n"; << 252 G4cout << " " << std::setw(20) << procName << "="<< std::setw(7) << count 285 G4cout << " " << std::setw(20) << procName << 253 << space; 286 } 254 } 287 G4cout << G4endl; 255 G4cout << G4endl; 288 << 256 289 // Edep in absorbers << 257 //Edep in absorbers 290 // 258 // 291 for (G4int i = 1; i <= nbOfAbsor; i++) { << 259 for (G4int i=1; i<= nbOfAbsor; i++) { 292 fEdeposit[i] /= numberOfEvent; << 260 fEdeposit[i] /= numberOfEvent; 293 261 294 G4cout << "\n Edep in absorber " << i << " << 262 G4cout 295 << G4BestUnit(fEmin[i], "Energy") < << 263 << "\n Edep in absorber " << i << " = " >> 264 << G4BestUnit(fEdeposit[i],"Energy") >> 265 << "\t(" << G4BestUnit(fEmin[i], "Energy") >> 266 << "-->" << G4BestUnit(fEmax[i], "Energy") >> 267 << ")"; 296 } 268 } 297 G4cout << G4endl; 269 G4cout << G4endl; 298 270 299 if (nbOfAbsor > 1) { 271 if (nbOfAbsor > 1) { 300 fTotEdep[0] /= numberOfEvent; 272 fTotEdep[0] /= numberOfEvent; 301 G4cout << "\n Edep in all absorb = " << G4 << 273 G4cout 302 << G4BestUnit(fTotEdep[1], "Energy" << 274 << "\n Edep in all absorbers = " << G4BestUnit(fTotEdep[0],"Energy") 303 << G4endl; << 275 << "\t(" << G4BestUnit(fTotEdep[1], "Energy") >> 276 << "-->" << G4BestUnit(fTotEdep[2], "Energy") >> 277 << ")" << G4endl; 304 } 278 } 305 279 306 // Eleak << 280 //particles count in absorbers 307 // 281 // 308 fEleak[0] /= numberOfEvent; << 282 for (G4int k=1; k<= nbOfAbsor; k++) { 309 G4cout << " Energy leakage = " << G4Best << 283 G4cout << "\n List of generated particles in absorber " << k << ":" << G4endl; 310 << G4BestUnit(fEleak[1], "Energy") << << 311 << G4endl; << 312 284 313 // Etotal << 285 std::map<G4String,ParticleData>::iterator itc; 314 // << 286 for (itc = fParticleDataMap[k].begin(); 315 fEtotal[0] /= numberOfEvent; << 287 itc != fParticleDataMap[k].end(); itc++) { 316 G4cout << " Energy total = " << G4Best << 288 G4String name = itc->first; 317 << G4BestUnit(fEtotal[1], "Energy") < << 289 ParticleData data = itc->second; 318 << G4endl; << 290 G4int count = data.fCount; 319 << 291 G4double eMean = data.fEmean/count; 320 // particles count in absorbers << 292 G4double eMin = data.fEmin; 321 // << 293 G4double eMax = data.fEmax; 322 for (G4int k = 1; k <= nbOfAbsor; k++) { << 294 323 G4cout << "\n List of created particles in << 295 G4cout << " " << std::setw(13) << name << ": " << std::setw(7) << count 324 << 296 << " Emean = " << std::setw(wid) << G4BestUnit(eMean, "Energy") 325 std::map<G4String, ParticleData>::iterator << 297 << "\t( " << G4BestUnit(eMin, "Energy") 326 for (itc = fParticleDataMap[k].begin(); it << 298 << " --> " << G4BestUnit(eMax, "Energy") 327 G4String name = itc->first; << 299 << ")" << G4endl; 328 ParticleData data = itc->second; << 329 G4int count = data.fCount; << 330 G4double eMean = data.fEmean / count; << 331 G4double eMin = data.fEmin; << 332 G4double eMax = data.fEmax; << 333 G4double meanLife = data.fTmean; << 334 << 335 G4cout << " " << std::setw(13) << name << 336 << " Emean = " << std::setw(wid) << 337 << G4BestUnit(eMin, "Energy") << << 338 if (meanLife >= 0.) << 339 G4cout << "\tmean life = " << G4BestUn << 340 else << 341 G4cout << "\tstable" << G4endl; << 342 } 300 } 343 } 301 } 344 // particles emerging from absorbers << 302 //particles emerging from absorbers 345 // 303 // 346 G4cout << "\n List of particles emerging fro 304 G4cout << "\n List of particles emerging from absorbers :" << G4endl; 347 << 305 348 std::map<G4String, ParticleData>::iterator i << 306 std::map<G4String,ParticleData>::iterator itc; 349 for (itc = fParticleDataMap[0].begin(); itc << 307 for (itc = fParticleDataMap[0].begin(); >> 308 itc != fParticleDataMap[0].end(); itc++) { 350 G4String name = itc->first; 309 G4String name = itc->first; 351 ParticleData data = itc->second; 310 ParticleData data = itc->second; 352 G4int count = data.fCount; 311 G4int count = data.fCount; 353 G4double eMean = data.fEmean / count; << 312 G4double eMean = data.fEmean/count; 354 G4double eMin = data.fEmin; 313 G4double eMin = data.fEmin; 355 G4double eMax = data.fEmax; 314 G4double eMax = data.fEmax; 356 /// G4double meanLife = data.fTmean; << 357 315 358 G4cout << " " << std::setw(13) << name << 316 G4cout << " " << std::setw(13) << name << ": " << std::setw(7) << count 359 << " Emean = " << std::setw(wid) < << 317 << " Emean = " << std::setw(wid) << G4BestUnit(eMean, "Energy") 360 << G4BestUnit(eMin, "Energy") << " << 318 << "\t( " << G4BestUnit(eMin, "Energy") >> 319 << " --> " << G4BestUnit(eMax, "Energy") >> 320 << ")" << G4endl; 361 } 321 } 362 322 363 // transmission coefficients << 323 //transmission coefficients 364 // 324 // 365 G4double dNofEvents = double(numberOfEvent); 325 G4double dNofEvents = double(numberOfEvent); 366 G4double absorbed = 100. * fStatus[0] / dNof << 326 G4double absorbed = 100.*fStatus[0]/dNofEvents; 367 G4double transmit = 100. * fStatus[1] / dNof << 327 G4double transmit = 100.*fStatus[1]/dNofEvents; 368 G4double reflected = 100. * fStatus[2] / dNo << 328 G4double reflected = 100.*fStatus[2]/dNofEvents; 369 << 329 370 G4cout.precision(2); << 330 G4cout.precision(2); 371 G4cout << "\n Nb of events with primary abso << 331 G4cout 372 << " transmit = " << transmit << " << 332 << "\n Nb of events with primary absorbed = " << absorbed << " %," 373 << " reflected = " << reflected << << 333 << " transmit = " << transmit << " %," >> 334 << " reflected = " << reflected << " %" << G4endl; 374 335 375 // normalize histograms of longitudinal ener 336 // normalize histograms of longitudinal energy profile 376 // 337 // 377 G4AnalysisManager* analysisManager = G4Analy 338 G4AnalysisManager* analysisManager = G4AnalysisManager::Instance(); 378 G4int ih = 10; 339 G4int ih = 10; 379 G4double binWidth = analysisManager->GetH1Wi << 340 G4double binWidth = analysisManager->GetH1Width(ih) 380 G4double fac = (1. / (numberOfEvent * binWid << 341 *analysisManager->GetH1Unit(ih); 381 analysisManager->ScaleH1(ih, fac); << 342 G4double fac = (1./(numberOfEvent*binWidth))*(mm/MeV); >> 343 analysisManager->ScaleH1(ih,fac); 382 344 383 // remove all contents in fProcCounter, fCou << 345 //remove all contents in fProcCounter, fCount 384 fProcCounter.clear(); 346 fProcCounter.clear(); 385 for (G4int k = 0; k <= nbOfAbsor; k++) << 347 for (G4int k=0; k<= nbOfAbsor; k++) fParticleDataMap[k].clear(); 386 fParticleDataMap[k].clear(); << 387 348 388 // reset default formats 349 // reset default formats 389 G4cout.precision(dfprec); 350 G4cout.precision(dfprec); 390 } 351 } 391 352 392 //....oooOO0OOooo........oooOO0OOooo........oo 353 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 393 354