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: G4VEmModel.cc 97742 2016-06-08 09:24:54Z gcosmo $ >> 27 // 26 // ------------------------------------------- 28 // ------------------------------------------------------------------- 27 // 29 // 28 // GEANT4 Class file 30 // GEANT4 Class file 29 // 31 // 30 // 32 // 31 // File name: G4VEmModel 33 // File name: G4VEmModel 32 // 34 // 33 // Author: Vladimir Ivanchenko 35 // Author: Vladimir Ivanchenko 34 // 36 // 35 // Creation date: 25.07.2005 37 // Creation date: 25.07.2005 36 // 38 // 37 // Modifications: 39 // Modifications: 38 // 25.10.2005 Set default highLimit=100.TeV (V 40 // 25.10.2005 Set default highLimit=100.TeV (V.Ivanchenko) 39 // 06.02.2006 add method ComputeMeanFreePath() 41 // 06.02.2006 add method ComputeMeanFreePath() (mma) 40 // 16.02.2009 Move implementations of virtual 42 // 16.02.2009 Move implementations of virtual methods to source (VI) 41 // 43 // 42 // 44 // 43 // Class Description: 45 // Class Description: 44 // 46 // 45 // Abstract interface to energy loss models 47 // Abstract interface to energy loss models 46 48 47 // ------------------------------------------- 49 // ------------------------------------------------------------------- 48 // 50 // 49 51 50 #include "G4VEmModel.hh" 52 #include "G4VEmModel.hh" 51 #include "G4ElementData.hh" 53 #include "G4ElementData.hh" 52 #include "G4LossTableManager.hh" 54 #include "G4LossTableManager.hh" 53 #include "G4LossTableBuilder.hh" << 54 #include "G4ProductionCutsTable.hh" 55 #include "G4ProductionCutsTable.hh" 55 #include "G4ParticleChangeForLoss.hh" 56 #include "G4ParticleChangeForLoss.hh" 56 #include "G4ParticleChangeForGamma.hh" 57 #include "G4ParticleChangeForGamma.hh" 57 #include "G4EmParameters.hh" << 58 #include "G4SystemOfUnits.hh" 58 #include "G4SystemOfUnits.hh" 59 #include "G4EmUtility.hh" << 60 #include "G4Log.hh" 59 #include "G4Log.hh" 61 #include "Randomize.hh" 60 #include "Randomize.hh" 62 #include <iostream> 61 #include <iostream> 63 62 64 //....oooOO0OOooo........oooOO0OOooo........oo 63 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 65 //....oooOO0OOooo........oooOO0OOooo........oo 64 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 66 65 >> 66 const G4double G4VEmModel::inveplus = 1.0/CLHEP::eplus; >> 67 67 G4VEmModel::G4VEmModel(const G4String& nam): 68 G4VEmModel::G4VEmModel(const G4String& nam): 68 inveplus(1.0/CLHEP::eplus), << 69 flucModel(nullptr),anglModel(nullptr), name(nam), lowLimit(0.1*CLHEP::keV), 69 lowLimit(0.1*CLHEP::keV), << 70 highLimit(100.0*CLHEP::TeV),eMinActive(0.0),eMaxActive(DBL_MAX), 70 highLimit(100.0*CLHEP::TeV), << 71 polarAngleLimit(CLHEP::pi),secondaryThreshold(DBL_MAX), 71 polarAngleLimit(CLHEP::pi), << 72 theLPMflag(false),flagDeexcitation(false),flagForceBuildTable(false), 72 name(nam) << 73 isMaster(true),fElementData(nullptr),pParticleChange(nullptr),xSectionTable(nullptr), >> 74 theDensityFactor(nullptr),theDensityIdx(nullptr),fCurrentCouple(nullptr), >> 75 fCurrentElement(nullptr),fCurrentIsotope(nullptr),nsec(5) 73 { 76 { 74 xsec.resize(nsec); 77 xsec.resize(nsec); >> 78 nSelectors = 0; >> 79 elmSelectors = nullptr; >> 80 localElmSelectors = true; >> 81 localTable = true; >> 82 useAngularGenerator = false; >> 83 isLocked = false; >> 84 idxTable = 0; >> 85 75 fEmManager = G4LossTableManager::Instance(); 86 fEmManager = G4LossTableManager::Instance(); 76 fEmManager->Register(this); 87 fEmManager->Register(this); 77 isMaster = fEmManager->IsMaster(); << 78 << 79 G4LossTableBuilder* bld = fEmManager->GetTab << 80 theDensityFactor = bld->GetDensityFactors(); << 81 theDensityIdx = bld->GetCoupleIndexes(); << 82 } 88 } 83 89 84 //....oooOO0OOooo........oooOO0OOooo........oo 90 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 85 91 86 G4VEmModel::~G4VEmModel() 92 G4VEmModel::~G4VEmModel() 87 { 93 { 88 if(localElmSelectors) { 94 if(localElmSelectors) { 89 for(G4int i=0; i<nSelectors; ++i) { << 95 if(nSelectors > 0) { 90 delete (*elmSelectors)[i]; << 96 for(G4int i=0; i<nSelectors; ++i) { >> 97 delete (*elmSelectors)[i]; >> 98 } 91 } 99 } 92 delete elmSelectors; 100 delete elmSelectors; 93 } 101 } 94 delete anglModel; 102 delete anglModel; 95 103 96 if(localTable && xSectionTable != nullptr) { << 104 if(localTable && xSectionTable) { 97 xSectionTable->clearAndDestroy(); 105 xSectionTable->clearAndDestroy(); 98 delete xSectionTable; 106 delete xSectionTable; 99 xSectionTable = nullptr; 107 xSectionTable = nullptr; 100 } 108 } >> 109 if(isMaster && fElementData) { >> 110 delete fElementData; >> 111 fElementData = nullptr; >> 112 } 101 fEmManager->DeRegister(this); 113 fEmManager->DeRegister(this); 102 } 114 } 103 115 104 //....oooOO0OOooo........oooOO0OOooo........oo 116 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 105 117 106 G4ParticleChangeForLoss* G4VEmModel::GetPartic 118 G4ParticleChangeForLoss* G4VEmModel::GetParticleChangeForLoss() 107 { 119 { 108 G4ParticleChangeForLoss* p = nullptr; 120 G4ParticleChangeForLoss* p = nullptr; 109 if (pParticleChange != nullptr) { << 121 if (pParticleChange) { 110 p = static_cast<G4ParticleChangeForLoss*>( 122 p = static_cast<G4ParticleChangeForLoss*>(pParticleChange); 111 } else { 123 } else { 112 p = new G4ParticleChangeForLoss(); 124 p = new G4ParticleChangeForLoss(); 113 pParticleChange = p; 125 pParticleChange = p; 114 } 126 } 115 if(fTripletModel != nullptr) { fTripletModel << 116 return p; 127 return p; 117 } 128 } 118 129 119 //....oooOO0OOooo........oooOO0OOooo........oo 130 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 120 131 121 G4ParticleChangeForGamma* G4VEmModel::GetParti 132 G4ParticleChangeForGamma* G4VEmModel::GetParticleChangeForGamma() 122 { 133 { 123 G4ParticleChangeForGamma* p = nullptr; 134 G4ParticleChangeForGamma* p = nullptr; 124 if (pParticleChange != nullptr) { << 135 if (pParticleChange) { 125 p = static_cast<G4ParticleChangeForGamma*> 136 p = static_cast<G4ParticleChangeForGamma*>(pParticleChange); 126 } else { 137 } else { 127 p = new G4ParticleChangeForGamma(); 138 p = new G4ParticleChangeForGamma(); 128 pParticleChange = p; 139 pParticleChange = p; 129 } 140 } 130 if(fTripletModel != nullptr) { fTripletModel << 131 return p; 141 return p; 132 } 142 } 133 143 134 //....oooOO0OOooo........oooOO0OOooo........oo 144 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 135 145 136 void G4VEmModel::InitialiseElementSelectors(co 146 void G4VEmModel::InitialiseElementSelectors(const G4ParticleDefinition* part, 137 co 147 const G4DataVector& cuts) 138 { 148 { >> 149 // using spline for element selectors should be investigated in details >> 150 // because small number of points may provide biased results >> 151 // large number of points requires significant increase of memory >> 152 G4bool spline = false; >> 153 >> 154 //G4cout << "IES: for " << GetName() << " Emin(MeV)= " << lowLimit/MeV >> 155 // << " Emax(MeV)= " << highLimit/MeV << G4endl; >> 156 >> 157 // two times less bins because probability functon is normalized >> 158 // so correspondingly is more smooth 139 if(highLimit <= lowLimit) { return; } 159 if(highLimit <= lowLimit) { return; } 140 G4EmUtility::InitialiseElementSelectors(this << 160 141 localElmSelectors = true; << 161 G4int nbinsPerDec = G4EmParameters::Instance()->NumberOfBinsPerDecade(); >> 162 >> 163 G4ProductionCutsTable* theCoupleTable= >> 164 G4ProductionCutsTable::GetProductionCutsTable(); >> 165 G4int numOfCouples = theCoupleTable->GetTableSize(); >> 166 >> 167 // prepare vector >> 168 if(!elmSelectors) { >> 169 elmSelectors = new std::vector<G4EmElementSelector*>; >> 170 } >> 171 if(numOfCouples > nSelectors) { >> 172 for(G4int i=nSelectors; i<numOfCouples; ++i) { >> 173 elmSelectors->push_back(nullptr); >> 174 } >> 175 nSelectors = numOfCouples; >> 176 } >> 177 >> 178 // initialise vector >> 179 for(G4int i=0; i<numOfCouples; ++i) { >> 180 >> 181 // no need in element selectors for infionite cuts >> 182 if(cuts[i] == DBL_MAX) { continue; } >> 183 >> 184 fCurrentCouple = theCoupleTable->GetMaterialCutsCouple(i); >> 185 const G4Material* material = fCurrentCouple->GetMaterial(); >> 186 >> 187 // selector already exist check if should be deleted >> 188 G4bool create = true; >> 189 if((*elmSelectors)[i]) { >> 190 if(material == ((*elmSelectors)[i])->GetMaterial()) { create = false; } >> 191 else { delete (*elmSelectors)[i]; } >> 192 } >> 193 if(create) { >> 194 G4double emin = std::max(lowLimit, >> 195 MinPrimaryEnergy(material, part, cuts[i])); >> 196 G4double emax = std::max(highLimit, 10*emin); >> 197 static const G4double invlog106 = 1.0/(6*G4Log(10.)); >> 198 G4int nbins = (G4int)(nbinsPerDec*G4Log(emax/emin)*invlog106); >> 199 nbins = std::max(nbins, 3); >> 200 >> 201 (*elmSelectors)[i] = new G4EmElementSelector(this,material,nbins, >> 202 emin,emax,spline); >> 203 } >> 204 ((*elmSelectors)[i])->Initialise(part, cuts[i]); >> 205 /* >> 206 G4cout << "G4VEmModel::InitialiseElmSelectors i= " << i >> 207 << " idx= " << fCurrentCouple->GetIndex() >> 208 << " " << part->GetParticleName() >> 209 << " for " << GetName() << " cut= " << cuts[i] >> 210 << " " << (*elmSelectors)[i] << G4endl; >> 211 ((*elmSelectors)[i])->Dump(part); >> 212 */ >> 213 } 142 } 214 } 143 215 144 //....oooOO0OOooo........oooOO0OOooo........oo 216 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 145 217 146 void G4VEmModel::InitialiseLocal(const G4Parti << 218 void G4VEmModel::InitialiseLocal(const G4ParticleDefinition*, >> 219 G4VEmModel*) 147 {} 220 {} 148 221 149 //....oooOO0OOooo........oooOO0OOooo........oo 222 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 150 223 151 void G4VEmModel::InitialiseForMaterial(const G 224 void G4VEmModel::InitialiseForMaterial(const G4ParticleDefinition* part, 152 const G 225 const G4Material* material) 153 { 226 { 154 if(material != nullptr) { << 227 if(material) { 155 G4int n = (G4int)material->GetNumberOfElem << 228 const G4ElementVector* theElementVector = material->GetElementVector(); >> 229 G4int n = material->GetNumberOfElements(); 156 for(G4int i=0; i<n; ++i) { 230 for(G4int i=0; i<n; ++i) { 157 G4int Z = material->GetElement(i)->GetZa << 231 G4int Z = ((*theElementVector)[i])->GetZasInt(); 158 InitialiseForElement(part, Z); 232 InitialiseForElement(part, Z); 159 } 233 } >> 234 } else { >> 235 //G4cout << "G4VEmModel::InitialiseForMaterial for " << GetName(); >> 236 //if(part) { G4cout << " and " << part->GetParticleName(); } >> 237 //G4cout << " with no material" << G4endl; 160 } 238 } 161 } 239 } 162 240 163 //....oooOO0OOooo........oooOO0OOooo........oo 241 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 164 242 165 void G4VEmModel::InitialiseForElement(const G4 243 void G4VEmModel::InitialiseForElement(const G4ParticleDefinition*, G4int) 166 {} 244 {} 167 245 168 //....oooOO0OOooo........oooOO0OOooo........oo 246 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 169 247 170 G4double G4VEmModel::ComputeDEDXPerVolume(cons 248 G4double G4VEmModel::ComputeDEDXPerVolume(const G4Material*, 171 cons 249 const G4ParticleDefinition*, 172 G4do 250 G4double,G4double) 173 { 251 { 174 return 0.0; 252 return 0.0; 175 } 253 } 176 254 177 //....oooOO0OOooo........oooOO0OOooo........oo 255 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 178 256 179 G4double G4VEmModel::CrossSectionPerVolume(con << 257 G4double G4VEmModel::CrossSectionPerVolume(const G4Material* material, 180 con 258 const G4ParticleDefinition* p, 181 G4d 259 G4double ekin, 182 G4d 260 G4double emin, 183 G4d 261 G4double emax) 184 { 262 { 185 SetupForMaterial(p, mat, ekin); << 263 SetupForMaterial(p, material, ekin); 186 const G4double* theAtomNumDensityVector = ma << 264 G4double cross = 0.0; 187 G4int nelm = (G4int)mat->GetNumberOfElements << 265 const G4ElementVector* theElementVector = material->GetElementVector(); >> 266 const G4double* theAtomNumDensityVector = >> 267 material->GetVecNbOfAtomsPerVolume(); >> 268 G4int nelm = material->GetNumberOfElements(); 188 if(nelm > nsec) { 269 if(nelm > nsec) { 189 xsec.resize(nelm); 270 xsec.resize(nelm); 190 nsec = nelm; 271 nsec = nelm; 191 } 272 } 192 G4double cross = 0.0; << 193 for (G4int i=0; i<nelm; ++i) { 273 for (G4int i=0; i<nelm; ++i) { 194 cross += theAtomNumDensityVector[i]* 274 cross += theAtomNumDensityVector[i]* 195 ComputeCrossSectionPerAtom(p,mat->GetEle << 275 ComputeCrossSectionPerAtom(p,(*theElementVector)[i],ekin,emin,emax); 196 xsec[i] = cross; 276 xsec[i] = cross; 197 } 277 } 198 return cross; 278 return cross; 199 } 279 } 200 280 201 //....oooOO0OOooo........oooOO0OOooo........oo 281 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 202 282 203 G4double G4VEmModel::GetPartialCrossSection(co 283 G4double G4VEmModel::GetPartialCrossSection(const G4Material*, G4int, 204 co 284 const G4ParticleDefinition*, 205 G4 285 G4double) 206 { 286 { 207 return 0.0; 287 return 0.0; 208 } 288 } 209 289 210 //....oooOO0OOooo........oooOO0OOooo........oo 290 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 211 291 212 void G4VEmModel::StartTracking(G4Track*) 292 void G4VEmModel::StartTracking(G4Track*) 213 {} 293 {} 214 294 215 //....oooOO0OOooo........oooOO0OOooo........oo 295 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 216 296 217 const G4Element* G4VEmModel::SelectRandomAtom( << 297 const G4Element* G4VEmModel::SelectRandomAtom(const G4Material* material, 218 298 const G4ParticleDefinition* pd, 219 299 G4double kinEnergy, 220 300 G4double tcut, 221 301 G4double tmax) 222 { 302 { 223 G4int n = (G4int)mat->GetNumberOfElements(); << 303 const G4ElementVector* theElementVector = material->GetElementVector(); 224 fCurrentElement = mat->GetElement(0); << 304 G4int n = material->GetNumberOfElements() - 1; 225 if (n > 1) { << 305 fCurrentElement = (*theElementVector)[n]; 226 const G4double x = G4UniformRand()* << 306 if (n > 0) { 227 G4VEmModel::CrossSectionPerVolume(mat,pd << 307 G4double x = G4UniformRand()* >> 308 G4VEmModel::CrossSectionPerVolume(material,pd,kinEnergy,tcut,tmax); 228 for(G4int i=0; i<n; ++i) { 309 for(G4int i=0; i<n; ++i) { 229 if (x <= xsec[i]) { 310 if (x <= xsec[i]) { 230 fCurrentElement = mat->GetElement(i); << 311 fCurrentElement = (*theElementVector)[i]; 231 break; 312 break; 232 } 313 } 233 } 314 } 234 } 315 } 235 return fCurrentElement; 316 return fCurrentElement; 236 } 317 } 237 318 238 //....oooOO0OOooo........oooOO0OOooo........oo << 239 << 240 const G4Element* G4VEmModel::GetCurrentElement << 241 { << 242 const G4Element* elm = fCurrentElement; << 243 if(nullptr == elm && nullptr != mat) { << 244 elm = G4EmUtility::SampleRandomElement(mat << 245 } << 246 return elm; << 247 } << 248 << 249 //....oooOO0OOooo........oooOO0OOooo........oo << 250 << 251 G4int G4VEmModel::SelectRandomAtomNumber(const << 252 { << 253 const G4Element* elm = GetCurrentElement(mat << 254 return (nullptr == elm) ? 0 : elm->GetZasInt << 255 } << 256 << 257 //....oooOO0OOooo........oooOO0OOooo........oo << 258 << 259 const G4Isotope* G4VEmModel::GetCurrentIsotope << 260 { << 261 const G4Isotope* iso = nullptr; << 262 const G4Element* el = elm; << 263 if(nullptr == el && nullptr != fCurrentCoupl << 264 el = GetCurrentElement(fCurrentCouple->Get << 265 } << 266 if(nullptr != el) { << 267 iso = G4EmUtility::SampleRandomIsotope(el) << 268 } << 269 return iso; << 270 } << 271 << 272 //....oooOO0OOooo........oooOO0OOooo........oo << 273 << 274 G4int G4VEmModel::SelectIsotopeNumber(const G4 << 275 { << 276 auto iso = GetCurrentIsotope(elm); << 277 return (nullptr != iso) ? iso->GetN() : 0; << 278 } << 279 << 280 //....oooOO0OOooo........oooOO0OOooo........oo 319 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 281 320 282 G4double G4VEmModel::ComputeCrossSectionPerAto 321 G4double G4VEmModel::ComputeCrossSectionPerAtom(const G4ParticleDefinition*, 283 322 G4double, G4double, G4double, 284 323 G4double, G4double) 285 { 324 { 286 return 0.0; 325 return 0.0; 287 } 326 } 288 327 289 //....oooOO0OOooo........oooOO0OOooo........oo 328 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 290 329 291 G4double 330 G4double 292 G4VEmModel::ComputeCrossSectionPerShell(const 331 G4VEmModel::ComputeCrossSectionPerShell(const G4ParticleDefinition*, 293 G4int, 332 G4int, G4int, 294 G4doub 333 G4double, G4double, G4double) 295 { 334 { 296 return 0.0; 335 return 0.0; 297 } 336 } 298 337 299 //....oooOO0OOooo........oooOO0OOooo........oo 338 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 300 339 301 void G4VEmModel::DefineForRegion(const G4Regio 340 void G4VEmModel::DefineForRegion(const G4Region*) 302 {} 341 {} 303 342 304 //....oooOO0OOooo........oooOO0OOooo........oo 343 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 305 344 306 void G4VEmModel::FillNumberOfSecondaries(G4int << 307 G4int << 308 { << 309 numberOfTriplets = 0; << 310 numberOfRecoil = 0; << 311 } << 312 << 313 //....oooOO0OOooo........oooOO0OOooo........oo << 314 << 315 G4double G4VEmModel::ChargeSquareRatio(const G 345 G4double G4VEmModel::ChargeSquareRatio(const G4Track& track) 316 { 346 { 317 return GetChargeSquareRatio(track.GetParticl 347 return GetChargeSquareRatio(track.GetParticleDefinition(), 318 track.GetMateria 348 track.GetMaterial(), track.GetKineticEnergy()); 319 } 349 } 320 350 321 //....oooOO0OOooo........oooOO0OOooo........oo 351 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 322 352 323 G4double G4VEmModel::GetChargeSquareRatio(cons 353 G4double G4VEmModel::GetChargeSquareRatio(const G4ParticleDefinition* p, 324 cons 354 const G4Material*, G4double) 325 { 355 { 326 const G4double q = p->GetPDGCharge()*inveplu << 356 G4double q = p->GetPDGCharge()*inveplus; 327 return q*q; 357 return q*q; 328 } 358 } 329 359 330 //....oooOO0OOooo........oooOO0OOooo........oo 360 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 331 361 332 G4double G4VEmModel::GetParticleCharge(const G 362 G4double G4VEmModel::GetParticleCharge(const G4ParticleDefinition* p, 333 const G 363 const G4Material*, G4double) 334 { 364 { 335 return p->GetPDGCharge(); 365 return p->GetPDGCharge(); 336 } 366 } 337 367 338 //....oooOO0OOooo........oooOO0OOooo........oo 368 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 339 369 340 void G4VEmModel::CorrectionsAlongStep(const G4 370 void G4VEmModel::CorrectionsAlongStep(const G4MaterialCutsCouple*, 341 const G4 371 const G4DynamicParticle*, 342 const G4 << 372 G4double&,G4double&,G4double) 343 {} 373 {} 344 374 345 //....oooOO0OOooo........oooOO0OOooo........oo 375 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 346 376 347 G4double G4VEmModel::Value(const G4MaterialCut 377 G4double G4VEmModel::Value(const G4MaterialCutsCouple* couple, 348 const G4ParticleDef 378 const G4ParticleDefinition* p, G4double e) 349 { 379 { 350 SetCurrentCouple(couple); 380 SetCurrentCouple(couple); 351 return pFactor*e*e*CrossSectionPerVolume(pBa << 381 return e*e*CrossSectionPerVolume(couple->GetMaterial(),p,e,0.0,DBL_MAX); 352 } 382 } 353 383 354 //....oooOO0OOooo........oooOO0OOooo........oo 384 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 355 385 356 G4double G4VEmModel::MinPrimaryEnergy(const G4 386 G4double G4VEmModel::MinPrimaryEnergy(const G4Material*, 357 const G4 387 const G4ParticleDefinition*, 358 G4double 388 G4double) 359 { 389 { 360 return 0.0; 390 return 0.0; 361 } 391 } 362 392 363 //....oooOO0OOooo........oooOO0OOooo........oo 393 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 364 394 365 G4double G4VEmModel::MinEnergyCut(const G4Part 395 G4double G4VEmModel::MinEnergyCut(const G4ParticleDefinition*, 366 const G4Mate 396 const G4MaterialCutsCouple*) 367 { 397 { 368 return 0.0; 398 return 0.0; 369 } 399 } 370 400 371 //....oooOO0OOooo........oooOO0OOooo........oo 401 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 372 402 373 G4double G4VEmModel::MaxSecondaryEnergy(const 403 G4double G4VEmModel::MaxSecondaryEnergy(const G4ParticleDefinition*, 374 G4doub 404 G4double kineticEnergy) 375 { 405 { 376 return kineticEnergy; 406 return kineticEnergy; 377 } 407 } 378 408 379 //....oooOO0OOooo........oooOO0OOooo........oo 409 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 380 410 381 void G4VEmModel::SetupForMaterial(const G4Part << 411 void G4VEmModel::SetupForMaterial(const G4ParticleDefinition*, 382 const G4Mate << 412 const G4Material*, G4double) 383 { << 413 {} 384 GetChargeSquareRatio(p, mat, ekin); << 385 } << 386 414 387 //....oooOO0OOooo........oooOO0OOooo........oo 415 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 388 416 389 void 417 void 390 G4VEmModel::SetParticleChange(G4VParticleChang 418 G4VEmModel::SetParticleChange(G4VParticleChange* p, G4VEmFluctuationModel* f) 391 { 419 { 392 if(p != nullptr && pParticleChange != p) { p << 420 if(p && pParticleChange != p) { pParticleChange = p; } 393 if(flucModel != f) { flucModel = f; } << 421 flucModel = f; 394 } 422 } 395 423 396 //....oooOO0OOooo........oooOO0OOooo........oo 424 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 397 425 398 void G4VEmModel::SetCrossSectionTable(G4Physic 426 void G4VEmModel::SetCrossSectionTable(G4PhysicsTable* p, G4bool isLocal) 399 { 427 { 400 xSectionTable = p; << 428 if(p != xSectionTable) { 401 localTable = isLocal; << 429 if(xSectionTable && localTable) { 402 } << 430 xSectionTable->clearAndDestroy(); 403 << 431 delete xSectionTable; 404 //....oooOO0OOooo........oooOO0OOooo........oo << 432 } 405 << 433 xSectionTable = p; 406 void G4VEmModel::SetLPMFlag(G4bool) << 407 { << 408 if (G4EmParameters::Instance()->Verbose() > << 409 G4ExceptionDescription ed; << 410 ed << "The obsolete method SetLPMFlag(..) << 411 << " is called. Please, use G4EmParamet << 412 << " instead"; << 413 G4Exception("G4VEmModel::SetLPMFlag", "em0 << 414 } 434 } >> 435 localTable = isLocal; 415 } 436 } 416 << 417 //....oooOO0OOooo........oooOO0OOooo........oo << 418 << 419 void G4VEmModel::SetMasterThread(G4bool) << 420 {} << 421 437 422 //....oooOO0OOooo........oooOO0OOooo........oo 438 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 423 439 424 void G4VEmModel::ModelDescription(std::ostrea 440 void G4VEmModel::ModelDescription(std::ostream& outFile) const 425 { 441 { 426 outFile << "The description for this model h 442 outFile << "The description for this model has not been written yet.\n"; 427 } 443 } 428 444 429 //....oooOO0OOooo........oooOO0OOooo........oo 445 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 430 446