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 // $Id: G4VEmProcess.cc 76957 2013-11-19 15:07:20Z gcosmo $ >> 27 // 26 // ------------------------------------------- 28 // ------------------------------------------------------------------- 27 // 29 // 28 // GEANT4 Class file 30 // GEANT4 Class file 29 // 31 // 30 // 32 // 31 // File name: G4VEmProcess 33 // File name: G4VEmProcess 32 // 34 // 33 // Author: Vladimir Ivanchenko on base 35 // Author: Vladimir Ivanchenko on base of Laszlo Urban code 34 // 36 // 35 // Creation date: 01.10.2003 37 // Creation date: 01.10.2003 36 // 38 // 37 // Modifications: by V.Ivanchenko << 39 // Modifications: >> 40 // 30-06-04 make it to be pure discrete process (V.Ivanchenko) >> 41 // 30-09-08 optimise integral option (V.Ivanchenko) >> 42 // 08-11-04 Migration to new interface of Store/Retrieve tables (V.Ivanchenko) >> 43 // 11-03-05 Shift verbose level by 1, add applyCuts and killPrimary flags (VI) >> 44 // 14-03-05 Update logic PostStepDoIt (V.Ivanchenko) >> 45 // 08-04-05 Major optimisation of internal interfaces (V.Ivanchenko) >> 46 // 18-04-05 Use G4ParticleChangeForGamma (V.Ivanchenko) >> 47 // 25-07-05 Add protection: integral mode only for charged particles (VI) >> 48 // 04-09-05 default lambdaFactor 0.8 (V.Ivanchenko) >> 49 // 11-01-06 add A to parameters of ComputeCrossSectionPerAtom (VI) >> 50 // 12-09-06 add SetModel() (mma) >> 51 // 12-04-07 remove double call to Clear model manager (V.Ivanchenko) >> 52 // 27-10-07 Virtual functions moved to source (V.Ivanchenko) >> 53 // 24-06-09 Removed hidden bin in G4PhysicsVector (V.Ivanchenko) >> 54 // 17-02-10 Added pointer currentParticle (VI) >> 55 // 30-05-12 allow Russian roulette, brem splitting (D. Sawkey) 38 // 56 // 39 // Class Description: based class for discrete << 57 // Class Description: 40 // 58 // 41 59 42 // ------------------------------------------- 60 // ------------------------------------------------------------------- 43 // 61 // 44 //....oooOO0OOooo........oooOO0OOooo........oo 62 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 45 //....oooOO0OOooo........oooOO0OOooo........oo 63 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 46 64 47 #include "G4VEmProcess.hh" 65 #include "G4VEmProcess.hh" 48 #include "G4PhysicalConstants.hh" 66 #include "G4PhysicalConstants.hh" 49 #include "G4SystemOfUnits.hh" 67 #include "G4SystemOfUnits.hh" 50 #include "G4ProcessManager.hh" 68 #include "G4ProcessManager.hh" 51 #include "G4LossTableManager.hh" 69 #include "G4LossTableManager.hh" 52 #include "G4LossTableBuilder.hh" 70 #include "G4LossTableBuilder.hh" 53 #include "G4Step.hh" 71 #include "G4Step.hh" 54 #include "G4ParticleDefinition.hh" 72 #include "G4ParticleDefinition.hh" 55 #include "G4VEmModel.hh" 73 #include "G4VEmModel.hh" 56 #include "G4DataVector.hh" 74 #include "G4DataVector.hh" 57 #include "G4PhysicsTable.hh" 75 #include "G4PhysicsTable.hh" 58 #include "G4EmDataHandler.hh" << 59 #include "G4PhysicsLogVector.hh" 76 #include "G4PhysicsLogVector.hh" 60 #include "G4VParticleChange.hh" 77 #include "G4VParticleChange.hh" 61 #include "G4ProductionCutsTable.hh" 78 #include "G4ProductionCutsTable.hh" 62 #include "G4Region.hh" 79 #include "G4Region.hh" 63 #include "G4Gamma.hh" 80 #include "G4Gamma.hh" 64 #include "G4Electron.hh" 81 #include "G4Electron.hh" 65 #include "G4Positron.hh" 82 #include "G4Positron.hh" 66 #include "G4PhysicsTableHelper.hh" 83 #include "G4PhysicsTableHelper.hh" 67 #include "G4EmBiasingManager.hh" 84 #include "G4EmBiasingManager.hh" 68 #include "G4EmParameters.hh" << 69 #include "G4EmProcessSubType.hh" << 70 #include "G4EmTableUtil.hh" << 71 #include "G4EmUtility.hh" << 72 #include "G4DNAModelSubType.hh" << 73 #include "G4GenericIon.hh" 85 #include "G4GenericIon.hh" 74 #include "G4Log.hh" 86 #include "G4Log.hh" 75 #include <iostream> << 76 87 77 //....oooOO0OOooo........oooOO0OOooo........oo 88 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 78 89 79 G4VEmProcess::G4VEmProcess(const G4String& nam 90 G4VEmProcess::G4VEmProcess(const G4String& name, G4ProcessType type): 80 G4VDiscreteProcess(name, type) << 91 G4VDiscreteProcess(name, type), >> 92 secondaryParticle(0), >> 93 buildLambdaTable(true), >> 94 numberOfModels(0), >> 95 theLambdaTable(0), >> 96 theLambdaTablePrim(0), >> 97 theDensityFactor(0), >> 98 theDensityIdx(0), >> 99 integral(false), >> 100 applyCuts(false), >> 101 startFromNull(false), >> 102 splineFlag(true), >> 103 currentModel(0), >> 104 particle(0), >> 105 currentParticle(0), >> 106 currentCouple(0) 81 { 107 { 82 theParameters = G4EmParameters::Instance(); << 83 SetVerboseLevel(1); 108 SetVerboseLevel(1); 84 109 85 // Size of tables << 110 // Size of tables assuming spline 86 minKinEnergy = 0.1*CLHEP::keV; << 111 minKinEnergy = 0.1*keV; 87 maxKinEnergy = 100.0*CLHEP::TeV; << 112 maxKinEnergy = 10.0*TeV; >> 113 nLambdaBins = 77; >> 114 minKinEnergyPrim = DBL_MAX; 88 115 89 // default lambda factor 116 // default lambda factor 90 invLambdaFactor = 1.0/lambdaFactor; << 117 lambdaFactor = 0.8; >> 118 >> 119 // default limit on polar angle >> 120 polarAngleLimit = 0.0; >> 121 biasFactor = 1.0; 91 122 92 // particle types 123 // particle types 93 theGamma = G4Gamma::Gamma(); << 124 theGamma = G4Gamma::Gamma(); 94 theElectron = G4Electron::Electron(); << 125 theElectron = G4Electron::Electron(); 95 thePositron = G4Positron::Positron(); << 126 thePositron = G4Positron::Positron(); 96 127 97 pParticleChange = &fParticleChange; 128 pParticleChange = &fParticleChange; 98 fParticleChange.SetSecondaryWeightByProcess( 129 fParticleChange.SetSecondaryWeightByProcess(true); 99 secParticles.reserve(5); 130 secParticles.reserve(5); 100 131 >> 132 preStepLambda = 0.0; >> 133 mfpKinEnergy = DBL_MAX; >> 134 >> 135 idxLambda = idxLambdaPrim = 0; >> 136 101 modelManager = new G4EmModelManager(); 137 modelManager = new G4EmModelManager(); >> 138 biasManager = 0; >> 139 biasFlag = false; >> 140 weightFlag = false; 102 lManager = G4LossTableManager::Instance(); 141 lManager = G4LossTableManager::Instance(); 103 lManager->Register(this); 142 lManager->Register(this); 104 isTheMaster = lManager->IsMaster(); << 143 secID = fluoID = augerID = biasID = -1; 105 G4LossTableBuilder* bld = lManager->GetTable << 144 mainSecondaries = 100; 106 theDensityFactor = bld->GetDensityFactors(); << 145 if("phot" == GetProcessName() || "compt" == GetProcessName()) { 107 theDensityIdx = bld->GetCoupleIndexes(); << 146 mainSecondaries = 1; >> 147 } 108 } 148 } 109 149 110 //....oooOO0OOooo........oooOO0OOooo........oo 150 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 111 151 112 G4VEmProcess::~G4VEmProcess() 152 G4VEmProcess::~G4VEmProcess() 113 { 153 { 114 if(isTheMaster) { << 154 if(1 < verboseLevel) { 115 delete theData; << 155 G4cout << "G4VEmProcess destruct " << GetProcessName() 116 delete theEnergyOfCrossSectionMax; << 156 << " " << this << " " << theLambdaTable <<G4endl; >> 157 } >> 158 if(lManager->IsMaster()) { >> 159 delete theLambdaTable; >> 160 delete theLambdaTablePrim; 117 } 161 } 118 delete modelManager; 162 delete modelManager; 119 delete biasManager; 163 delete biasManager; 120 lManager->DeRegister(this); 164 lManager->DeRegister(this); >> 165 //G4cout << "G4VEmProcess removed " << G4endl; 121 } 166 } 122 167 123 //....oooOO0OOooo........oooOO0OOooo........oo 168 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 124 169 125 void G4VEmProcess::AddEmModel(G4int order, G4V << 170 void G4VEmProcess::Clear() 126 const G4Region* << 127 { 171 { 128 if(nullptr == ptr) { return; } << 172 currentCouple = 0; 129 G4VEmFluctuationModel* fm = nullptr; << 173 preStepLambda = 0.0; 130 modelManager->AddEmModel(order, ptr, fm, reg << 174 mfpKinEnergy = DBL_MAX; 131 ptr->SetParticleChange(pParticleChange); << 175 idxLambda = idxLambdaPrim = 0; 132 } 176 } 133 177 134 //....oooOO0OOooo........oooOO0OOooo........oo 178 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 135 179 136 void G4VEmProcess::SetEmModel(G4VEmModel* ptr, << 180 G4double G4VEmProcess::MinPrimaryEnergy(const G4ParticleDefinition*, >> 181 const G4Material*) 137 { 182 { 138 if(nullptr == ptr) { return; } << 183 return 0.0; 139 if(!emModels.empty()) { << 184 } 140 for(auto & em : emModels) { if(em == ptr) << 185 141 } << 186 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 142 emModels.push_back(ptr); << 187 >> 188 void G4VEmProcess::AddEmModel(G4int order, G4VEmModel* p, >> 189 const G4Region* region) >> 190 { >> 191 G4VEmFluctuationModel* fm = 0; >> 192 modelManager->AddEmModel(order, p, fm, region); >> 193 if(p) { p->SetParticleChange(pParticleChange); } >> 194 } >> 195 >> 196 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 197 >> 198 void G4VEmProcess::SetEmModel(G4VEmModel* p, G4int index) >> 199 { >> 200 G4int n = emModels.size(); >> 201 if(index >= n) { for(G4int i=n; i<=index; ++i) {emModels.push_back(0);} } >> 202 emModels[index] = p; >> 203 } >> 204 >> 205 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 206 >> 207 G4VEmModel* G4VEmProcess::EmModel(G4int index) const >> 208 { >> 209 G4VEmModel* p = 0; >> 210 if(index >= 0 && index < G4int(emModels.size())) { p = emModels[index]; } >> 211 return p; >> 212 } >> 213 >> 214 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 215 >> 216 void G4VEmProcess::UpdateEmModel(const G4String& nam, >> 217 G4double emin, G4double emax) >> 218 { >> 219 modelManager->UpdateEmModel(nam, emin, emax); >> 220 } >> 221 >> 222 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 223 >> 224 G4VEmModel* G4VEmProcess::GetModelByIndex(G4int idx, G4bool ver) const >> 225 { >> 226 return modelManager->GetModel(idx, ver); 143 } 227 } 144 228 145 //....oooOO0OOooo........oooOO0OOooo........oo 229 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 146 230 147 void G4VEmProcess::PreparePhysicsTable(const G 231 void G4VEmProcess::PreparePhysicsTable(const G4ParticleDefinition& part) 148 { 232 { 149 if(nullptr == particle) { SetParticle(&part) << 233 G4bool isMaster = false; >> 234 if(GetMasterProcess() == this) { isMaster = true; } >> 235 if(!particle) { SetParticle(&part); } 150 236 151 if(part.GetParticleType() == "nucleus" && 237 if(part.GetParticleType() == "nucleus" && 152 part.GetParticleSubType() == "generic") { 238 part.GetParticleSubType() == "generic") { 153 239 154 G4String pname = part.GetParticleName(); 240 G4String pname = part.GetParticleName(); 155 if(pname != "deuteron" && pname != "triton 241 if(pname != "deuteron" && pname != "triton" && 156 pname != "He3" && pname != "alpha" && p << 242 pname != "alpha" && pname != "He3" && 157 pname != "helium" && pname != "hydrogen << 243 pname != "alpha+" && pname != "helium" && >> 244 pname != "hydrogen") { 158 245 159 particle = G4GenericIon::GenericIon(); 246 particle = G4GenericIon::GenericIon(); 160 isIon = true; << 161 } 247 } 162 } 248 } >> 249 >> 250 if(1 < verboseLevel) { >> 251 G4cout << "G4VEmProcess::PreparePhysicsTable() for " >> 252 << GetProcessName() >> 253 << " and particle " << part.GetParticleName() >> 254 << " local particle " << particle->GetParticleName() >> 255 << G4endl; >> 256 } >> 257 163 if(particle != &part) { return; } 258 if(particle != &part) { return; } 164 259 165 lManager->PreparePhysicsTable(&part, this); << 260 G4LossTableBuilder* bld = lManager->GetTableBuilder(); 166 261 167 // for new run << 262 lManager->PreparePhysicsTable(&part, this, isMaster); 168 currentCouple = nullptr; << 169 preStepLambda = 0.0; << 170 fLambdaEnergy = 0.0; << 171 263 >> 264 Clear(); 172 InitialiseProcess(particle); 265 InitialiseProcess(particle); 173 266 174 G4LossTableBuilder* bld = lManager->GetTable << 175 const G4ProductionCutsTable* theCoupleTable= 267 const G4ProductionCutsTable* theCoupleTable= 176 G4ProductionCutsTable::GetProductionCutsTa 268 G4ProductionCutsTable::GetProductionCutsTable(); >> 269 size_t n = theCoupleTable->GetTableSize(); >> 270 >> 271 theEnergyOfCrossSectionMax.resize(n, 0.0); >> 272 theCrossSectionMax.resize(n, DBL_MAX); >> 273 >> 274 // initialisation of models >> 275 numberOfModels = modelManager->NumberOfModels(); >> 276 for(G4int i=0; i<numberOfModels; ++i) { >> 277 G4VEmModel* mod = modelManager->GetModel(i); >> 278 if(0 == i) { currentModel = mod; } >> 279 mod->SetPolarAngleLimit(polarAngleLimit); >> 280 mod->SetMasterThread(isMaster); >> 281 if(mod->HighEnergyLimit() > maxKinEnergy) { >> 282 mod->SetHighEnergyLimit(maxKinEnergy); >> 283 } >> 284 } >> 285 >> 286 if(lManager->AtomDeexcitation()) { modelManager->SetFluoFlag(true); } >> 287 theCuts = modelManager->Initialise(particle,secondaryParticle, >> 288 2.,verboseLevel); 177 theCutsGamma = theCoupleTable->GetEnergyC 289 theCutsGamma = theCoupleTable->GetEnergyCutsVector(idxG4GammaCut); 178 theCutsElectron = theCoupleTable->GetEnergyC 290 theCutsElectron = theCoupleTable->GetEnergyCutsVector(idxG4ElectronCut); 179 theCutsPositron = theCoupleTable->GetEnergyC 291 theCutsPositron = theCoupleTable->GetEnergyCutsVector(idxG4PositronCut); 180 292 181 // initialisation of the process << 182 if(!actMinKinEnergy) { minKinEnergy = thePar << 183 if(!actMaxKinEnergy) { maxKinEnergy = thePar << 184 << 185 applyCuts = theParameters->ApplyCuts() << 186 lambdaFactor = theParameters->LambdaFacto << 187 invLambdaFactor = 1.0/lambdaFactor; << 188 theParameters->DefineRegParamForEM(this); << 189 << 190 // integral option may be disabled << 191 if(!theParameters->Integral()) { fXSType = f << 192 << 193 // prepare tables 293 // prepare tables 194 if(isTheMaster) { << 294 if(buildLambdaTable && isMaster){ 195 if(nullptr == theData) { theData = new G4E << 295 theLambdaTable = 196 << 296 G4PhysicsTableHelper::PreparePhysicsTable(theLambdaTable); 197 if(buildLambdaTable) { << 297 bld->InitialiseBaseMaterials(theLambdaTable); 198 theLambdaTable = theData->MakeTable(0); << 298 } 199 bld->InitialiseBaseMaterials(theLambdaTa << 299 // high energy table 200 } << 300 if(isMaster && minKinEnergyPrim < maxKinEnergy){ 201 // high energy table << 301 theLambdaTablePrim = 202 if(minKinEnergyPrim < maxKinEnergy) { << 302 G4PhysicsTableHelper::PreparePhysicsTable(theLambdaTablePrim); 203 theLambdaTablePrim = theData->MakeTable( << 303 bld->InitialiseBaseMaterials(theLambdaTablePrim); 204 bld->InitialiseBaseMaterials(theLambdaTa << 205 } << 206 } << 207 // models << 208 baseMat = bld->GetBaseMaterialFlag(); << 209 numberOfModels = modelManager->NumberOfModel << 210 currentModel = modelManager->GetModel(0); << 211 if(nullptr != lManager->AtomDeexcitation()) << 212 modelManager->SetFluoFlag(true); << 213 } 304 } 214 // forced biasing 305 // forced biasing 215 if(nullptr != biasManager) { << 306 if(biasManager) { 216 biasManager->Initialise(part, GetProcessNa << 307 biasManager->Initialise(part,GetProcessName(),verboseLevel); 217 biasFlag = false; << 308 biasFlag = false; >> 309 } >> 310 // defined ID of secondary particles >> 311 if(isMaster) { >> 312 G4String nam1 = GetProcessName(); >> 313 G4String nam2 = nam1 + "_fluo" ; >> 314 G4String nam3 = nam1 + "_auger"; >> 315 G4String nam4 = nam1 + "_split"; >> 316 secID = G4PhysicsModelCatalog::Register(nam1); >> 317 fluoID = G4PhysicsModelCatalog::Register(nam2); >> 318 augerID = G4PhysicsModelCatalog::Register(nam3); >> 319 biasID = G4PhysicsModelCatalog::Register(nam4); 218 } 320 } 219 << 220 theCuts = << 221 G4EmTableUtil::PrepareEmProcess(this, part << 222 modelManag << 223 secID, tri << 224 verboseLev << 225 } 321 } 226 322 227 //....oooOO0OOooo........oooOO0OOooo........oo 323 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 228 324 229 void G4VEmProcess::BuildPhysicsTable(const G4P 325 void G4VEmProcess::BuildPhysicsTable(const G4ParticleDefinition& part) 230 { 326 { 231 if(nullptr == masterProc) { << 327 const G4VEmProcess* masterProc = 0; 232 if(isTheMaster) { masterProc = this; } << 328 if(GetMasterProcess() != this) { 233 else { masterProc = static_cast<const G4VE << 329 masterProc = static_cast<const G4VEmProcess*>(GetMasterProcess()); 234 } << 330 } 235 G4int nModels = modelManager->NumberOfModels << 331 236 G4bool isLocked = theParameters->IsPrintLock << 332 G4String num = part.GetParticleName(); 237 G4bool toBuild = (buildLambdaTable || minKin << 333 if(1 < verboseLevel) { 238 << 334 G4cout << "G4VEmProcess::BuildPhysicsTable() for " 239 G4EmTableUtil::BuildEmProcess(this, masterPr << 335 << GetProcessName() 240 nModels, verbo << 336 << " and particle " << num 241 isLocked, toBu << 337 << " buildLambdaTable= " << buildLambdaTable >> 338 << G4endl; >> 339 } >> 340 >> 341 if(particle == &part) { >> 342 >> 343 G4LossTableBuilder* bld = lManager->GetTableBuilder(); >> 344 >> 345 // worker initialisation >> 346 if(masterProc) { >> 347 theLambdaTable = masterProc->LambdaTable(); >> 348 theLambdaTablePrim = masterProc->LambdaTablePrim(); >> 349 >> 350 if(theLambdaTable) { >> 351 bld->InitialiseBaseMaterials(theLambdaTable); >> 352 } else if(theLambdaTablePrim) { >> 353 bld->InitialiseBaseMaterials(theLambdaTablePrim); >> 354 } >> 355 theDensityFactor = bld->GetDensityFactors(); >> 356 theDensityIdx = bld->GetCoupleIndexes(); >> 357 if(theLambdaTable) { FindLambdaMax(); } >> 358 >> 359 // local initialisation of models >> 360 G4bool printing = true; >> 361 numberOfModels = modelManager->NumberOfModels(); >> 362 for(G4int i=0; i<numberOfModels; ++i) { >> 363 G4VEmModel* mod = GetModelByIndex(i, printing); >> 364 G4VEmModel* mod0= masterProc->GetModelByIndex(i, printing); >> 365 mod->InitialiseLocal(particle, mod0); >> 366 } >> 367 // master thread >> 368 } else { >> 369 theDensityFactor = bld->GetDensityFactors(); >> 370 theDensityIdx = bld->GetCoupleIndexes(); >> 371 if(buildLambdaTable || minKinEnergyPrim < maxKinEnergy) { >> 372 BuildLambdaTable(); >> 373 } >> 374 } >> 375 } >> 376 >> 377 // explicitly defined printout by particle name >> 378 if(1 < verboseLevel || >> 379 (0 < verboseLevel && (num == "gamma" || num == "e-" || >> 380 num == "e+" || num == "mu+" || >> 381 num == "mu-" || num == "proton"|| >> 382 num == "pi+" || num == "pi-" || >> 383 num == "kaon+" || num == "kaon-" || >> 384 num == "alpha" || num == "anti_proton" || >> 385 num == "GenericIon"))) >> 386 { >> 387 PrintInfoProcess(part); >> 388 } >> 389 >> 390 if(1 < verboseLevel) { >> 391 G4cout << "G4VEmProcess::BuildPhysicsTable() done for " >> 392 << GetProcessName() >> 393 << " and particle " << num >> 394 << G4endl; >> 395 } 242 } 396 } 243 397 244 //....oooOO0OOooo........oooOO0OOooo........oo 398 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 245 399 246 void G4VEmProcess::BuildLambdaTable() 400 void G4VEmProcess::BuildLambdaTable() 247 { 401 { 248 G4double scale = theParameters->MaxKinEnergy << 402 if(1 < verboseLevel) { 249 G4int nbin = << 403 G4cout << "G4EmProcess::BuildLambdaTable() for process " 250 theParameters->NumberOfBinsPerDecade()*G4l << 404 << GetProcessName() << " and particle " 251 if(actBinning) { nbin = std::max(nbin, nLamb << 405 << particle->GetParticleName() << " " << this 252 scale = nbin/G4Log(scale); << 406 << G4endl; 253 << 407 } >> 408 >> 409 // Access to materials >> 410 const G4ProductionCutsTable* theCoupleTable= >> 411 G4ProductionCutsTable::GetProductionCutsTable(); >> 412 size_t numOfCouples = theCoupleTable->GetTableSize(); >> 413 254 G4LossTableBuilder* bld = lManager->GetTable 414 G4LossTableBuilder* bld = lManager->GetTableBuilder(); 255 G4EmTableUtil::BuildLambdaTable(this, partic << 415 256 bld, theLamb << 416 G4PhysicsLogVector* aVector = 0; 257 minKinEnergy << 417 G4PhysicsLogVector* aVectorPrim = 0; 258 maxKinEnergy << 418 G4PhysicsLogVector* bVectorPrim = 0; 259 startFromNul << 419 >> 420 G4double scale = G4Log(maxKinEnergy/minKinEnergy); >> 421 G4double emax1 = maxKinEnergy; >> 422 if(minKinEnergyPrim < maxKinEnergy) { emax1 = minKinEnergyPrim; } >> 423 >> 424 for(size_t i=0; i<numOfCouples; ++i) { >> 425 >> 426 if (bld->GetFlag(i)) { >> 427 >> 428 // create physics vector and fill it >> 429 const G4MaterialCutsCouple* couple = >> 430 theCoupleTable->GetMaterialCutsCouple(i); >> 431 >> 432 // build main table >> 433 if(buildLambdaTable) { >> 434 delete (*theLambdaTable)[i]; >> 435 >> 436 // if start from zero then change the scale >> 437 G4double emin = minKinEnergy; >> 438 G4bool startNull = false; >> 439 if(startFromNull) { >> 440 G4double e = MinPrimaryEnergy(particle,couple->GetMaterial()); >> 441 if(e >= emin) { >> 442 emin = e; >> 443 startNull = true; >> 444 } >> 445 } >> 446 G4double emax = emax1; >> 447 if(emax <= emin) { emax = 2*emin; } >> 448 G4int bin = G4lrint(nLambdaBins*G4Log(emax/emin)/scale); >> 449 if(bin < 3) { bin = 3; } >> 450 aVector = new G4PhysicsLogVector(emin, emax, bin); >> 451 aVector->SetSpline(splineFlag); >> 452 modelManager->FillLambdaVector(aVector, couple, startNull); >> 453 if(splineFlag) { aVector->FillSecondDerivatives(); } >> 454 G4PhysicsTableHelper::SetPhysicsVector(theLambdaTable, i, aVector); >> 455 } >> 456 // build high energy table >> 457 if(minKinEnergyPrim < maxKinEnergy) { >> 458 delete (*theLambdaTablePrim)[i]; >> 459 >> 460 // start not from zero >> 461 if(!bVectorPrim) { >> 462 G4int bin = >> 463 G4lrint(nLambdaBins*G4Log(maxKinEnergy/minKinEnergyPrim)/scale); >> 464 if(bin < 3) { bin = 3; } >> 465 aVectorPrim = >> 466 new G4PhysicsLogVector(minKinEnergyPrim, maxKinEnergy, bin); >> 467 bVectorPrim = aVectorPrim; >> 468 } else { >> 469 aVectorPrim = new G4PhysicsLogVector(*bVectorPrim); >> 470 } >> 471 // always use spline >> 472 aVectorPrim->SetSpline(true); >> 473 modelManager->FillLambdaVector(aVectorPrim, couple, false, >> 474 fIsCrossSectionPrim); >> 475 aVectorPrim->FillSecondDerivatives(); >> 476 G4PhysicsTableHelper::SetPhysicsVector(theLambdaTablePrim, i, >> 477 aVectorPrim); >> 478 } >> 479 } >> 480 } >> 481 >> 482 if(buildLambdaTable) { FindLambdaMax(); } >> 483 >> 484 if(1 < verboseLevel) { >> 485 G4cout << "Lambda table is built for " >> 486 << particle->GetParticleName() >> 487 << G4endl; >> 488 } 260 } 489 } 261 490 262 //....oooOO0OOooo........oooOO0OOooo........oo 491 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 263 492 264 void G4VEmProcess::StreamInfo(std::ostream& ou << 493 void G4VEmProcess::PrintInfoProcess(const G4ParticleDefinition& part) 265 const G4ParticleDefinition& << 494 { 266 { << 495 if(verboseLevel > 0) { 267 G4String indent = (rst ? " " : ""); << 496 G4cout << G4endl << GetProcessName() << ": for " 268 out << std::setprecision(6); << 497 << part.GetParticleName(); 269 out << G4endl << indent << GetProcessName() << 498 if(integral) { G4cout << ", integral: 1 "; } 270 if (!rst) { << 499 if(applyCuts) { G4cout << ", applyCuts: 1 "; } 271 out << " for " << part.GetParticleName(); << 500 G4cout << " SubType= " << GetProcessSubType();; 272 } << 501 if(biasFactor != 1.0) { G4cout << " BiasingFactor= " << biasFactor; } 273 if(fXSType != fEmNoIntegral) { out << " XSt << 502 G4cout << G4endl; 274 if(applyCuts) { out << " applyCuts:1 "; } << 503 if(buildLambdaTable) { 275 G4int subtype = GetProcessSubType(); << 504 size_t length = theLambdaTable->length(); 276 out << " SubType=" << subtype; << 505 for(size_t i=0; i<length; ++i) { 277 if (subtype == fAnnihilation) { << 506 G4PhysicsVector* v = (*theLambdaTable)[i]; 278 G4int mod = theParameters->PositronAtRestM << 507 if(v) { 279 const G4String namp[2] = {"Simple", "Allis << 508 G4cout << " Lambda table from " 280 out << " AtRestModel:" << namp[mod]; << 509 << G4BestUnit(minKinEnergy,"Energy") 281 } << 510 << " to " 282 if(biasFactor != 1.0) { out << " BiasingFac << 511 << G4BestUnit(v->GetMaxEnergy(),"Energy") 283 out << " BuildTable=" << buildLambdaTable << << 512 << " in " << v->GetVectorLength()-1 284 if(buildLambdaTable) { << 513 << " bins, spline: " 285 if(particle == &part) { << 514 << splineFlag 286 for(auto & v : *theLambdaTable) { << 515 << G4endl; 287 if(nullptr != v) { << 516 break; 288 out << " Lambda table from "; << 517 } 289 G4double emin = v->Energy(0); << 290 G4double emax = v->GetMaxEnergy(); << 291 G4int nbin = G4int(v->GetVectorLengt << 292 if(emin > minKinEnergy) { out << "th << 293 else { out << G4BestUnit(emin,"Energ << 294 out << " to " << 295 << G4BestUnit(emax,"Energy") << 296 << ", " << G4lrint(nbin/std::log << 297 << " bins/decade, spline: " << 298 << splineFlag << G4endl; << 299 break; << 300 } << 301 } 518 } 302 } else { << 303 out << " Used Lambda table of " << 304 << particle->GetParticleName() << G4endl << 305 } 519 } 306 } << 520 if(minKinEnergyPrim < maxKinEnergy) { 307 if(minKinEnergyPrim < maxKinEnergy) { << 521 size_t length = theLambdaTablePrim->length(); 308 if(particle == &part) { << 522 for(size_t i=0; i<length; ++i) { 309 for(auto & v : *theLambdaTablePrim) { << 523 G4PhysicsVector* v = (*theLambdaTablePrim)[i]; 310 if(nullptr != v) { << 524 if(v) { 311 out << " LambdaPrime table from << 525 G4cout << " LambdaPrime table from " 312 << G4BestUnit(v->Energy(0),"Ener << 526 << G4BestUnit(minKinEnergyPrim,"Energy") 313 << " to " << 527 << " to " 314 << G4BestUnit(v->GetMaxEnergy(), << 528 << G4BestUnit(maxKinEnergy,"Energy") 315 << " in " << v->GetVectorLength( << 529 << " in " << v->GetVectorLength()-1 316 << " bins " << G4endl; << 530 << " bins " 317 break; << 531 << G4endl; 318 } << 532 break; >> 533 } 319 } 534 } 320 } else { << 321 out << " Used LambdaPrime table of << 322 << particle->GetParticleName() << 323 } 535 } >> 536 PrintInfo(); >> 537 modelManager->DumpModelList(verboseLevel); 324 } 538 } 325 StreamProcessInfo(out); << 326 modelManager->DumpModelList(out, verboseLeve << 327 539 328 if(verboseLevel > 2 && buildLambdaTable) { 540 if(verboseLevel > 2 && buildLambdaTable) { 329 out << " LambdaTable address= " << th << 541 G4cout << " LambdaTable address= " << theLambdaTable << G4endl; 330 if(theLambdaTable && particle == &part) { << 542 if(theLambdaTable) { G4cout << (*theLambdaTable) << G4endl; } 331 out << (*theLambdaTable) << G4endl; << 332 } << 333 } 543 } 334 } 544 } 335 545 336 //....oooOO0OOooo........oooOO0OOooo........oo 546 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 337 547 338 void G4VEmProcess::StartTracking(G4Track* trac 548 void G4VEmProcess::StartTracking(G4Track* track) 339 { 549 { 340 // reset parameters for the new track 550 // reset parameters for the new track 341 currentParticle = track->GetParticleDefiniti 551 currentParticle = track->GetParticleDefinition(); 342 theNumberOfInteractionLengthLeft = -1.0; 552 theNumberOfInteractionLengthLeft = -1.0; 343 mfpKinEnergy = DBL_MAX; << 553 //currentInteractionLength = -1.0; 344 preStepLambda = 0.0; << 554 // theInitialNumberOfInteractionLength=-1.0; 345 << 555 mfpKinEnergy = DBL_MAX; 346 if(isIon) { massRatio = proton_mass_c2/curre << 347 556 348 // forced biasing only for primary particles 557 // forced biasing only for primary particles 349 if(biasManager) { 558 if(biasManager) { 350 if(0 == track->GetParentID()) { 559 if(0 == track->GetParentID()) { 351 // primary particle 560 // primary particle 352 biasFlag = true; 561 biasFlag = true; 353 biasManager->ResetForcedInteraction(); 562 biasManager->ResetForcedInteraction(); 354 } 563 } 355 } 564 } 356 } 565 } 357 566 358 //....oooOO0OOooo........oooOO0OOooo........oo 567 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 359 568 360 G4double G4VEmProcess::PostStepGetPhysicalInte 569 G4double G4VEmProcess::PostStepGetPhysicalInteractionLength( 361 const G4Track& tr 570 const G4Track& track, 362 G4double previo 571 G4double previousStepSize, 363 G4ForceCondition* 572 G4ForceCondition* condition) 364 { 573 { 365 *condition = NotForced; 574 *condition = NotForced; 366 G4double x = DBL_MAX; 575 G4double x = DBL_MAX; 367 576 368 DefineMaterial(track.GetMaterialCutsCouple() << 369 preStepKinEnergy = track.GetKineticEnergy(); 577 preStepKinEnergy = track.GetKineticEnergy(); 370 const G4double scaledEnergy = preStepKinEner << 578 DefineMaterial(track.GetMaterialCutsCouple()); 371 SelectModel(scaledEnergy, currentCoupleIndex << 579 SelectModel(preStepKinEnergy, currentCoupleIndex); 372 /* << 580 373 G4cout << "PostStepGetPhysicalInteractionLen << 581 if(!currentModel->IsActive(preStepKinEnergy)) { 374 << " couple: " << currentCouple << G << 375 */ << 376 if(!currentModel->IsActive(scaledEnergy)) { << 377 theNumberOfInteractionLengthLeft = -1.0; << 378 currentInteractionLength = DBL_MAX; 582 currentInteractionLength = DBL_MAX; 379 mfpKinEnergy = DBL_MAX; << 380 preStepLambda = 0.0; << 381 return x; 583 return x; 382 } 584 } 383 585 384 // forced biasing only for primary particles 586 // forced biasing only for primary particles 385 if(biasManager) { 587 if(biasManager) { 386 if(0 == track.GetParentID()) { 588 if(0 == track.GetParentID()) { 387 if(biasFlag && 589 if(biasFlag && 388 biasManager->ForcedInteractionRegion( << 590 biasManager->ForcedInteractionRegion(currentCoupleIndex)) { 389 return biasManager->GetStepLimit((G4in << 591 return biasManager->GetStepLimit(currentCoupleIndex, previousStepSize); 390 } 592 } 391 } 593 } 392 } 594 } 393 595 394 // compute mean free path 596 // compute mean free path >> 597 if(preStepKinEnergy < mfpKinEnergy) { >> 598 if (integral) { ComputeIntegralLambda(preStepKinEnergy); } >> 599 else { preStepLambda = GetCurrentLambda(preStepKinEnergy); } >> 600 >> 601 // zero cross section >> 602 if(preStepLambda <= 0.0) { >> 603 theNumberOfInteractionLengthLeft = -1.0; >> 604 currentInteractionLength = DBL_MAX; >> 605 } >> 606 } 395 607 396 ComputeIntegralLambda(preStepKinEnergy, trac << 608 // non-zero cross section 397 << 609 if(preStepLambda > 0.0) { 398 // zero cross section << 399 if(preStepLambda <= 0.0) { << 400 theNumberOfInteractionLengthLeft = -1.0; << 401 currentInteractionLength = DBL_MAX; << 402 << 403 } else { << 404 610 405 // non-zero cross section << 406 if (theNumberOfInteractionLengthLeft < 0.0 611 if (theNumberOfInteractionLengthLeft < 0.0) { 407 612 408 // beggining of tracking (or just after 613 // beggining of tracking (or just after DoIt of this process) 409 theNumberOfInteractionLengthLeft = -G4Lo << 614 // ResetNumberOfInteractionLengthLeft(); >> 615 >> 616 theNumberOfInteractionLengthLeft = -G4Log( G4UniformRand() ); 410 theInitialNumberOfInteractionLength = th 617 theInitialNumberOfInteractionLength = theNumberOfInteractionLengthLeft; 411 618 412 } else { << 619 } else if(currentInteractionLength < DBL_MAX) { 413 620 >> 621 // subtract NumberOfInteractionLengthLeft using previous step 414 theNumberOfInteractionLengthLeft -= 622 theNumberOfInteractionLengthLeft -= 415 previousStepSize/currentInteractionLen << 623 previousStepSize/currentInteractionLength; 416 theNumberOfInteractionLengthLeft = << 624 //SubtractNumberOfInteractionLengthLeft(previousStepSize); 417 std::max(theNumberOfInteractionLengthL << 625 if(theNumberOfInteractionLengthLeft < 0.) { >> 626 theNumberOfInteractionLengthLeft = 0.0; >> 627 } 418 } 628 } 419 629 420 // new mean free path and step limit for t 630 // new mean free path and step limit for the next step 421 currentInteractionLength = 1.0/preStepLamb 631 currentInteractionLength = 1.0/preStepLambda; 422 x = theNumberOfInteractionLengthLeft * cur 632 x = theNumberOfInteractionLengthLeft * currentInteractionLength; 423 } << 633 #ifdef G4VERBOSE 424 return x; << 634 if (verboseLevel>2){ 425 } << 635 G4cout << "G4VEmProcess::PostStepGetPhysicalInteractionLength "; 426 << 636 G4cout << "[ " << GetProcessName() << "]" << G4endl; 427 //....oooOO0OOooo........oooOO0OOooo........oo << 637 G4cout << " for " << currentParticle->GetParticleName() 428 << 638 << " in Material " << currentMaterial->GetName() 429 void G4VEmProcess::ComputeIntegralLambda(G4dou << 639 << " Ekin(MeV)= " << preStepKinEnergy/MeV 430 { << 640 <<G4endl; 431 if (fXSType == fEmNoIntegral) { << 641 G4cout << " MeanFreePath = " << currentInteractionLength/cm << "[cm]" 432 preStepLambda = GetCurrentLambda(e, LogEki << 642 << " InteractionLength= " << x/cm <<"[cm] " <<G4endl; 433 << 434 } else if (fXSType == fEmIncreasing) { << 435 if(e*invLambdaFactor < mfpKinEnergy) { << 436 preStepLambda = GetCurrentLambda(e, LogE << 437 mfpKinEnergy = (preStepLambda > 0.0) ? e << 438 } << 439 << 440 } else if(fXSType == fEmDecreasing) { << 441 if(e < mfpKinEnergy) { << 442 const G4double e1 = e*lambdaFactor; << 443 preStepLambda = GetCurrentLambda(e1); << 444 mfpKinEnergy = e1; << 445 } << 446 << 447 } else if(fXSType == fEmOnePeak) { << 448 const G4double epeak = (*theEnergyOfCrossS << 449 if(e <= epeak) { << 450 if(e*invLambdaFactor < mfpKinEnergy) { << 451 preStepLambda = GetCurrentLambda(e, Lo << 452 mfpKinEnergy = (preStepLambda > 0.0) ? << 453 } << 454 } else if(e < mfpKinEnergy) { << 455 const G4double e1 = std::max(epeak, e*la << 456 preStepLambda = GetCurrentLambda(e1); << 457 mfpKinEnergy = e1; << 458 } 643 } 459 } else { << 644 #endif 460 preStepLambda = GetCurrentLambda(e, LogEki << 461 } 645 } >> 646 return x; 462 } 647 } 463 648 464 //....oooOO0OOooo........oooOO0OOooo........oo 649 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 465 650 466 G4VParticleChange* G4VEmProcess::PostStepDoIt( 651 G4VParticleChange* G4VEmProcess::PostStepDoIt(const G4Track& track, 467 652 const G4Step& step) 468 { 653 { 469 // clear number of interaction lengths in an << 654 // In all cases clear number of interaction lengths 470 theNumberOfInteractionLengthLeft = -1.0; 655 theNumberOfInteractionLengthLeft = -1.0; 471 mfpKinEnergy = DBL_MAX; << 656 mfpKinEnergy = DBL_MAX; 472 657 473 fParticleChange.InitializeForPostStep(track) 658 fParticleChange.InitializeForPostStep(track); 474 659 475 // Do not make anything if particle is stopp 660 // Do not make anything if particle is stopped, the annihilation then 476 // should be performed by the AtRestDoIt! 661 // should be performed by the AtRestDoIt! 477 if (track.GetTrackStatus() == fStopButAlive) 662 if (track.GetTrackStatus() == fStopButAlive) { return &fParticleChange; } 478 663 479 const G4double finalT = track.GetKineticEner << 664 G4double finalT = track.GetKineticEnergy(); 480 665 481 // forced process - should happen only once 666 // forced process - should happen only once per track 482 if(biasFlag) { 667 if(biasFlag) { 483 if(biasManager->ForcedInteractionRegion((G << 668 if(biasManager->ForcedInteractionRegion(currentCoupleIndex)) { 484 biasFlag = false; 669 biasFlag = false; 485 } 670 } 486 } 671 } 487 672 488 // check active and select model << 489 const G4double scaledEnergy = finalT*massRat << 490 SelectModel(scaledEnergy, currentCoupleIndex << 491 if(!currentModel->IsActive(scaledEnergy)) { << 492 << 493 // Integral approach 673 // Integral approach 494 if (fXSType != fEmNoIntegral) { << 674 if (integral) { 495 const G4double logFinalT = << 675 G4double lx = GetLambda(finalT, currentCouple); 496 track.GetDynamicParticle()->GetLogKineti << 676 if(preStepLambda<lx && 1 < verboseLevel) { 497 const G4double lx = std::max(GetCurrentLam << 498 #ifdef G4VERBOSE << 499 if(preStepLambda < lx && 1 < verboseLevel) << 500 G4cout << "WARNING: for " << currentPart 677 G4cout << "WARNING: for " << currentParticle->GetParticleName() 501 << " and " << GetProcessName() << << 678 << " and " << GetProcessName() 502 << " preLambda= " << preStepLambd << 679 << " E(MeV)= " << finalT/MeV 503 << " < " << lx << " (postLambda) << 680 << " preLambda= " << preStepLambda << " < " >> 681 << lx << " (postLambda) " >> 682 << G4endl; 504 } 683 } 505 #endif << 684 506 // if false interaction then use new cross << 685 if(preStepLambda*G4UniformRand() > lx) { 507 // if both values are zero - no interactio << 686 ClearNumberOfInteractionLengthLeft(); 508 if(preStepLambda*G4UniformRand() >= lx) { << 509 return &fParticleChange; 687 return &fParticleChange; 510 } 688 } 511 } 689 } 512 690 >> 691 SelectModel(finalT, currentCoupleIndex); >> 692 if(!currentModel->IsActive(finalT)) { return &fParticleChange; } >> 693 513 // define new weight for primary and seconda 694 // define new weight for primary and secondaries 514 G4double weight = fParticleChange.GetParentW 695 G4double weight = fParticleChange.GetParentWeight(); 515 if(weightFlag) { 696 if(weightFlag) { 516 weight /= biasFactor; 697 weight /= biasFactor; 517 fParticleChange.ProposeWeight(weight); 698 fParticleChange.ProposeWeight(weight); 518 } 699 } 519 700 520 #ifdef G4VERBOSE << 701 /* 521 if(1 < verboseLevel) { << 702 if(0 < verboseLevel) { 522 G4cout << "G4VEmProcess::PostStepDoIt: Sam 703 G4cout << "G4VEmProcess::PostStepDoIt: Sample secondary; E= " 523 << finalT/MeV 704 << finalT/MeV 524 << " MeV; model= (" << currentModel 705 << " MeV; model= (" << currentModel->LowEnergyLimit() 525 << ", " << currentModel->HighEnerg 706 << ", " << currentModel->HighEnergyLimit() << ")" 526 << G4endl; 707 << G4endl; 527 } 708 } 528 #endif << 709 */ 529 710 530 // sample secondaries 711 // sample secondaries 531 secParticles.clear(); 712 secParticles.clear(); 532 currentModel->SampleSecondaries(&secParticle 713 currentModel->SampleSecondaries(&secParticles, 533 currentCoupl << 714 currentCouple, 534 track.GetDyn << 715 track.GetDynamicParticle(), 535 (*theCuts)[c << 716 (*theCuts)[currentCoupleIndex]); 536 717 537 G4int num0 = (G4int)secParticles.size(); << 718 G4int num0 = secParticles.size(); 538 719 539 // splitting or Russian roulette 720 // splitting or Russian roulette 540 if(biasManager) { 721 if(biasManager) { 541 if(biasManager->SecondaryBiasingRegion((G4 << 722 if(biasManager->SecondaryBiasingRegion(currentCoupleIndex)) { 542 G4double eloss = 0.0; 723 G4double eloss = 0.0; 543 weight *= biasManager->ApplySecondaryBia 724 weight *= biasManager->ApplySecondaryBiasing( 544 secParticles, track, currentModel, &fP 725 secParticles, track, currentModel, &fParticleChange, eloss, 545 (G4int)currentCoupleIndex, (*theCuts)[ << 726 currentCoupleIndex, (*theCuts)[currentCoupleIndex], 546 step.GetPostStepPoint()->GetSafety()); << 727 step.GetPostStepPoint()->GetSafety()); 547 if(eloss > 0.0) { 728 if(eloss > 0.0) { 548 eloss += fParticleChange.GetLocalEnerg << 729 eloss += fParticleChange.GetLocalEnergyDeposit(); 549 fParticleChange.ProposeLocalEnergyDepo 730 fParticleChange.ProposeLocalEnergyDeposit(eloss); 550 } 731 } 551 } 732 } 552 } 733 } 553 734 554 // save secondaries 735 // save secondaries 555 G4int num = (G4int)secParticles.size(); << 736 G4int num = secParticles.size(); 556 if(num > 0) { 737 if(num > 0) { 557 738 558 fParticleChange.SetNumberOfSecondaries(num 739 fParticleChange.SetNumberOfSecondaries(num); 559 G4double edep = fParticleChange.GetLocalEn 740 G4double edep = fParticleChange.GetLocalEnergyDeposit(); 560 G4double time = track.GetGlobalTime(); 741 G4double time = track.GetGlobalTime(); 561 << 562 G4int n1(0), n2(0); << 563 if(num0 > mainSecondaries) { << 564 currentModel->FillNumberOfSecondaries(n1 << 565 } << 566 742 567 for (G4int i=0; i<num; ++i) { 743 for (G4int i=0; i<num; ++i) { 568 G4DynamicParticle* dp = secParticles[i]; << 744 if (secParticles[i]) { 569 if (nullptr != dp) { << 745 G4DynamicParticle* dp = secParticles[i]; 570 const G4ParticleDefinition* p = dp->Ge 746 const G4ParticleDefinition* p = dp->GetParticleDefinition(); 571 G4double e = dp->GetKineticEnergy(); 747 G4double e = dp->GetKineticEnergy(); 572 G4bool good = true; 748 G4bool good = true; 573 if(applyCuts) { 749 if(applyCuts) { 574 if (p == theGamma) { << 750 if (p == theGamma) { 575 if (e < (*theCutsGamma)[currentCou << 751 if (e < (*theCutsGamma)[currentCoupleIndex]) { good = false; } 576 752 577 } else if (p == theElectron) { << 753 } else if (p == theElectron) { 578 if (e < (*theCutsElectron)[current << 754 if (e < (*theCutsElectron)[currentCoupleIndex]) { good = false; } 579 755 580 } else if (p == thePositron) { << 756 } else if (p == thePositron) { 581 if (electron_mass_c2 < (*theCutsGa << 757 if (electron_mass_c2 < (*theCutsGamma)[currentCoupleIndex] && 582 e < (*theCutsPositron)[current << 758 e < (*theCutsPositron)[currentCoupleIndex]) { 583 good = false; << 759 good = false; 584 e += 2.0*electron_mass_c2; << 760 e += 2.0*electron_mass_c2; 585 } << 761 } 586 } << 762 } 587 // added secondary if it is good << 763 // added secondary if it is good 588 } 764 } 589 if (good) { 765 if (good) { 590 G4Track* t = new G4Track(dp, time, t 766 G4Track* t = new G4Track(dp, time, track.GetPosition()); 591 t->SetTouchableHandle(track.GetTouch 767 t->SetTouchableHandle(track.GetTouchableHandle()); 592 if (biasManager) { << 768 t->SetWeight(weight); 593 t->SetWeight(weight * biasManager- << 594 } else { << 595 t->SetWeight(weight); << 596 } << 597 pParticleChange->AddSecondary(t); 769 pParticleChange->AddSecondary(t); 598 770 599 // define type of secondary << 771 // define type of secondary 600 if(i < mainSecondaries) { << 772 if(i < mainSecondaries) { t->SetCreatorModelIndex(secID); } 601 t->SetCreatorModelID(secID); << 773 else if(i < num0) { 602 if(GetProcessSubType() == fCompton << 774 if(p == theGamma) { 603 t->SetCreatorModelID(_ComptonGam << 775 t->SetCreatorModelIndex(fluoID); 604 } << 776 } else { 605 } else if(i < mainSecondaries + n1) << 777 t->SetCreatorModelIndex(augerID); 606 t->SetCreatorModelID(tripletID); << 778 } 607 } else if(i < mainSecondaries + n1 + << 779 } else { 608 t->SetCreatorModelID(_IonRecoil); << 780 t->SetCreatorModelIndex(biasID); 609 } else { << 781 } 610 if(i < num0) { << 782 611 if(p == theGamma) { << 783 //G4cout << "Secondary(post step) has weight " << t->GetWeight() 612 t->SetCreatorModelID(fluoID); << 784 // << ", Ekin= " << t->GetKineticEnergy()/MeV << " MeV" <<G4endl; 613 } else { << 614 t->SetCreatorModelID(augerID); << 615 } << 616 } else { << 617 t->SetCreatorModelID(biasID); << 618 } << 619 } << 620 /* << 621 G4cout << "Secondary(post step) has << 622 << ", Ekin= " << t->GetKineti << 623 << GetProcessName() << " fluo << 624 << " augerID= " << augerID << << 625 */ << 626 } else { 785 } else { 627 delete dp; << 786 delete dp; 628 edep += e; << 787 edep += e; 629 } << 788 } 630 } 789 } 631 } 790 } 632 fParticleChange.ProposeLocalEnergyDeposit( 791 fParticleChange.ProposeLocalEnergyDeposit(edep); 633 } 792 } 634 793 635 if(0.0 == fParticleChange.GetProposedKinetic 794 if(0.0 == fParticleChange.GetProposedKineticEnergy() && 636 fAlive == fParticleChange.GetTrackStatus( 795 fAlive == fParticleChange.GetTrackStatus()) { 637 if(particle->GetProcessManager()->GetAtRes 796 if(particle->GetProcessManager()->GetAtRestProcessVector()->size() > 0) 638 { fParticleChange.ProposeTrackStatus( 797 { fParticleChange.ProposeTrackStatus(fStopButAlive); } 639 else { fParticleChange.ProposeTrackStatus( 798 else { fParticleChange.ProposeTrackStatus(fStopAndKill); } 640 } 799 } 641 800 >> 801 // ClearNumberOfInteractionLengthLeft(); 642 return &fParticleChange; 802 return &fParticleChange; 643 } 803 } 644 804 645 //....oooOO0OOooo........oooOO0OOooo........oo 805 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 646 806 647 G4bool G4VEmProcess::StorePhysicsTable(const G 807 G4bool G4VEmProcess::StorePhysicsTable(const G4ParticleDefinition* part, 648 const G << 808 const G4String& directory, 649 G4bool << 809 G4bool ascii) 650 { 810 { 651 if(!isTheMaster || part != particle) { retur << 811 G4bool yes = true; 652 if(G4EmTableUtil::StoreTable(this, part, the << 812 653 directory, "Lambda", << 813 if ( theLambdaTable && part == particle) { 654 verboseLevel, a << 814 const G4String name = 655 G4EmTableUtil::StoreTable(this, part, the << 815 GetPhysicsTableFileName(part,directory,"Lambda",ascii); 656 directory, "LambdaPrim", << 816 yes = theLambdaTable->StorePhysicsTable(name,ascii); 657 verboseLevel, a << 817 658 return true; << 818 if ( yes ) { >> 819 G4cout << "Physics table is stored for " << particle->GetParticleName() >> 820 << " and process " << GetProcessName() >> 821 << " in the directory <" << directory >> 822 << "> " << G4endl; >> 823 } else { >> 824 G4cout << "Fail to store Physics Table for " >> 825 << particle->GetParticleName() >> 826 << " and process " << GetProcessName() >> 827 << " in the directory <" << directory >> 828 << "> " << G4endl; >> 829 } 659 } 830 } 660 return false; << 831 if ( theLambdaTablePrim && part == particle) { >> 832 const G4String name = >> 833 GetPhysicsTableFileName(part,directory,"LambdaPrim",ascii); >> 834 yes = theLambdaTablePrim->StorePhysicsTable(name,ascii); >> 835 >> 836 if ( yes ) { >> 837 G4cout << "Physics table prim is stored for " >> 838 << particle->GetParticleName() >> 839 << " and process " << GetProcessName() >> 840 << " in the directory <" << directory >> 841 << "> " << G4endl; >> 842 } else { >> 843 G4cout << "Fail to store Physics Table Prim for " >> 844 << particle->GetParticleName() >> 845 << " and process " << GetProcessName() >> 846 << " in the directory <" << directory >> 847 << "> " << G4endl; >> 848 } >> 849 } >> 850 return yes; 661 } 851 } 662 852 663 //....oooOO0OOooo........oooOO0OOooo........oo 853 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 664 854 665 G4bool G4VEmProcess::RetrievePhysicsTable(cons 855 G4bool G4VEmProcess::RetrievePhysicsTable(const G4ParticleDefinition* part, 666 cons << 856 const G4String& directory, 667 G4bo << 857 G4bool ascii) 668 { 858 { 669 if(!isTheMaster || part != particle) { retur << 859 if(1 < verboseLevel) { >> 860 G4cout << "G4VEmProcess::RetrievePhysicsTable() for " >> 861 << part->GetParticleName() << " and process " >> 862 << GetProcessName() << G4endl; >> 863 } 670 G4bool yes = true; 864 G4bool yes = true; >> 865 >> 866 if((!buildLambdaTable && minKinEnergyPrim > maxKinEnergy) >> 867 || particle != part) { return yes; } >> 868 >> 869 const G4String particleName = part->GetParticleName(); >> 870 G4String filename; >> 871 671 if(buildLambdaTable) { 872 if(buildLambdaTable) { 672 yes = G4EmTableUtil::RetrieveTable(this, p << 873 filename = GetPhysicsTableFileName(part,directory,"Lambda",ascii); 673 "Lambda << 874 yes = G4PhysicsTableHelper::RetrievePhysicsTable(theLambdaTable, 674 ascii, << 875 filename,ascii); 675 } << 876 if ( yes ) { 676 if(yes && minKinEnergyPrim < maxKinEnergy) { << 877 if (0 < verboseLevel) { 677 yes = G4EmTableUtil::RetrieveTable(this, p << 878 G4cout << "Lambda table for " << particleName 678 "Lambda << 879 << " is Retrieved from <" 679 ascii, << 880 << filename << ">" >> 881 << G4endl; >> 882 } >> 883 if(lManager->SplineFlag()) { >> 884 size_t n = theLambdaTable->length(); >> 885 for(size_t i=0; i<n; ++i) { >> 886 if((* theLambdaTable)[i]) { >> 887 (* theLambdaTable)[i]->SetSpline(true); >> 888 } >> 889 } >> 890 } >> 891 } else { >> 892 if (1 < verboseLevel) { >> 893 G4cout << "Lambda table for " << particleName << " in file <" >> 894 << filename << "> is not exist" >> 895 << G4endl; >> 896 } >> 897 } >> 898 } >> 899 if(minKinEnergyPrim < maxKinEnergy) { >> 900 filename = GetPhysicsTableFileName(part,directory,"LambdaPrim",ascii); >> 901 yes = G4PhysicsTableHelper::RetrievePhysicsTable(theLambdaTablePrim, >> 902 filename,ascii); >> 903 if ( yes ) { >> 904 if (0 < verboseLevel) { >> 905 G4cout << "Lambda table prim for " << particleName >> 906 << " is Retrieved from <" >> 907 << filename << ">" >> 908 << G4endl; >> 909 } >> 910 if(lManager->SplineFlag()) { >> 911 size_t n = theLambdaTablePrim->length(); >> 912 for(size_t i=0; i<n; ++i) { >> 913 if((* theLambdaTablePrim)[i]) { >> 914 (* theLambdaTablePrim)[i]->SetSpline(true); >> 915 } >> 916 } >> 917 } >> 918 } else { >> 919 if (1 < verboseLevel) { >> 920 G4cout << "Lambda table prim for " << particleName << " in file <" >> 921 << filename << "> is not exist" >> 922 << G4endl; >> 923 } >> 924 } 680 } 925 } >> 926 681 return yes; 927 return yes; 682 } 928 } 683 929 684 //....oooOO0OOooo........oooOO0OOooo........oo 930 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 685 931 686 G4double G4VEmProcess::GetCrossSection(G4doubl << 932 G4double 687 const G << 933 G4VEmProcess::CrossSectionPerVolume(G4double kineticEnergy, >> 934 const G4MaterialCutsCouple* couple) 688 { 935 { 689 CurrentSetup(couple, kinEnergy); << 936 // Cross section per atom is calculated 690 return GetCurrentLambda(kinEnergy, G4Log(kin << 937 DefineMaterial(couple); >> 938 G4double cross = 0.0; >> 939 if(buildLambdaTable && theLambdaTable) { >> 940 cross = GetCurrentLambda(kineticEnergy); >> 941 } else { >> 942 SelectModel(kineticEnergy, currentCoupleIndex); >> 943 cross = fFactor*currentModel->CrossSectionPerVolume(currentMaterial, >> 944 currentParticle, >> 945 kineticEnergy); >> 946 } >> 947 >> 948 if(cross < 0.0) { cross = 0.0; } >> 949 return cross; 691 } 950 } 692 951 693 //....oooOO0OOooo........oooOO0OOooo........oo 952 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 694 953 695 G4double G4VEmProcess::GetMeanFreePath(const G 954 G4double G4VEmProcess::GetMeanFreePath(const G4Track& track, 696 G4doubl << 955 G4double, 697 G4Force << 956 G4ForceCondition* condition) 698 { 957 { 699 *condition = NotForced; 958 *condition = NotForced; 700 return G4VEmProcess::MeanFreePath(track); 959 return G4VEmProcess::MeanFreePath(track); 701 } 960 } 702 961 703 //....oooOO0OOooo........oooOO0OOooo........oo 962 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 704 963 705 G4double << 964 G4double G4VEmProcess::MeanFreePath(const G4Track& track) 706 G4VEmProcess::ComputeCrossSectionPerAtom(G4dou << 707 G4dou << 708 { 965 { 709 SelectModel(kinEnergy, currentCoupleIndex); << 966 DefineMaterial(track.GetMaterialCutsCouple()); 710 return (currentModel) ? << 967 preStepLambda = GetCurrentLambda(track.GetKineticEnergy()); 711 currentModel->ComputeCrossSectionPerAtom(c << 968 G4double x = DBL_MAX; 712 Z << 969 if(0.0 < preStepLambda) { x = 1.0/preStepLambda; } >> 970 return x; 713 } 971 } 714 972 715 //....oooOO0OOooo........oooOO0OOooo........oo 973 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 716 974 717 G4PhysicsVector* << 975 G4double 718 G4VEmProcess::LambdaPhysicsVector(const G4Mate << 976 G4VEmProcess::ComputeCrossSectionPerAtom(G4double kineticEnergy, >> 977 G4double Z, G4double A, G4double cut) 719 { 978 { 720 DefineMaterial(couple); << 979 SelectModel(kineticEnergy, currentCoupleIndex); 721 G4PhysicsVector* newv = new G4PhysicsLogVect << 980 G4double x = 0.0; 722 << 981 if(currentModel) { 723 return newv; << 982 x = currentModel->ComputeCrossSectionPerAtom(currentParticle,kineticEnergy, >> 983 Z,A,cut); >> 984 } >> 985 return x; 724 } 986 } 725 987 726 //....oooOO0OOooo........oooOO0OOooo........oo 988 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 727 989 728 const G4Element* G4VEmProcess::GetCurrentEleme << 990 void G4VEmProcess::FindLambdaMax() 729 { 991 { 730 return (nullptr != currentModel) ? << 992 if(1 < verboseLevel) { 731 currentModel->GetCurrentElement(currentMat << 993 G4cout << "### G4VEmProcess::FindLambdaMax: " >> 994 << particle->GetParticleName() >> 995 << " and process " << GetProcessName() << " " << G4endl; >> 996 } >> 997 size_t n = theLambdaTable->length(); >> 998 G4PhysicsVector* pv; >> 999 G4double e, ss, emax, smax; >> 1000 >> 1001 size_t i; >> 1002 >> 1003 // first loop on existing vectors >> 1004 for (i=0; i<n; ++i) { >> 1005 pv = (*theLambdaTable)[i]; >> 1006 if(pv) { >> 1007 size_t nb = pv->GetVectorLength(); >> 1008 emax = DBL_MAX; >> 1009 smax = 0.0; >> 1010 if(nb > 0) { >> 1011 for (size_t j=0; j<nb; ++j) { >> 1012 e = pv->Energy(j); >> 1013 ss = (*pv)(j); >> 1014 if(ss > smax) { >> 1015 smax = ss; >> 1016 emax = e; >> 1017 } >> 1018 } >> 1019 } >> 1020 theEnergyOfCrossSectionMax[i] = emax; >> 1021 theCrossSectionMax[i] = smax; >> 1022 if(1 < verboseLevel) { >> 1023 G4cout << "For " << particle->GetParticleName() >> 1024 << " Max CS at i= " << i << " emax(MeV)= " << emax/MeV >> 1025 << " lambda= " << smax << G4endl; >> 1026 } >> 1027 } >> 1028 } >> 1029 // second loop using base materials >> 1030 for (i=0; i<n; ++i) { >> 1031 pv = (*theLambdaTable)[i]; >> 1032 if(!pv){ >> 1033 G4int j = (*theDensityIdx)[i]; >> 1034 theEnergyOfCrossSectionMax[i] = theEnergyOfCrossSectionMax[j]; >> 1035 theCrossSectionMax[i] = (*theDensityFactor)[i]*theCrossSectionMax[j]; >> 1036 } >> 1037 } 732 } 1038 } 733 1039 734 //....oooOO0OOooo........oooOO0OOooo........oo 1040 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 735 1041 736 const G4Element* G4VEmProcess::GetTargetElemen << 1042 G4PhysicsVector* >> 1043 G4VEmProcess::LambdaPhysicsVector(const G4MaterialCutsCouple*) 737 { 1044 { 738 return (nullptr != currentModel) ? << 1045 G4PhysicsVector* v = 739 currentModel->GetCurrentElement(currentMat << 1046 new G4PhysicsLogVector(minKinEnergy, maxKinEnergy, nLambdaBins); >> 1047 v->SetSpline(lManager->SplineFlag()); >> 1048 return v; 740 } 1049 } 741 1050 742 //....oooOO0OOooo........oooOO0OOooo........oo 1051 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 743 1052 744 const G4Isotope* G4VEmProcess::GetTargetIsotop << 1053 const G4Element* G4VEmProcess::GetCurrentElement() const 745 { 1054 { 746 return (nullptr != currentModel) ? << 1055 const G4Element* elm = 0; 747 currentModel->GetCurrentIsotope(GetCurrent << 1056 if(currentModel) {elm = currentModel->GetCurrentElement(); } >> 1057 return elm; 748 } 1058 } 749 1059 750 //....oooOO0OOooo........oooOO0OOooo........oo 1060 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 751 1061 752 void G4VEmProcess::SetCrossSectionBiasingFacto 1062 void G4VEmProcess::SetCrossSectionBiasingFactor(G4double f, G4bool flag) 753 { 1063 { 754 if(f > 0.0) { 1064 if(f > 0.0) { 755 biasFactor = f; 1065 biasFactor = f; 756 weightFlag = flag; 1066 weightFlag = flag; 757 if(1 < verboseLevel) { 1067 if(1 < verboseLevel) { 758 G4cout << "### SetCrossSectionBiasingFac 1068 G4cout << "### SetCrossSectionBiasingFactor: for " 759 << particle->GetParticleName() << 1069 << particle->GetParticleName() 760 << " and process " << GetProcessN << 1070 << " and process " << GetProcessName() 761 << " biasFactor= " << f << " weig << 1071 << " biasFactor= " << f << " weightFlag= " << flag 762 << G4endl; << 1072 << G4endl; 763 } 1073 } 764 } 1074 } 765 } 1075 } 766 1076 767 //....oooOO0OOooo........oooOO0OOooo........oo 1077 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 768 1078 769 void 1079 void 770 G4VEmProcess::ActivateForcedInteraction(G4doub 1080 G4VEmProcess::ActivateForcedInteraction(G4double length, const G4String& r, 771 G4bool << 1081 G4bool flag) 772 { 1082 { 773 if(nullptr == biasManager) { biasManager = n << 1083 if(!biasManager) { biasManager = new G4EmBiasingManager(); } 774 if(1 < verboseLevel) { 1084 if(1 < verboseLevel) { 775 G4cout << "### ActivateForcedInteraction: 1085 G4cout << "### ActivateForcedInteraction: for " 776 << particle->GetParticleName() << 1086 << particle->GetParticleName() 777 << " and process " << GetProcessNam << 1087 << " and process " << GetProcessName() 778 << " length(mm)= " << length/mm << 1088 << " length(mm)= " << length/mm 779 << " in G4Region <" << r << 1089 << " in G4Region <" << r 780 << "> weightFlag= " << flag << 1090 << "> weightFlag= " << flag 781 << G4endl; << 1091 << G4endl; 782 } 1092 } 783 weightFlag = flag; 1093 weightFlag = flag; 784 biasManager->ActivateForcedInteraction(lengt 1094 biasManager->ActivateForcedInteraction(length, r); 785 } 1095 } 786 1096 787 //....oooOO0OOooo........oooOO0OOooo........oo 1097 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 788 1098 789 void 1099 void 790 G4VEmProcess::ActivateSecondaryBiasing(const G 1100 G4VEmProcess::ActivateSecondaryBiasing(const G4String& region, 791 G4double factor, 1101 G4double factor, 792 G4double energyLimit) 1102 G4double energyLimit) 793 { 1103 { 794 if (0.0 <= factor) { 1104 if (0.0 <= factor) { 795 1105 796 // Range cut can be applied only for e- 1106 // Range cut can be applied only for e- 797 if(0.0 == factor && secondaryParticle != G 1107 if(0.0 == factor && secondaryParticle != G4Electron::Electron()) 798 { return; } 1108 { return; } 799 1109 800 if(!biasManager) { biasManager = new G4EmB 1110 if(!biasManager) { biasManager = new G4EmBiasingManager(); } 801 biasManager->ActivateSecondaryBiasing(regi 1111 biasManager->ActivateSecondaryBiasing(region, factor, energyLimit); 802 if(1 < verboseLevel) { 1112 if(1 < verboseLevel) { 803 G4cout << "### ActivateSecondaryBiasing: 1113 G4cout << "### ActivateSecondaryBiasing: for " 804 << " process " << GetProcessName() 1114 << " process " << GetProcessName() 805 << " factor= " << factor 1115 << " factor= " << factor 806 << " in G4Region <" << region 1116 << " in G4Region <" << region 807 << "> energyLimit(MeV)= " << energyLimi 1117 << "> energyLimit(MeV)= " << energyLimit/MeV 808 << G4endl; 1118 << G4endl; 809 } 1119 } 810 } 1120 } 811 } 1121 } 812 1122 813 //....oooOO0OOooo........oooOO0OOooo........oo 1123 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 814 1124 815 void G4VEmProcess::SetLambdaBinning(G4int n) << 816 { << 817 if(5 < n && n < 10000000) { << 818 nLambdaBins = n; << 819 actBinning = true; << 820 } else { << 821 G4double e = (G4double)n; << 822 PrintWarning("SetLambdaBinning", e); << 823 } << 824 } << 825 << 826 //....oooOO0OOooo........oooOO0OOooo........oo << 827 << 828 void G4VEmProcess::SetMinKinEnergy(G4double e) 1125 void G4VEmProcess::SetMinKinEnergy(G4double e) 829 { 1126 { 830 if(1.e-3*eV < e && e < maxKinEnergy) { << 1127 nLambdaBins = G4lrint(nLambdaBins*std::log(maxKinEnergy/e) 831 nLambdaBins = G4lrint(nLambdaBins*G4Log(ma << 1128 /std::log(maxKinEnergy/minKinEnergy)); 832 /G4Log(maxKinEnergy/ << 1129 minKinEnergy = e; 833 minKinEnergy = e; << 834 actMinKinEnergy = true; << 835 } else { PrintWarning("SetMinKinEnergy", e); << 836 } 1130 } 837 1131 838 //....oooOO0OOooo........oooOO0OOooo........oo 1132 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 839 1133 840 void G4VEmProcess::SetMaxKinEnergy(G4double e) 1134 void G4VEmProcess::SetMaxKinEnergy(G4double e) 841 { 1135 { 842 if(minKinEnergy < e && e < 1.e+6*TeV) { << 1136 nLambdaBins = G4lrint(nLambdaBins*std::log(e/minKinEnergy) 843 nLambdaBins = G4lrint(nLambdaBins*G4Log(e/ << 1137 /std::log(maxKinEnergy/minKinEnergy)); 844 /G4Log(maxKinEnergy/ << 1138 maxKinEnergy = e; 845 maxKinEnergy = e; << 846 actMaxKinEnergy = true; << 847 } else { PrintWarning("SetMaxKinEnergy", e); << 848 } << 849 << 850 //....oooOO0OOooo........oooOO0OOooo........oo << 851 << 852 void G4VEmProcess::SetMinKinEnergyPrim(G4doubl << 853 { << 854 if(theParameters->MinKinEnergy() <= e && << 855 e <= theParameters->MaxKinEnergy()) { min << 856 else { PrintWarning("SetMinKinEnergyPrim", e << 857 } << 858 << 859 //....oooOO0OOooo........oooOO0OOooo........oo << 860 << 861 G4VEmProcess* G4VEmProcess::GetEmProcess(const << 862 { << 863 return (nam == GetProcessName()) ? this : nu << 864 } << 865 << 866 //....oooOO0OOooo........oooOO0OOooo........oo << 867 << 868 G4double G4VEmProcess::PolarAngleLimit() const << 869 { << 870 return theParameters->MscThetaLimit(); << 871 } << 872 << 873 //....oooOO0OOooo........oooOO0OOooo........oo << 874 << 875 void G4VEmProcess::PrintWarning(G4String tit, << 876 { << 877 G4String ss = "G4VEmProcess::" + tit; << 878 G4ExceptionDescription ed; << 879 ed << "Parameter is out of range: " << val << 880 << " it will have no effect!\n" << " Pro << 881 << GetProcessName() << " nbins= " << the << 882 << " Emin(keV)= " << theParameters->MinKi << 883 << " Emax(GeV)= " << theParameters->MaxKi << 884 G4Exception(ss, "em0044", JustWarning, ed); << 885 } << 886 << 887 //....oooOO0OOooo........oooOO0OOooo........oo << 888 << 889 void G4VEmProcess::ProcessDescription(std::ost << 890 { << 891 if(nullptr != particle) { << 892 StreamInfo(out, *particle, true); << 893 } << 894 } 1139 } 895 1140 896 //....oooOO0OOooo........oooOO0OOooo........oo 1141 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 897 1142