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 // 26 // 27 // ------------------------------------------- 27 // ------------------------------------------------------------------- 28 // 28 // 29 // GEANT4 Class class file 29 // GEANT4 Class class file 30 // 30 // 31 // 31 // 32 // File name: G4VAtomDeexcitation 32 // File name: G4VAtomDeexcitation 33 // 33 // 34 // Author: Alfonso Mantero & Vladimir I 34 // Author: Alfonso Mantero & Vladimir Ivanchenko 35 // 35 // 36 // Creation date: 21.04.2010 36 // Creation date: 21.04.2010 37 // 37 // 38 // Modifications: 38 // Modifications: 39 // 39 // 40 // Class Description: 40 // Class Description: 41 // 41 // 42 // Abstract interface to energy loss models 42 // Abstract interface to energy loss models 43 43 44 // ------------------------------------------- 44 // ------------------------------------------------------------------- 45 // 45 // 46 46 47 #include "G4VAtomDeexcitation.hh" 47 #include "G4VAtomDeexcitation.hh" 48 #include "G4SystemOfUnits.hh" 48 #include "G4SystemOfUnits.hh" 49 #include "G4EmParameters.hh" << 50 #include "G4ParticleDefinition.hh" 49 #include "G4ParticleDefinition.hh" 51 #include "G4DynamicParticle.hh" 50 #include "G4DynamicParticle.hh" 52 #include "G4Step.hh" 51 #include "G4Step.hh" 53 #include "G4Region.hh" 52 #include "G4Region.hh" 54 #include "G4RegionStore.hh" 53 #include "G4RegionStore.hh" 55 #include "G4MaterialCutsCouple.hh" 54 #include "G4MaterialCutsCouple.hh" 56 #include "G4MaterialCutsCouple.hh" 55 #include "G4MaterialCutsCouple.hh" 57 #include "G4Material.hh" 56 #include "G4Material.hh" 58 #include "G4Element.hh" 57 #include "G4Element.hh" 59 #include "G4ElementVector.hh" 58 #include "G4ElementVector.hh" 60 #include "Randomize.hh" 59 #include "Randomize.hh" 61 #include "G4VParticleChange.hh" 60 #include "G4VParticleChange.hh" 62 #include "G4EmSecondaryParticleType.hh" << 61 #include "G4PhysicsModelCatalog.hh" 63 #include "G4Gamma.hh" 62 #include "G4Gamma.hh" 64 #include "G4Log.hh" << 65 63 66 #ifdef G4MULTITHREADED 64 #ifdef G4MULTITHREADED 67 G4Mutex G4VAtomDeexcitation::atomDeexcitatio 65 G4Mutex G4VAtomDeexcitation::atomDeexcitationMutex = G4MUTEX_INITIALIZER; 68 #endif 66 #endif 69 67 70 //....oooOO0OOooo........oooOO0OOooo........oo 68 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 71 69 >> 70 G4int G4VAtomDeexcitation::pixeIDg = -1; >> 71 G4int G4VAtomDeexcitation::pixeIDe = -1; >> 72 72 G4VAtomDeexcitation::G4VAtomDeexcitation(const 73 G4VAtomDeexcitation::G4VAtomDeexcitation(const G4String& modname) 73 : name(modname) << 74 : verbose(1), name(modname), isActive(false), flagAuger(false), >> 75 flagAugerCascade(false), flagPIXE(false), ignoreCuts(false), >> 76 isActiveLocked(false), isAugerLocked(false), >> 77 isAugerCascadeLocked(false), isPIXELocked(false) 74 { 78 { >> 79 theParameters = G4EmParameters::Instance(); 75 vdyn.reserve(5); 80 vdyn.reserve(5); 76 theCoupleTable = nullptr; 81 theCoupleTable = nullptr; >> 82 G4String gg = "gammaPIXE"; >> 83 G4String ee = "e-PIXE"; >> 84 if(pixeIDg < 0) { >> 85 #ifdef G4MULTITHREADED >> 86 G4MUTEXLOCK(&atomDeexcitationMutex); >> 87 if(pixeIDg < 0) { >> 88 #endif >> 89 pixeIDg = G4PhysicsModelCatalog::Register(gg); >> 90 pixeIDe = G4PhysicsModelCatalog::Register(ee); >> 91 #ifdef G4MULTITHREADED >> 92 } >> 93 G4MUTEXUNLOCK(&atomDeexcitationMutex); >> 94 #endif >> 95 } 77 gamma = G4Gamma::Gamma(); 96 gamma = G4Gamma::Gamma(); 78 } 97 } 79 98 80 //....oooOO0OOooo........oooOO0OOooo........oo 99 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 81 100 82 G4VAtomDeexcitation::~G4VAtomDeexcitation() = << 101 G4VAtomDeexcitation::~G4VAtomDeexcitation() >> 102 {} 83 103 84 //....oooOO0OOooo........oooOO0OOooo........oo 104 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 85 105 86 void G4VAtomDeexcitation::InitialiseAtomicDeex 106 void G4VAtomDeexcitation::InitialiseAtomicDeexcitation() 87 { 107 { 88 G4EmParameters* theParameters = G4EmParamete << 89 theParameters->DefineRegParamForDeex(this); 108 theParameters->DefineRegParamForDeex(this); 90 109 91 // Define list of couples 110 // Define list of couples 92 theCoupleTable = G4ProductionCutsTable::GetP 111 theCoupleTable = G4ProductionCutsTable::GetProductionCutsTable(); 93 nCouples = (G4int)theCoupleTable->GetTableSi << 112 G4int numOfCouples = theCoupleTable->GetTableSize(); 94 113 95 // needed for unit tests 114 // needed for unit tests 96 std::size_t nn = std::max(nCouples, 1); << 115 G4int nn = std::max(numOfCouples, 1); 97 if(activeDeexcitationMedia.size() != nn) { << 116 activeDeexcitationMedia.resize(nn, false); 98 activeDeexcitationMedia.resize(nn, false); << 117 activeAugerMedia.resize(nn, false); 99 activeAugerMedia.resize(nn, false); << 118 activePIXEMedia.resize(nn, false); 100 activePIXEMedia.resize(nn, false); << 119 activeZ.resize(93, false); 101 } << 102 if(activeZ.size() != 93) { activeZ.resize(93 << 103 120 104 // initialisation of flags and options 121 // initialisation of flags and options 105 // normally there is no locksed flags 122 // normally there is no locksed flags 106 if(!isActiveLocked) { isActive = theParamet << 123 if(!isActiveLocked) { isActive = theParameters->Fluo(); } 107 if(!isAugerLocked) { flagAuger = theParamet << 124 if(!isAugerLocked) { flagAuger = theParameters->Auger(); } 108 if(!isPIXELocked) { flagPIXE = theParamet << 125 if(!isAugerCascadeLocked) { flagAugerCascade = theParameters->AugerCascade(); } >> 126 if(!isPIXELocked) { flagPIXE = theParameters->Pixe(); } 109 ignoreCuts = theParameters->DeexcitationIgno 127 ignoreCuts = theParameters->DeexcitationIgnoreCut(); 110 128 111 // Define list of regions 129 // Define list of regions 112 std::size_t nRegions = deRegions.size(); << 130 size_t nRegions = deRegions.size(); 113 // check if deexcitation is active for the g 131 // check if deexcitation is active for the given run 114 if(!isActive && 0 == nRegions) { return; } 132 if(!isActive && 0 == nRegions) { return; } 115 133 116 // if no active regions add a world 134 // if no active regions add a world 117 if(0 == nRegions) { 135 if(0 == nRegions) { 118 SetDeexcitationActiveRegion("World",isActi 136 SetDeexcitationActiveRegion("World",isActive,flagAuger,flagPIXE); 119 nRegions = deRegions.size(); 137 nRegions = deRegions.size(); 120 } 138 } 121 139 122 if(0 < verbose) { 140 if(0 < verbose) { 123 G4cout << G4endl; 141 G4cout << G4endl; 124 G4cout << "### === Deexcitation model " < 142 G4cout << "### === Deexcitation model " << name 125 << " is activated for " << nRegions 143 << " is activated for " << nRegions; 126 if(1 == nRegions) { G4cout << " region:" < 144 if(1 == nRegions) { G4cout << " region:" << G4endl; } 127 else { G4cout << " regions:" 145 else { G4cout << " regions:" << G4endl;} 128 } 146 } 129 147 130 // Identify active media 148 // Identify active media 131 const G4RegionStore* regionStore = G4RegionS << 149 G4RegionStore* regionStore = G4RegionStore::GetInstance(); 132 for(std::size_t j=0; j<nRegions; ++j) { << 150 for(size_t j=0; j<nRegions; ++j) { 133 const G4Region* reg = regionStore->GetRegi 151 const G4Region* reg = regionStore->GetRegion(activeRegions[j], false); 134 if(nullptr != reg && 0 < nCouples) { << 152 if(reg && 0 < numOfCouples) { 135 const G4ProductionCuts* rpcuts = reg->Ge 153 const G4ProductionCuts* rpcuts = reg->GetProductionCuts(); 136 if(0 < verbose) { 154 if(0 < verbose) { 137 G4cout << " " << activeRegion 155 G4cout << " " << activeRegions[j] 138 << " " << deRegions[j] << " << 156 << " " << deRegions[j] << " " << AugerRegions[j] 139 << " " << PIXERegions[j] << G4 << 157 << " " << PIXERegions[j] << G4endl; 140 } 158 } 141 for(G4int i=0; i<nCouples; ++i) { << 159 for(G4int i=0; i<numOfCouples; ++i) { 142 const G4MaterialCutsCouple* couple = 160 const G4MaterialCutsCouple* couple = 143 theCoupleTable->GetMaterialCutsCoupl 161 theCoupleTable->GetMaterialCutsCouple(i); 144 if (couple->GetProductionCuts() == rpc 162 if (couple->GetProductionCuts() == rpcuts) { 145 activeDeexcitationMedia[i] = deRegio 163 activeDeexcitationMedia[i] = deRegions[j]; 146 activeAugerMedia[i] = AugerRegions[j 164 activeAugerMedia[i] = AugerRegions[j]; 147 activePIXEMedia[i] = PIXERegions[j]; 165 activePIXEMedia[i] = PIXERegions[j]; 148 } 166 } 149 } 167 } 150 } 168 } 151 } 169 } 152 std::size_t nelm = G4Element::GetNumberOfEle << 170 G4int nelm = G4Element::GetNumberOfElements(); 153 //G4cout << nelm << G4endl; 171 //G4cout << nelm << G4endl; 154 for(std::size_t k=0; k<nelm; ++k) { << 172 for(G4int k=0; k<nelm; ++k) { 155 G4int Z = (*(G4Element::GetElementTable()) 173 G4int Z = (*(G4Element::GetElementTable()))[k]->GetZasInt(); 156 if(Z > 5 && Z < 93) { 174 if(Z > 5 && Z < 93) { 157 activeZ[Z] = true; 175 activeZ[Z] = true; 158 //G4cout << "!!! Active de-excitation Z= 176 //G4cout << "!!! Active de-excitation Z= " << Z << G4endl; 159 } 177 } 160 } 178 } 161 179 162 // Initialise derived class 180 // Initialise derived class 163 InitialiseForNewRun(); 181 InitialiseForNewRun(); 164 182 165 if(0 < verbose && flagAuger) { 183 if(0 < verbose && flagAuger) { 166 G4cout << "### === Auger flag: " << flagA << 184 G4cout << "### === Auger cascade flag: " << flagAugerCascade 167 << G4endl; << 185 << G4endl; 168 } 186 } 169 if(0 < verbose) { 187 if(0 < verbose) { 170 G4cout << "### === Ignore cuts flag: " 188 G4cout << "### === Ignore cuts flag: " << ignoreCuts 171 << G4endl; << 189 << G4endl; 172 } 190 } 173 if(0 < verbose && flagPIXE) { 191 if(0 < verbose && flagPIXE) { 174 G4cout << "### === PIXE model for hadrons 192 G4cout << "### === PIXE model for hadrons: " 175 << theParameters->PIXECrossSectionM 193 << theParameters->PIXECrossSectionModel() 176 << G4endl; 194 << G4endl; 177 G4cout << "### === PIXE model for e+-: 195 G4cout << "### === PIXE model for e+-: " 178 << theParameters->PIXEElectronCross 196 << theParameters->PIXEElectronCrossSectionModel() 179 << G4endl; 197 << G4endl; 180 } 198 } 181 } 199 } 182 200 183 //....oooOO0OOooo........oooOO0OOooo........oo 201 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 184 202 185 void 203 void 186 G4VAtomDeexcitation::SetDeexcitationActiveRegi 204 G4VAtomDeexcitation::SetDeexcitationActiveRegion(const G4String& rname, 187 205 G4bool valDeexcitation, 188 206 G4bool valAuger, 189 207 G4bool valPIXE) 190 { 208 { 191 // no PIXE in parallel world 209 // no PIXE in parallel world 192 if(rname == "DefaultRegionForParallelWorld") 210 if(rname == "DefaultRegionForParallelWorld") { return; } 193 211 194 G4String ss = rname; 212 G4String ss = rname; 195 /* 213 /* 196 G4cout << "### G4VAtomDeexcitation::SetDeexc 214 G4cout << "### G4VAtomDeexcitation::SetDeexcitationActiveRegion " << ss 197 << " " << valDeexcitation << " " << 215 << " " << valDeexcitation << " " << valAuger 198 << " " << valPIXE << G4endl; 216 << " " << valPIXE << G4endl; 199 */ 217 */ 200 if(ss == "world" || ss == "World" || ss == " 218 if(ss == "world" || ss == "World" || ss == "WORLD") { 201 ss = "DefaultRegionForTheWorld"; 219 ss = "DefaultRegionForTheWorld"; 202 } 220 } 203 std::size_t n = deRegions.size(); << 221 size_t n = deRegions.size(); 204 for(std::size_t i=0; i<n; ++i) { << 222 for(size_t i=0; i<n; ++i) { 205 223 206 // Region already exist 224 // Region already exist 207 if(ss == activeRegions[i]) { 225 if(ss == activeRegions[i]) { 208 deRegions[i] = valDeexcitation; 226 deRegions[i] = valDeexcitation; 209 AugerRegions[i] = valAuger; 227 AugerRegions[i] = valAuger; 210 PIXERegions[i] = valPIXE; 228 PIXERegions[i] = valPIXE; 211 return; 229 return; 212 } 230 } 213 } 231 } 214 // New region 232 // New region 215 activeRegions.push_back(ss); 233 activeRegions.push_back(ss); 216 deRegions.push_back(valDeexcitation); 234 deRegions.push_back(valDeexcitation); 217 AugerRegions.push_back(valAuger); 235 AugerRegions.push_back(valAuger); 218 PIXERegions.push_back(valPIXE); 236 PIXERegions.push_back(valPIXE); 219 237 220 // if de-excitation defined for the world vo 238 // if de-excitation defined for the world volume 221 // it should be active for all G4Regions 239 // it should be active for all G4Regions 222 if(ss == "DefaultRegionForTheWorld") { 240 if(ss == "DefaultRegionForTheWorld") { 223 G4RegionStore* regions = G4RegionStore::Ge 241 G4RegionStore* regions = G4RegionStore::GetInstance(); 224 std::size_t nn = regions->size(); << 242 G4int nn = regions->size(); 225 for(std::size_t i=0; i<nn; ++i) { << 243 for(G4int i=0; i<nn; ++i) { 226 if(ss == (*regions)[i]->GetName()) { con 244 if(ss == (*regions)[i]->GetName()) { continue; } 227 SetDeexcitationActiveRegion((*regions)[i 245 SetDeexcitationActiveRegion((*regions)[i]->GetName(), valDeexcitation, 228 valAuger, va 246 valAuger, valPIXE); 229 247 230 } 248 } 231 } 249 } 232 } 250 } 233 251 234 void G4VAtomDeexcitation::GenerateParticles(st << 252 void G4VAtomDeexcitation::GenerateParticles(std::vector<G4DynamicParticle*>* v, 235 co << 253 const G4AtomicShell* as, 236 G4 << 254 G4int Z, G4int idx) 237 { 255 { 238 G4double gCut = DBL_MAX; 256 G4double gCut = DBL_MAX; 239 if(ignoreCuts) { 257 if(ignoreCuts) { 240 gCut = 0.0; 258 gCut = 0.0; 241 } else if (nullptr != theCoupleTable) { << 259 } else if (theCoupleTable) { 242 gCut = (*(theCoupleTable->GetEnergyCutsVec 260 gCut = (*(theCoupleTable->GetEnergyCutsVector(0)))[idx]; 243 } 261 } 244 if(gCut < as->BindingEnergy()) { 262 if(gCut < as->BindingEnergy()) { 245 G4double eCut = DBL_MAX; 263 G4double eCut = DBL_MAX; 246 if(CheckAugerActiveRegion(idx)) { 264 if(CheckAugerActiveRegion(idx)) { 247 if(ignoreCuts) { 265 if(ignoreCuts) { 248 eCut = 0.0; 266 eCut = 0.0; 249 } else if (nullptr != theCoupleTable) { << 267 } else if (theCoupleTable) { 250 eCut = (*(theCoupleTable->GetEnergyCut 268 eCut = (*(theCoupleTable->GetEnergyCutsVector(1)))[idx]; 251 } 269 } 252 } 270 } 253 GenerateParticles(v, as, Z, gCut, eCut); 271 GenerateParticles(v, as, Z, gCut, eCut); 254 } 272 } 255 } 273 } 256 274 257 //....oooOO0OOooo........oooOO0OOooo........oo 275 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 258 276 259 void 277 void 260 G4VAtomDeexcitation::AlongStepDeexcitation(std 278 G4VAtomDeexcitation::AlongStepDeexcitation(std::vector<G4Track*>& tracks, 261 con 279 const G4Step& step, 262 G4d 280 G4double& eLossMax, 263 G4i 281 G4int coupleIndex) 264 { 282 { 265 G4double truelength = step.GetStepLength(); 283 G4double truelength = step.GetStepLength(); 266 if(!flagPIXE && !activePIXEMedia[coupleIndex 284 if(!flagPIXE && !activePIXEMedia[coupleIndex]) { return; } 267 if(eLossMax <= 0.0 || truelength <= 0.0) 285 if(eLossMax <= 0.0 || truelength <= 0.0) { return; } 268 286 269 // step parameters 287 // step parameters 270 const G4StepPoint* preStep = step.GetPreStep 288 const G4StepPoint* preStep = step.GetPreStepPoint(); 271 const G4ThreeVector prePos = preStep->GetPos << 289 G4ThreeVector prePos = preStep->GetPosition(); 272 const G4ThreeVector delta = step.GetPostStep << 290 G4ThreeVector delta = step.GetPostStepPoint()->GetPosition() - prePos; 273 const G4double preTime = preStep->GetGlobalT << 291 G4double preTime = preStep->GetGlobalTime(); 274 const G4double dt = step.GetPostStepPoint()- << 292 G4double dt = step.GetPostStepPoint()->GetGlobalTime() - preTime; 275 293 276 // particle parameters 294 // particle parameters 277 const G4Track* track = step.GetTrack(); 295 const G4Track* track = step.GetTrack(); 278 const G4ParticleDefinition* part = track->Ge 296 const G4ParticleDefinition* part = track->GetDefinition(); 279 G4double ekin = preStep->GetKineticEnergy(); 297 G4double ekin = preStep->GetKineticEnergy(); 280 298 281 // media parameters 299 // media parameters 282 G4double gCut = (*theCoupleTable->GetEnergyC 300 G4double gCut = (*theCoupleTable->GetEnergyCutsVector(0))[coupleIndex]; 283 if(ignoreCuts) { gCut = 0.0; } 301 if(ignoreCuts) { gCut = 0.0; } 284 G4double eCut = DBL_MAX; 302 G4double eCut = DBL_MAX; 285 if(CheckAugerActiveRegion(coupleIndex)) { 303 if(CheckAugerActiveRegion(coupleIndex)) { 286 eCut = (*theCoupleTable->GetEnergyCutsVect 304 eCut = (*theCoupleTable->GetEnergyCutsVector(1))[coupleIndex]; 287 if(ignoreCuts) { eCut = 0.0; } 305 if(ignoreCuts) { eCut = 0.0; } 288 } 306 } 289 307 290 //G4cout<<"!Sample PIXE gCut(MeV)= "<<gCut<< 308 //G4cout<<"!Sample PIXE gCut(MeV)= "<<gCut<<" eCut(MeV)= "<<eCut 291 // <<" Ekin(MeV)= " << ekin/MeV << G4 309 // <<" Ekin(MeV)= " << ekin/MeV << G4endl; 292 310 293 const G4Material* material = preStep->GetMat 311 const G4Material* material = preStep->GetMaterial(); 294 const G4ElementVector* theElementVector = ma 312 const G4ElementVector* theElementVector = material->GetElementVector(); 295 const G4double* theAtomNumDensityVector = 313 const G4double* theAtomNumDensityVector = 296 material->GetVecNbOfAtomsPerVolume(); 314 material->GetVecNbOfAtomsPerVolume(); 297 const std::size_t nelm = material->GetNumber << 315 G4int nelm = material->GetNumberOfElements(); 298 316 299 // loop over deexcitations 317 // loop over deexcitations 300 for(std::size_t i=0; i<nelm; ++i) { << 318 for(G4int i=0; i<nelm; ++i) { 301 G4int Z = (*theElementVector)[i]->GetZasIn 319 G4int Z = (*theElementVector)[i]->GetZasInt(); 302 if(activeZ[Z] && Z < 93) { 320 if(activeZ[Z] && Z < 93) { 303 G4int nshells = 321 G4int nshells = 304 std::min(9,(*theElementVector)[i]->Get 322 std::min(9,(*theElementVector)[i]->GetNbOfAtomicShells()); 305 G4double rho = truelength*theAtomNumDens 323 G4double rho = truelength*theAtomNumDensityVector[i]; 306 //G4cout<<" Z "<< Z <<" is active x(m 324 //G4cout<<" Z "<< Z <<" is active x(mm)= " << truelength/mm << G4endl; 307 for(G4int ii=0; ii<nshells; ++ii) { 325 for(G4int ii=0; ii<nshells; ++ii) { 308 auto as = (G4AtomicShellEnumerator)(ii << 326 G4AtomicShellEnumerator as = G4AtomicShellEnumerator(ii); 309 const G4AtomicShell* shell = GetAtomic 327 const G4AtomicShell* shell = GetAtomicShell(Z, as); 310 const G4double bindingEnergy = shell-> << 328 G4double bindingEnergy = shell->BindingEnergy(); 311 329 312 if(gCut > bindingEnergy) { break; } 330 if(gCut > bindingEnergy) { break; } 313 331 314 if(eLossMax > bindingEnergy) { 332 if(eLossMax > bindingEnergy) { 315 G4double sig = rho* 333 G4double sig = rho* 316 GetShellIonisationCrossSectionPerA 334 GetShellIonisationCrossSectionPerAtom(part, Z, as, ekin, material); 317 335 318 // mfp is mean free path in units of 336 // mfp is mean free path in units of step size 319 if(sig > 0.0) { 337 if(sig > 0.0) { 320 G4double mfp = 1.0/sig; 338 G4double mfp = 1.0/sig; 321 G4double stot = 0.0; 339 G4double stot = 0.0; 322 //G4cout << " Shell " << ii << " m 340 //G4cout << " Shell " << ii << " mfp(mm)= " << mfp/mm << G4endl; 323 // sample ionisation points 341 // sample ionisation points 324 do { 342 do { 325 stot -= mfp*G4Log(G4UniformRand( << 343 stot -= mfp*std::log(G4UniformRand()); 326 if( stot > 1.0 || eLossMax < bin 344 if( stot > 1.0 || eLossMax < bindingEnergy) { break; } 327 // sample deexcitation 345 // sample deexcitation 328 vdyn.clear(); 346 vdyn.clear(); 329 GenerateParticles(&vdyn, shell, 347 GenerateParticles(&vdyn, shell, Z, gCut, eCut); 330 std::size_t nsec = vdyn.size(); << 348 G4int nsec = vdyn.size(); 331 if(nsec > 0) { 349 if(nsec > 0) { 332 G4ThreeVector r = prePos + st 350 G4ThreeVector r = prePos + stot*delta; 333 G4double time = preTime + st 351 G4double time = preTime + stot*dt; 334 for(std::size_t j=0; j<nsec; + << 352 for(G4int j=0; j<nsec; ++j) { 335 G4DynamicParticle* dp = vdyn 353 G4DynamicParticle* dp = vdyn[j]; 336 G4double e = dp->GetKineticE 354 G4double e = dp->GetKineticEnergy(); 337 355 338 // save new secondary if the 356 // save new secondary if there is enough energy 339 if(eLossMax >= e) { 357 if(eLossMax >= e) { 340 eLossMax -= e; 358 eLossMax -= e; 341 G4Track* t = new G4Track(d 359 G4Track* t = new G4Track(dp, time, r); 342 360 343 // defined secondary type 361 // defined secondary type 344 if(dp->GetDefinition() == 362 if(dp->GetDefinition() == gamma) { 345 t->SetCreatorModelID(_Ga << 363 t->SetCreatorModelIndex(pixeIDg); 346 } else { 364 } else { 347 t->SetCreatorModelID(_eP << 365 t->SetCreatorModelIndex(pixeIDe); 348 } 366 } >> 367 349 tracks.push_back(t); 368 tracks.push_back(t); 350 } else { 369 } else { 351 delete dp; 370 delete dp; 352 } 371 } 353 } 372 } 354 } 373 } 355 // Loop checking, 03-Aug-2015, V 374 // Loop checking, 03-Aug-2015, Vladimir Ivanchenko 356 } while (stot < 1.0); 375 } while (stot < 1.0); 357 } 376 } 358 } 377 } 359 } 378 } 360 } 379 } 361 } 380 } 362 return; 381 return; 363 } 382 } 364 383 365 //....oooOO0OOooo........oooOO0OOooo........oo 384 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 366 385