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