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