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 // >> 26 // >> 27 // $Id: G4IonisParamMat.cc,v 1.40 2010-11-01 18:18:57 vnivanch Exp $ >> 28 // GEANT4 tag $Name: geant4-09-04-patch-02 $ >> 29 // >> 30 // >> 31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... 25 32 26 // 09-07-98, data moved from G4Material, M.Mai 33 // 09-07-98, data moved from G4Material, M.Maire 27 // 18-07-98, bug corrected in ComputeDensityEf 34 // 18-07-98, bug corrected in ComputeDensityEffect() for gas 28 // 16-01-01, bug corrected in ComputeDensityEf 35 // 16-01-01, bug corrected in ComputeDensityEffect() E100eV (L.Urban) 29 // 08-02-01, fShellCorrectionVector correctly 36 // 08-02-01, fShellCorrectionVector correctly handled (mma) 30 // 28-10-02, add setMeanExcitationEnergy (V.Iv 37 // 28-10-02, add setMeanExcitationEnergy (V.Ivanchenko) 31 // 06-09-04, factor 2 to shell correction term << 38 // 06-09-04, factor 2 to shell correction term (V.Ivanchenko) 32 // 10-05-05, add a missing coma in FindMeanExc 39 // 10-05-05, add a missing coma in FindMeanExcitationEnergy() - Bug#746 (mma) 33 // 27-09-07, add computation of parameters for 40 // 27-09-07, add computation of parameters for ions (V.Ivanchenko) 34 // 04-03-08, remove reference to G4NistManager 41 // 04-03-08, remove reference to G4NistManager. Add fBirks constant (mma) 35 // 30-10-09, add G4DensityEffectData class and 42 // 30-10-09, add G4DensityEffectData class and density effect computation (VI) 36 43 37 #include "G4IonisParamMat.hh" << 44 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... 38 45 39 #include "G4AtomicShells.hh" << 46 #include "G4IonisParamMat.hh" 40 #include "G4AutoLock.hh" << 41 #include "G4DensityEffectData.hh" << 42 #include "G4Exp.hh" << 43 #include "G4Log.hh" << 44 #include "G4Material.hh" 47 #include "G4Material.hh" 45 #include "G4NistManager.hh" << 48 #include "G4DensityEffectData.hh" 46 #include "G4PhysicalConstants.hh" << 47 #include "G4Pow.hh" << 48 #include "G4SystemOfUnits.hh" << 49 << 50 G4DensityEffectData* G4IonisParamMat::fDensity << 51 49 52 namespace << 50 G4DensityEffectData* G4IonisParamMat::fDensityData = 0; 53 { << 54 G4Mutex ionisMutex = G4MUTEX_INITIALIZER; << 55 } << 56 51 57 //....oooOO0OOooo........oooOO0OOooo........oo 52 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... 58 53 59 G4IonisParamMat::G4IonisParamMat(const G4Mater << 54 G4IonisParamMat::G4IonisParamMat(G4Material* material) >> 55 : fMaterial(material) 60 { 56 { 61 fBirks = 0.; 57 fBirks = 0.; 62 fMeanEnergyPerIon = 0.0; 58 fMeanEnergyPerIon = 0.0; 63 twoln10 = 2. * G4Pow::GetInstance()->logZ(10 << 64 59 65 // minimal set of default parameters for den 60 // minimal set of default parameters for density effect 66 fCdensity = 0.0; 61 fCdensity = 0.0; 67 fD0density = 0.0; 62 fD0density = 0.0; 68 fAdjustmentFactor = 1.0; 63 fAdjustmentFactor = 1.0; 69 if (fDensityData == nullptr) { << 64 if(!fDensityData) { fDensityData = new G4DensityEffectData(); } 70 fDensityData = new G4DensityEffectData(); << 71 } << 72 fDensityEffectCalc = nullptr; << 73 65 74 // compute parameters 66 // compute parameters 75 ComputeMeanParameters(); 67 ComputeMeanParameters(); 76 ComputeDensityEffectParameters(); << 68 ComputeDensityEffect(); 77 ComputeFluctModel(); 69 ComputeFluctModel(); 78 ComputeIonParameters(); 70 ComputeIonParameters(); 79 } 71 } 80 72 81 //....oooOO0OOooo........oooOO0OOooo........oo 73 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... 82 74 83 G4IonisParamMat::~G4IonisParamMat() << 75 // Fake default constructor - sets only member data and allocates memory 84 { << 76 // for usage restricted to object persistency 85 delete fDensityEffectCalc; << 86 delete[] fShellCorrectionVector; << 87 delete fDensityData; << 88 fDensityData = nullptr; << 89 fShellCorrectionVector = nullptr; << 90 fDensityEffectCalc = nullptr; << 91 } << 92 << 93 //....oooOO0OOooo........oooOO0OOooo........oo << 94 77 95 G4double G4IonisParamMat::GetDensityCorrection << 78 G4IonisParamMat::G4IonisParamMat(__void__&) >> 79 : fMaterial(0), fShellCorrectionVector(0) 96 { 80 { 97 // x = log10(beta*gamma) << 81 fMeanExcitationEnergy = 0.0; 98 G4double y = 0.0; << 82 fLogMeanExcEnergy = 0.0; 99 if (x < fX0density) { << 83 fTaul = 0.0; 100 if (fD0density > 0.0) { << 84 fCdensity = 0.0; 101 y = fD0density * G4Exp(twoln10 * (x - fX << 85 fMdensity = 0.0; 102 } << 86 fAdensity = 0.0; 103 } << 87 fX0density = 0.0; 104 else if (x >= fX1density) { << 88 fX1density = 0.0; 105 y = twoln10 * x - fCdensity; << 89 fD0density = 0.0; 106 } << 90 fPlasmaEnergy = 0.0; 107 else { << 91 fAdjustmentFactor = 0.0; 108 y = twoln10 * x - fCdensity + fAdensity * << 92 fF1fluct = 0.0; 109 } << 93 fF2fluct = 0.0; 110 return y; << 94 fEnergy1fluct = 0.0; >> 95 fLogEnergy1fluct = 0.0; >> 96 fEnergy2fluct = 0.0; >> 97 fLogEnergy2fluct = 0.0; >> 98 fEnergy0fluct = 0.0; >> 99 fRateionexcfluct = 0.0; >> 100 fZeff = 0.0; >> 101 fFermiEnergy = 0.0; >> 102 fLfactor = 0.0; >> 103 fInvA23 = 0.0; >> 104 fBirks = 0.0; >> 105 fMeanEnergyPerIon = 0.0; 111 } 106 } 112 107 113 //....oooOO0OOooo........oooOO0OOooo........oo 108 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... 114 109 115 void G4IonisParamMat::ComputeMeanParameters() 110 void G4IonisParamMat::ComputeMeanParameters() 116 { 111 { 117 // compute mean excitation energy and shell 112 // compute mean excitation energy and shell correction vector >> 113 118 fTaul = (*(fMaterial->GetElementVector()))[0 114 fTaul = (*(fMaterial->GetElementVector()))[0]->GetIonisation()->GetTaul(); 119 115 120 std::size_t nElements = fMaterial->GetNumber << 116 fMeanExcitationEnergy = 0.; >> 117 fLogMeanExcEnergy = 0.; >> 118 >> 119 size_t nElements = fMaterial->GetNumberOfElements(); 121 const G4ElementVector* elmVector = fMaterial 120 const G4ElementVector* elmVector = fMaterial->GetElementVector(); 122 const G4double* nAtomsPerVolume = fMaterial- 121 const G4double* nAtomsPerVolume = fMaterial->GetVecNbOfAtomsPerVolume(); 123 122 124 fMeanExcitationEnergy = FindMeanExcitationEn << 123 const G4String ch = fMaterial->GetChemicalFormula(); 125 fLogMeanExcEnergy = 0.; << 124 >> 125 if(ch != "") { fMeanExcitationEnergy = FindMeanExcitationEnergy(ch); } 126 126 127 // Chemical formula defines mean excitation 127 // Chemical formula defines mean excitation energy 128 if (fMeanExcitationEnergy > 0.0) { << 128 if(fMeanExcitationEnergy > 0.0) { 129 fLogMeanExcEnergy = G4Log(fMeanExcitationE << 129 fLogMeanExcEnergy = std::log(fMeanExcitationEnergy); 130 130 131 // Compute average << 131 // Compute average 132 } << 132 } else { 133 else { << 133 for (size_t i=0; i < nElements; i++) { 134 for (std::size_t i = 0; i < nElements; ++i << 135 const G4Element* elm = (*elmVector)[i]; 134 const G4Element* elm = (*elmVector)[i]; 136 fLogMeanExcEnergy += << 135 fLogMeanExcEnergy += nAtomsPerVolume[i]*elm->GetZ() 137 nAtomsPerVolume[i] * elm->GetZ() * G4L << 136 *std::log(elm->GetIonisation()->GetMeanExcitationEnergy()); 138 } 137 } 139 fLogMeanExcEnergy /= fMaterial->GetTotNbOf 138 fLogMeanExcEnergy /= fMaterial->GetTotNbOfElectPerVolume(); 140 fMeanExcitationEnergy = G4Exp(fLogMeanExcE << 139 fMeanExcitationEnergy = std::exp(fLogMeanExcEnergy); 141 } 140 } 142 141 143 fShellCorrectionVector = new G4double[3]; << 142 fShellCorrectionVector = new G4double[3]; 144 143 145 for (G4int j = 0; j <= 2; ++j) { << 144 for (G4int j=0; j<=2; j++) >> 145 { 146 fShellCorrectionVector[j] = 0.; 146 fShellCorrectionVector[j] = 0.; 147 147 148 for (std::size_t k = 0; k < nElements; ++k << 148 for (size_t k=0; k<nElements; k++) { 149 fShellCorrectionVector[j] += << 149 fShellCorrectionVector[j] += nAtomsPerVolume[k] 150 nAtomsPerVolume[k] * (((*elmVector)[k] << 150 *(((*elmVector)[k])->GetIonisation()->GetShellCorrectionVector())[j]; 151 } 151 } 152 fShellCorrectionVector[j] *= 2.0 / fMateri << 152 fShellCorrectionVector[j] *= 2.0/fMaterial->GetTotNbOfElectPerVolume(); 153 } << 153 } 154 } 154 } 155 155 156 //....oooOO0OOooo........oooOO0OOooo........oo 156 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... 157 157 158 G4DensityEffectData* G4IonisParamMat::GetDensi << 158 G4DensityEffectData* G4IonisParamMat::GetDensityEffectData() >> 159 { 159 return fDensityData; 160 return fDensityData; 160 } 161 } 161 162 162 //....oooOO0OOooo........oooOO0OOooo........oo 163 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... 163 << 164 164 void G4IonisParamMat::ComputeDensityEffectPara << 165 void G4IonisParamMat::ComputeDensityEffect() 165 { 166 { >> 167 static const G4double twoln10 = 2.*std::log(10.); 166 G4State State = fMaterial->GetState(); 168 G4State State = fMaterial->GetState(); 167 G4double density = fMaterial->GetDensity(); << 168 169 169 // Check if density effect data exist in the 170 // Check if density effect data exist in the table 170 // R.M. Sternheimer, Atomic Data and Nuclear 171 // R.M. Sternheimer, Atomic Data and Nuclear Data Tables, 30: 261 (1984) 171 // or is assign to one of data set in this t << 172 G4int idx = fDensityData->GetIndex(fMaterial 172 G4int idx = fDensityData->GetIndex(fMaterial->GetName()); 173 auto nelm = (G4int)fMaterial->GetNumberOfEle << 173 if(idx < 0 && fMaterial->GetNumberOfElements() == 1) { 174 G4int Z0 = ((*(fMaterial->GetElementVector() << 174 idx = fDensityData->GetElementIndex(G4int(fMaterial->GetZ()), 175 const G4Material* bmat = fMaterial->GetBaseM << 175 fMaterial->GetState()); 176 G4NistManager* nist = G4NistManager::Instanc << 177 << 178 // arbitrary empirical limits << 179 // parameterisation with very different dens << 180 static const G4double corrmax = 1.; << 181 static const G4double massfracmax = 0.9; << 182 << 183 // for simple non-NIST materials << 184 G4double corr = 0.0; << 185 << 186 if (idx < 0 && 1 == nelm) { << 187 G4int z = (1 == Z0 && State == kStateLiqui << 188 idx = fDensityData->GetElementIndex(z); << 189 << 190 // Correction for base material or for non << 191 // Except cases of very different density << 192 if (idx >= 0 && 0 < z) { << 193 G4double dens = nist->GetNominalDensity( << 194 if (dens <= 0.0) { << 195 idx = -1; << 196 } << 197 else { << 198 corr = G4Log(dens / density); << 199 if (std::abs(corr) > corrmax) { << 200 idx = -1; << 201 } << 202 } << 203 } << 204 } << 205 // for base material case << 206 if (idx < 0 && nullptr != bmat) { << 207 idx = fDensityData->GetIndex(bmat->GetName << 208 if (idx >= 0) { << 209 corr = G4Log(bmat->GetDensity() / densit << 210 if (std::abs(corr) > corrmax) { << 211 idx = -1; << 212 } << 213 } << 214 } 176 } 215 177 216 // for compound non-NIST materials with one << 178 //G4cout<<"DensityEffect for "<<fMaterial->GetName()<<" "<< idx << G4endl; 217 if (idx < 0 && 1 < nelm) { << 179 218 const G4double tot = fMaterial->GetTotNbOf << 180 if(idx >= 0) { 219 for (G4int i = 0; i < nelm; ++i) { << 220 const G4double frac = fMaterial->GetVecN << 221 if (frac > massfracmax) { << 222 Z0 = ((*(fMaterial->GetElementVector() << 223 idx = fDensityData->GetElementIndex(Z0 << 224 G4double dens = nist->GetNominalDensit << 225 if (idx >= 0 && dens > 0.0) { << 226 corr = G4Log(dens / density); << 227 if (std::abs(corr) > corrmax) { << 228 idx = -1; << 229 } << 230 else { << 231 break; << 232 } << 233 } << 234 } << 235 } << 236 } << 237 181 238 if (idx >= 0) { << 239 // Take parameters for the density effect 182 // Take parameters for the density effect correction from 240 // R.M. Sternheimer et al. Density Effect << 183 // R.M. Sternheimer et al. Density Effect For The Ionization Loss 241 // of Charged Particles in Various Substan << 184 // of Charged Particles in Various Substances. 242 // Atom. Data Nucl. Data Tabl. 30 (1984) 2 << 185 // Atom. Data Nucl. Data Tabl. 30 (1984) 261-271. 243 186 244 fCdensity = fDensityData->GetCdensity(idx) << 187 fCdensity = fDensityData->GetCdensity(idx); 245 fMdensity = fDensityData->GetMdensity(idx) 188 fMdensity = fDensityData->GetMdensity(idx); 246 fAdensity = fDensityData->GetAdensity(idx) 189 fAdensity = fDensityData->GetAdensity(idx); 247 fX0density = fDensityData->GetX0density(id 190 fX0density = fDensityData->GetX0density(idx); 248 fX1density = fDensityData->GetX1density(id 191 fX1density = fDensityData->GetX1density(idx); 249 fD0density = fDensityData->GetDelta0densit 192 fD0density = fDensityData->GetDelta0density(idx); 250 fPlasmaEnergy = fDensityData->GetPlasmaEne 193 fPlasmaEnergy = fDensityData->GetPlasmaEnergy(idx); 251 fAdjustmentFactor = fDensityData->GetAdjus 194 fAdjustmentFactor = fDensityData->GetAdjustmentFactor(idx); 252 195 253 // parameter C is computed and not taken f << 196 } else { 254 // fCdensity = 1. + 2*G4Log(fMeanExcitatio << 197 255 // G4cout << "IonisParamMat: " << fMateria << 198 const G4double Cd2 = 4*pi*hbarc_squared*classic_electr_radius; 256 // << " Cst= " << Cdensity << " C= " << 199 fPlasmaEnergy = std::sqrt(Cd2*fMaterial->GetTotNbOfElectPerVolume()); 257 << 258 // correction on nominal density << 259 fCdensity += corr; << 260 fX0density += corr / twoln10; << 261 fX1density += corr / twoln10; << 262 } << 263 else { << 264 static const G4double Cd2 = 4 * CLHEP::pi << 265 fPlasmaEnergy = std::sqrt(Cd2 * fMaterial- << 266 200 267 // Compute parameters for the density effe 201 // Compute parameters for the density effect correction in DE/Dx formula. 268 // The parametrization is from R.M. Sternh 202 // The parametrization is from R.M. Sternheimer, Phys. Rev.B,3:3681 (1971) 269 G4int icase; 203 G4int icase; >> 204 >> 205 fCdensity = 1. + 2*std::log(fMeanExcitationEnergy/fPlasmaEnergy); >> 206 >> 207 //fCdensity = 1. + std::log(fMeanExcitationEnergy*fMeanExcitationEnergy >> 208 // /(Cd2*fMaterial->GetTotNbOfElectPerVolume())); 270 209 271 fCdensity = 1. + 2 * G4Log(fMeanExcitation << 272 // 210 // 273 // condensed materials 211 // condensed materials 274 // 212 // 275 if ((State == kStateSolid) || (State == kS << 213 276 static const G4double E100eV = 100. * CL << 214 if ((State == kStateSolid)||(State == kStateLiquid)) { 277 static const G4double ClimiS[] = {3.681, << 278 static const G4double X0valS[] = {1.0, 1 << 279 static const G4double X1valS[] = {2.0, 3 << 280 215 281 if (fMeanExcitationEnergy < E100eV) { << 216 const G4double E100eV = 100.*eV; 282 icase = 0; << 217 const G4double ClimiS[] = {3.681 , 5.215 }; 283 } << 218 const G4double X0valS[] = {1.0 , 1.5 }; 284 else { << 219 const G4double X1valS[] = {2.0 , 3.0 }; 285 icase = 1; << 220 286 } << 221 if(fMeanExcitationEnergy < E100eV) icase = 0; 287 << 222 else icase = 1; 288 if (fCdensity < ClimiS[icase]) { << 223 289 fX0density = 0.2; << 224 if(fCdensity < ClimiS[icase]) fX0density = 0.2; 290 } << 225 else fX0density = 0.326*fCdensity-X0valS[icase]; 291 else { << 226 292 fX0density = 0.326 * fCdensity - X0val << 227 fX1density = X1valS[icase] ; fMdensity = 3.0; 293 } << 228 294 << 229 //special: Hydrogen 295 fX1density = X1valS[icase]; << 230 if ((fMaterial->GetNumberOfElements()==1)&&(fMaterial->GetZ()==1.)) { 296 fMdensity = 3.0; << 231 fX0density = 0.425; fX1density = 2.0; fMdensity = 5.949; 297 << 298 // special: Hydrogen << 299 if (1 == nelm && 1 == Z0) { << 300 fX0density = 0.425; << 301 fX1density = 2.0; << 302 fMdensity = 5.949; << 303 } 232 } 304 } 233 } 305 else { << 306 // << 307 // gases << 308 // << 309 fMdensity = 3.; << 310 fX1density = 4.0; << 311 << 312 if (fCdensity <= 10.) { << 313 fX0density = 1.6; << 314 } << 315 else if (fCdensity <= 10.5) { << 316 fX0density = 1.7; << 317 } << 318 else if (fCdensity <= 11.0) { << 319 fX0density = 1.8; << 320 } << 321 else if (fCdensity <= 11.5) { << 322 fX0density = 1.9; << 323 } << 324 else if (fCdensity <= 12.25) { << 325 fX0density = 2.0; << 326 } << 327 else if (fCdensity <= 13.804) { << 328 fX0density = 2.0; << 329 fX1density = 5.0; << 330 } << 331 else { << 332 fX0density = 0.326 * fCdensity - 2.5; << 333 fX1density = 5.0; << 334 } << 335 234 336 // special: Hydrogen << 235 // 337 if (1 == nelm && 1 == Z0) { << 236 // gases 338 fX0density = 1.837; << 237 // 339 fX1density = 3.0; << 238 if (State == kStateGas) { 340 fMdensity = 4.754; << 341 } << 342 239 343 // special: Helium << 240 const G4double ClimiG[] = { 10. , 10.5 , 11. , 11.5 , 12.25 , 13.804}; 344 if (1 == nelm && 2 == Z0) { << 241 const G4double X0valG[] = { 1.6 , 1.7 , 1.8 , 1.9 , 2.0 , 2.0 }; 345 fX0density = 2.191; << 242 const G4double X1valG[] = { 4.0 , 4.0 , 4.0 , 4.0 , 4.0 , 5.0 }; 346 fX1density = 3.0; << 243 347 fMdensity = 3.297; << 244 icase = 5; >> 245 fX0density = 0.326*fCdensity-2.5 ; fX1density = 5.0 ; fMdensity = 3. ; >> 246 while((icase > 0)&&(fCdensity < ClimiG[icase])) icase-- ; >> 247 fX0density = X0valG[icase] ; fX1density = X1valG[icase] ; >> 248 >> 249 //special: Hydrogen >> 250 if ((fMaterial->GetNumberOfElements()==1)&&(fMaterial->GetZ()==1.)) { >> 251 fX0density = 1.837; fX1density = 3.0; fMdensity = 4.754; >> 252 } >> 253 >> 254 //special: Helium >> 255 if ((fMaterial->GetNumberOfElements()==1)&&(fMaterial->GetZ()==2.)) { >> 256 fX0density = 2.191; fX1density = 3.0; fMdensity = 3.297; 348 } 257 } 349 } 258 } 350 } 259 } 351 260 352 // change parameters if the gas is not in ST 261 // change parameters if the gas is not in STP. 353 // For the correction the density(STP) is ne << 262 // For the correction the density(STP) is needed. 354 // Density(STP) is calculated here : << 263 // Density(STP) is calculated here : 355 << 264 356 if (State == kStateGas) { << 265 >> 266 if (State == kStateGas) { >> 267 G4double Density = fMaterial->GetDensity(); 357 G4double Pressure = fMaterial->GetPressure 268 G4double Pressure = fMaterial->GetPressure(); 358 G4double Temp = fMaterial->GetTemperature( << 269 G4double Temp = fMaterial->GetTemperature(); 359 << 270 360 G4double DensitySTP = density * STP_Pressu << 271 G4double DensitySTP = Density*STP_Pressure*Temp/(Pressure*STP_Temperature); 361 << 272 362 G4double ParCorr = G4Log(density / Density << 273 G4double ParCorr = std::log(Density/DensitySTP); 363 << 274 364 fCdensity -= ParCorr; << 275 fCdensity -= ParCorr; 365 fX0density -= ParCorr / twoln10; << 276 fX0density -= ParCorr/twoln10; 366 fX1density -= ParCorr / twoln10; << 277 fX1density -= ParCorr/twoln10; 367 } << 278 } 368 << 279 369 // fAdensity parameter can be fixed for not << 280 // fAdensity parameter can be fixed for not conductive materials 370 if (0.0 == fD0density) { << 281 if(0.0 == fD0density) { 371 G4double Xa = fCdensity / twoln10; << 282 G4double Xa = fCdensity/twoln10; 372 fAdensity = twoln10 * (Xa - fX0density) / << 283 fAdensity = twoln10*(Xa-fX0density) 373 } << 284 /std::pow((fX1density-fX0density),fMdensity); >> 285 } >> 286 /* >> 287 G4cout << "G4IonisParamMat: density effect data for <" << fMaterial->GetName() >> 288 << "> " << G4endl; >> 289 G4cout << "Eplasma(eV)= " << fPlasmaEnergy/eV >> 290 << " rho= " << fAdjustmentFactor >> 291 << " -C= " << fCdensity >> 292 << " x0= " << fX0density >> 293 << " x1= " << fX1density >> 294 << " a= " << fAdensity >> 295 << " m= " << fMdensity >> 296 << G4endl; >> 297 */ 374 } 298 } 375 299 376 //....oooOO0OOooo........oooOO0OOooo........oo 300 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... 377 301 378 void G4IonisParamMat::ComputeFluctModel() 302 void G4IonisParamMat::ComputeFluctModel() 379 { 303 { 380 // compute parameters for the energy loss fl 304 // compute parameters for the energy loss fluctuation model 381 // needs an 'effective Z' << 305 // needs an 'effective Z' 382 G4double Zeff = 0.; 306 G4double Zeff = 0.; 383 for (std::size_t i = 0; i < fMaterial->GetNu << 307 for (size_t i=0;i<fMaterial->GetNumberOfElements();i++) { 384 Zeff += (fMaterial->GetFractionVector())[i << 308 Zeff += (fMaterial->GetFractionVector())[i] 385 } << 309 *((*(fMaterial->GetElementVector()))[i]->GetZ()); 386 if (Zeff > 2.1) { << 310 } 387 fF2fluct = 2.0 / Zeff; << 311 if (Zeff > 2.) fF2fluct = 2./Zeff ; 388 fF1fluct = 1. - fF2fluct; << 312 else fF2fluct = 0.; 389 fEnergy2fluct = 10. * Zeff * Zeff * CLHEP: << 313 390 fLogEnergy2fluct = G4Log(fEnergy2fluct); << 314 fF1fluct = 1. - fF2fluct; 391 fLogEnergy1fluct = (fLogMeanExcEnergy - fF << 315 fEnergy2fluct = 10.*Zeff*Zeff*eV; 392 } else if (Zeff > 1.1) { << 316 fLogEnergy2fluct = std::log(fEnergy2fluct); 393 fF2fluct = 0.0; << 317 fLogEnergy1fluct = (fLogMeanExcEnergy - fF2fluct*fLogEnergy2fluct) 394 fF1fluct = 1.0; << 318 /fF1fluct; 395 fEnergy2fluct = 40. * CLHEP::eV; << 319 fEnergy1fluct = std::exp(fLogEnergy1fluct); 396 fLogEnergy2fluct = G4Log(fEnergy2fluct); << 320 fEnergy0fluct = 10.*eV; 397 fLogEnergy1fluct = fLogMeanExcEnergy; << 398 } else { << 399 fF2fluct = 0.0; << 400 fF1fluct = 1.0; << 401 fEnergy2fluct = 10. * CLHEP::eV; << 402 fLogEnergy2fluct = G4Log(fEnergy2fluct); << 403 fLogEnergy1fluct = fLogMeanExcEnergy; << 404 } << 405 fEnergy1fluct = G4Exp(fLogEnergy1fluct); << 406 fEnergy0fluct = 10. * CLHEP::eV; << 407 fRateionexcfluct = 0.4; 321 fRateionexcfluct = 0.4; 408 } 322 } 409 323 410 //....oooOO0OOooo........oooOO0OOooo........oo 324 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... 411 325 412 void G4IonisParamMat::ComputeIonParameters() 326 void G4IonisParamMat::ComputeIonParameters() 413 { 327 { 414 // get elements in the actual material, 328 // get elements in the actual material, 415 const G4ElementVector* theElementVector = fM << 329 const G4ElementVector* theElementVector = fMaterial->GetElementVector() ; 416 const G4double* theAtomicNumDensityVector = << 330 const G4double* theAtomicNumDensityVector = 417 const auto NumberOfElements = (G4int)fMateri << 331 fMaterial->GetAtomicNumDensityVector() ; >> 332 const G4int NumberOfElements = fMaterial->GetNumberOfElements() ; 418 333 419 // loop for the elements in the material 334 // loop for the elements in the material 420 // to find out average values Z, vF, lF 335 // to find out average values Z, vF, lF 421 G4double z(0.0), vF(0.0), lF(0.0), a23(0.0); << 336 G4double z(0.0), vF(0.0), lF(0.0), norm(0.0), a23(0.0); 422 337 423 G4Pow* g4pow = G4Pow::GetInstance(); << 338 if( 1 == NumberOfElements ) { 424 if (1 == NumberOfElements) { << 425 const G4Element* element = (*theElementVec 339 const G4Element* element = (*theElementVector)[0]; 426 z = element->GetZ(); 340 z = element->GetZ(); 427 vF = element->GetIonisation()->GetFermiVel << 341 vF= element->GetIonisation()->GetFermiVelocity(); 428 lF = element->GetIonisation()->GetLFactor( << 342 lF= element->GetIonisation()->GetLFactor(); 429 a23 = 1.0 / g4pow->A23(element->GetN()); << 343 a23 = std::pow(element->GetN(),-2./3.); 430 } << 344 431 else { << 345 } else { 432 G4double norm(0.0); << 346 for (G4int iel=0; iel<NumberOfElements; iel++) 433 for (G4int iel = 0; iel < NumberOfElements << 347 { 434 const G4Element* element = (*theElementV << 348 const G4Element* element = (*theElementVector)[iel] ; 435 const G4double weight = theAtomicNumDens << 349 const G4double weight = theAtomicNumDensityVector[iel] ; 436 norm += weight; << 350 norm += weight ; 437 z += element->GetZ() * weight; << 351 z += element->GetZ() * weight ; 438 vF += element->GetIonisation()->GetFermi << 352 vF += element->GetIonisation()->GetFermiVelocity() * weight ; 439 lF += element->GetIonisation()->GetLFact << 353 lF += element->GetIonisation()->GetLFactor() * weight ; 440 a23 += weight / g4pow->A23(element->GetN << 354 a23 += std::pow(element->GetN(),-2./3.) * weight ; 441 } << 355 } 442 if (norm > 0.0) { norm = 1.0/norm; } << 356 z /= norm; 443 z *= norm; << 357 vF /= norm; 444 vF *= norm; << 358 lF /= norm; 445 lF *= norm; << 359 a23 /= norm; 446 a23 *= norm; << 360 } 447 } << 361 fZeff = z; 448 fZeff = z; << 362 fLfactor = lF; 449 fLfactor = lF; << 363 fFermiEnergy = 25.*keV*vF*vF; 450 fFermiEnergy = 25. * CLHEP::keV * vF * vF; << 364 fInvA23 = a23; 451 fInvA23 = a23; << 452 } 365 } 453 366 454 //....oooOO0OOooo........oooOO0OOooo........oo 367 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... 455 368 456 void G4IonisParamMat::SetMeanExcitationEnergy( 369 void G4IonisParamMat::SetMeanExcitationEnergy(G4double value) 457 { 370 { 458 if (value == fMeanExcitationEnergy || value << 371 if(value == fMeanExcitationEnergy || value <= 0.0) { return; } 459 return; << 460 } << 461 if (G4NistManager::Instance()->GetVerbose() << 462 G4cout << "G4Material: Mean excitation ene << 463 << " Iold= " << fMeanExcitationEner << 464 << G4endl; << 465 } << 466 372 >> 373 /* >> 374 if (G4NistManager::Instance()->GetVerbose() > 0) >> 375 G4cout << "G4Material: Mean excitation energy is changed for " >> 376 << fMaterial->GetName() >> 377 << " Iold= " << fMeanExcitationEnergy/eV >> 378 << "eV; Inew= " << value/eV << " eV;" >> 379 << G4endl; >> 380 */ >> 381 467 fMeanExcitationEnergy = value; 382 fMeanExcitationEnergy = value; >> 383 fLogMeanExcEnergy = std::log(value); >> 384 ComputeDensityEffect(); >> 385 ComputeFluctModel(); >> 386 } 468 387 469 // add corrections to density effect << 388 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... 470 G4double newlog = G4Log(value); << 471 G4double corr = 2 * (newlog - fLogMeanExcEne << 472 fCdensity += corr; << 473 fX0density += corr / twoln10; << 474 fX1density += corr / twoln10; << 475 389 476 // recompute parameters of fluctuation model << 390 G4double G4IonisParamMat::FindMeanExcitationEnergy(const G4String& chFormula) 477 fLogMeanExcEnergy = newlog; << 391 { 478 ComputeFluctModel(); << 392 >> 393 // The data on mean excitation energy for compaunds >> 394 // from "Stopping Powers for Electrons and Positrons" >> 395 // ICRU Report N#37, 1984 (energy in eV) >> 396 >> 397 const size_t numberOfMolecula = 79 ; >> 398 >> 399 static G4String name[numberOfMolecula] = { >> 400 >> 401 // gas >> 402 "NH_3", "C_4H_10", "CO_2", "C_2H_6", "C_7H_16", >> 403 "C_6H_14", "CH_4", "NO", "N_2O", "C_8H_18", >> 404 "C_5H_12", "C_3H_8", "H_2O-Gas", >> 405 >> 406 // liquid >> 407 "C_3H_6O", "C_6H_5NH_2", "C_6H_6", "C_4H_9OH", "CCl_4", >> 408 "C_6H_5Cl", "CHCl_3", "C_6H_12", "C_6H_4Cl_2", "C_4Cl_2H_8O", >> 409 "C_2Cl_2H_4", "(C_2H_5)_2O", "C_2H_5OH", "C_3H_5(OH)_3","C_7H_16", >> 410 "C_6H_14", "CH_3OH", "C_6H_5NO_2","C_5H_12", "C_3H_7OH", >> 411 "C_5H_5N", "C_8H_8", "C_2Cl_4", "C_7H_8", "C_2Cl_3H", >> 412 "H_2O", "C_8H_10", >> 413 >> 414 //solid >> 415 "C_5H_5N_5", "C_5H_5N_5O", "(C_6H_11NO)-nylon", "C_25H_52", >> 416 "(C_2H_4)-Polyethylene", "(C_5H_8O-2)-Polymethil_Methacrylate", >> 417 "(C_8H_8)-Polystyrene", "A-150-tissue", "Al_2O_3", "CaF_2", >> 418 "LiF", "Photo_Emulsion", "(C_2F_4)-Teflon", "SiO_2" >> 419 >> 420 } ; >> 421 >> 422 static G4double meanExcitation[numberOfMolecula] = { >> 423 >> 424 53.7, 48.3, 85.0, 45.4, 49.2, >> 425 49.1, 41.7, 87.8, 84.9, 49.5, >> 426 48.2, 47.1, 71.6, >> 427 >> 428 64.2, 66.2, 63.4, 59.9, 166.3, >> 429 89.1, 156.0, 56.4, 106.5, 103.3, >> 430 111.9, 60.0, 62.9, 72.6, 54.4, >> 431 54.0, 67.6, 75.8, 53.6, 61.1, >> 432 66.2, 64.0, 159.2, 62.5, 148.1, >> 433 75.0, 61.8, >> 434 >> 435 71.4, 75.0, 63.9, 48.3, 57.4, >> 436 74.0, 68.7, 65.1, 145.2, 166., >> 437 94.0, 331.0, 99.1, 139.2 >> 438 >> 439 } ; >> 440 >> 441 G4double x = fMeanExcitationEnergy; >> 442 >> 443 for(size_t i=0; i<numberOfMolecula; i++) { >> 444 if(chFormula == name[i]) { >> 445 x = meanExcitation[i]*eV; >> 446 break; >> 447 } >> 448 } >> 449 return x; 479 } 450 } 480 451 481 //....oooOO0OOooo........oooOO0OOooo........oo 452 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... 482 453 483 void G4IonisParamMat::SetDensityEffectParamete << 454 G4IonisParamMat::~G4IonisParamMat() 484 G4double cd, G4double md, G4double ad, G4dou << 485 { 455 { 486 // no check on consistence of user parameter << 456 if (fShellCorrectionVector) { delete [] fShellCorrectionVector; } 487 G4AutoLock l(&ionisMutex); << 457 if (fDensityData) { delete fDensityData; } 488 fCdensity = cd; << 458 fDensityData = 0; 489 fMdensity = md; << 459 fShellCorrectionVector = 0; 490 fAdensity = ad; << 491 fX0density = x0; << 492 fX1density = x1; << 493 fD0density = d0; << 494 l.unlock(); << 495 } 460 } 496 461 497 //....oooOO0OOooo........oooOO0OOooo........oo 462 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... 498 463 499 void G4IonisParamMat::SetDensityEffectParamete << 464 G4IonisParamMat::G4IonisParamMat(const G4IonisParamMat& right) 500 { << 465 { 501 G4AutoLock l(&ionisMutex); << 466 fShellCorrectionVector = 0; 502 const G4IonisParamMat* ipm = bmat->GetIonisa << 467 fMaterial = 0; 503 fCdensity = ipm->GetCdensity(); << 468 *this = right; 504 fMdensity = ipm->GetMdensity(); << 505 fAdensity = ipm->GetAdensity(); << 506 fX0density = ipm->GetX0density(); << 507 fX1density = ipm->GetX1density(); << 508 fD0density = ipm->GetD0density(); << 509 << 510 G4double corr = G4Log(bmat->GetDensity() / f << 511 fCdensity += corr; << 512 fX0density += corr / twoln10; << 513 fX1density += corr / twoln10; << 514 l.unlock(); << 515 } << 516 << 517 //....oooOO0OOooo........oooOO0OOooo........oo << 518 << 519 void G4IonisParamMat::ComputeDensityEffectOnFl << 520 { << 521 if (val) { << 522 if (nullptr == fDensityEffectCalc) { << 523 G4int n = 0; << 524 for (std::size_t i = 0; i < fMaterial->G << 525 const G4int Z = fMaterial->GetElement( << 526 n += G4AtomicShells::GetNumberOfShells << 527 } << 528 // The last level is the conduction leve << 529 // make a dummy conductor level with zer << 530 fDensityEffectCalc = new G4DensityEffect << 531 } << 532 } << 533 else { << 534 delete fDensityEffectCalc; << 535 fDensityEffectCalc = nullptr; << 536 } << 537 } 469 } 538 470 539 //....oooOO0OOooo........oooOO0OOooo........oo 471 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... 540 472 541 G4double G4IonisParamMat::FindMeanExcitationEn << 473 const G4IonisParamMat& G4IonisParamMat::operator=(const G4IonisParamMat& right) 542 { 474 { 543 G4double res = 0.0; << 475 if (this != &right) 544 // data from density effect data << 476 { 545 if (fDensityData != nullptr) { << 477 fMaterial = right.fMaterial; 546 G4int idx = fDensityData->GetIndex(mat->Ge << 478 fMeanExcitationEnergy = right.fMeanExcitationEnergy; 547 if (idx >= 0) { << 479 fLogMeanExcEnergy = right.fLogMeanExcEnergy; 548 res = fDensityData->GetMeanIonisationPot << 480 if(fShellCorrectionVector){ delete [] fShellCorrectionVector; } 549 } << 481 fShellCorrectionVector = new G4double[3]; 550 } << 482 fShellCorrectionVector[0] = right.fShellCorrectionVector[0]; >> 483 fShellCorrectionVector[1] = right.fShellCorrectionVector[1]; >> 484 fShellCorrectionVector[2] = right.fShellCorrectionVector[2]; >> 485 fTaul = right.fTaul; >> 486 fCdensity = right.fCdensity; >> 487 fMdensity = right.fMdensity; >> 488 fAdensity = right.fAdensity; >> 489 fX0density = right.fX0density; >> 490 fX1density = right.fX1density; >> 491 fD0density = right.fD0density; >> 492 fPlasmaEnergy = right.fPlasmaEnergy; >> 493 fAdjustmentFactor = right.fAdjustmentFactor; >> 494 fF1fluct = right.fF1fluct; >> 495 fF2fluct = right.fF2fluct; >> 496 fEnergy1fluct = right.fEnergy1fluct; >> 497 fLogEnergy1fluct = right.fLogEnergy1fluct; >> 498 fEnergy2fluct = right.fEnergy2fluct; >> 499 fLogEnergy2fluct = right.fLogEnergy2fluct; >> 500 fEnergy0fluct = right.fEnergy0fluct; >> 501 fRateionexcfluct = right.fRateionexcfluct; >> 502 fZeff = right.fZeff; >> 503 fFermiEnergy = right.fFermiEnergy; >> 504 fLfactor = right.fLfactor; >> 505 fInvA23 = right.fInvA23; >> 506 fBirks = right.fBirks; >> 507 fMeanEnergyPerIon = right.fMeanEnergyPerIon; >> 508 fDensityData = right.fDensityData; >> 509 } >> 510 return *this; >> 511 } 551 512 552 // The data on mean excitation energy for co << 513 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... 553 // from "Stopping Powers for Electrons and P << 514 554 // ICRU Report N#37, 1984 (energy in eV) << 515 G4int G4IonisParamMat::operator==(const G4IonisParamMat& right) const 555 // this value overwrites Density effect data << 516 { 556 G4String chFormula = mat->GetChemicalFormula << 517 return (this == (G4IonisParamMat*) &right); 557 if (! chFormula.empty()) { << 558 static const size_t numberOfMolecula = 54; << 559 // clang-format off << 560 static const G4String name[numberOfMolecul << 561 // gas 0 - 12 << 562 "NH_3", "C_4H_10", "CO_2", << 563 // "G4_AMMONIA", "G4_BUTANE","G4_CARBON_ << 564 "C_6H_14-Gas", "CH_4", "NO", << 565 // "G4_N-HEXANE" , "G4_METHANE", "x", "G << 566 "C_5H_12-Gas", "C_3H_8", "H_2O-Gas", << 567 // "G4_N-PENTANE", "G4_PROPANE", "G4_WAT << 568 << 569 // liquid 13 - 39 << 570 "C_3H_6O", "C_6H_5NH_2", "C_6H_6", << 571 //"G4_ACETONE","G4_ANILINE","G4_BENZENE" << 572 "C_6H_5Cl", "CHCl_3", "C_6H_12", << 573 //"G4_CHLOROBENZENE","G4_CHLOROFORM","G4 << 574 //"G4_DICHLORODIETHYL_ETHER" << 575 "C_2Cl_2H_4", "(C_2H_5)_2O", "C_2H_5OH", << 576 //"G4_1,2-DICHLOROETHANE","G4_DIETHYL_ET << 577 "C_6H_14", "CH_3OH", "C_6H_5NO_2 << 578 //"G4_N-HEXANE","G4_METHANOL","G4_NITROB << 579 "C_5H_5N", "C_8H_8", "C_2Cl_4", << 580 //"G4_PYRIDINE","G4_POLYSTYRENE","G4_TET << 581 "H_2O", "C_8H_10", << 582 // "G4_WATER", "G4_XYLENE" << 583 << 584 // solid 40 - 53 << 585 "C_5H_5N_5", "C_5H_5N_5O", "(C_6H_11NO << 586 // "G4_ADENINE", "G4_GUANINE", "G4_NYLON << 587 "(C_2H_4)-Polyethylene", "(C_5H_8O_2 << 588 // "G4_ETHYLENE", "G4_PLEXIGLASS" << 589 "(C_8H_8)-Polystyrene", "A-150-tiss << 590 // "G4_POLYSTYRENE", "G4_A-150_TISSUE", << 591 "LiF", "Photo_Emulsion", "(C_2F_ << 592 // "G4_LITHIUM_FLUORIDE", "G4_PHOTO_EMUL << 593 } ; << 594 << 595 static const G4double meanExcitation[numbe << 596 << 597 53.7, 48.3, 85.0, 45.4, 49.2, << 598 49.1, 41.7, 87.8, 84.9, 49.5, << 599 48.2, 47.1, 71.6, << 600 << 601 64.2, 66.2, 63.4, 59.9, 166.3, << 602 89.1, 156.0, 56.4, 106.5, 103.3, << 603 111.9, 60.0, 62.9, 72.6, 54.4, << 604 54.0, 67.6, 75.8, 53.6, 61.1, << 605 66.2, 64.0, 159.2, 62.5, 148.1, << 606 75.0, 61.8, << 607 << 608 71.4, 75.0, 63.9, 48.3, 57.4, << 609 74.0, 68.7, 65.1, 145.2, 166., << 610 94.0, 331.0, 99.1, 139.2 << 611 }; << 612 // clang-format on << 613 << 614 for (std::size_t i = 0; i < numberOfMolecu << 615 if (chFormula == name[i]) { << 616 res = meanExcitation[i] * CLHEP::eV; << 617 break; << 618 } << 619 } << 620 } << 621 return res; << 622 } 518 } >> 519 >> 520 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... >> 521 >> 522 G4int G4IonisParamMat::operator!=(const G4IonisParamMat& right) const >> 523 { >> 524 return (this != (G4IonisParamMat*) &right); >> 525 } >> 526 >> 527 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo.... >> 528 623 529