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