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