Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/materials/src/G4IonisParamMat.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /materials/src/G4IonisParamMat.cc (Version 11.3.0) and /materials/src/G4IonisParamMat.cc (Version 5.0.p1)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                    <<   3 // * DISCLAIMER                                                       *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th <<   5 // * The following disclaimer summarizes all the specific disclaimers *
  6 // * the Geant4 Collaboration.  It is provided <<   6 // * of contributors to this software. The specific disclaimers,which *
  7 // * conditions of the Geant4 Software License <<   7 // * govern, are listed with their locations in:                      *
  8 // * LICENSE and available at  http://cern.ch/ <<   8 // *   http://cern.ch/geant4/license                                  *
  9 // * include a list of copyright holders.      << 
 10 // *                                                9 // *                                                                  *
 11 // * Neither the authors of this software syst     10 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     11 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     12 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     13 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file  <<  14 // * use.                                                             *
 16 // * for the full disclaimer and the limitatio << 
 17 // *                                               15 // *                                                                  *
 18 // * This  code  implementation is the result  <<  16 // * This  code  implementation is the  intellectual property  of the *
 19 // * technical work of the GEANT4 collaboratio <<  17 // * GEANT4 collaboration.                                            *
 20 // * By using,  copying,  modifying or  distri <<  18 // * By copying,  distributing  or modifying the Program (or any work *
 21 // * any work based  on the software)  you  ag <<  19 // * based  on  the Program)  you indicate  your  acceptance of  this *
 22 // * use  in  resulting  scientific  publicati <<  20 // * statement, and all its terms.                                    *
 23 // * acceptance of all terms of the Geant4 Sof << 
 24 // *******************************************     21 // ********************************************************************
                                                   >>  22 //
                                                   >>  23 //
                                                   >>  24 // $Id: G4IonisParamMat.cc,v 1.10 2002/10/29 16:17:05 vnivanch Exp $
                                                   >>  25 // GEANT4 tag $Name: geant4-05-00 $
                                                   >>  26 //
                                                   >>  27 // 
                                                   >>  28 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
 25                                                    29 
 26 // 09-07-98, data moved from G4Material, M.Mai << 
 27 // 18-07-98, bug corrected in ComputeDensityEf << 
 28 // 16-01-01, bug corrected in ComputeDensityEf << 
 29 // 08-02-01, fShellCorrectionVector correctly  << 
 30 // 28-10-02, add setMeanExcitationEnergy (V.Iv     30 // 28-10-02, add setMeanExcitationEnergy (V.Ivanchenko)
 31 // 06-09-04, factor 2 to shell correction term <<  31 // 08-02-01, fShellCorrectionVector correctly handled (mma)
 32 // 10-05-05, add a missing coma in FindMeanExc <<  32 // 16-01-01, bug corrected in ComputeDensityEffect() E100eV (L.Urban)
 33 // 27-09-07, add computation of parameters for <<  33 // 18-07-98, bug corrected in ComputeDensityEffect() for gas
 34 // 04-03-08, remove reference to G4NistManager <<  34 // 09-07-98, data moved from G4Material, M.Maire
 35 // 30-10-09, add G4DensityEffectData class and << 
 36                                                    35 
 37 #include "G4IonisParamMat.hh"                  <<  36 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
 38                                                    37 
 39 #include "G4AtomicShells.hh"                   <<  38 #include "G4IonisParamMat.hh"
 40 #include "G4AutoLock.hh"                       << 
 41 #include "G4DensityEffectData.hh"              << 
 42 #include "G4Exp.hh"                            << 
 43 #include "G4Log.hh"                            << 
 44 #include "G4Material.hh"                           39 #include "G4Material.hh"
 45 #include "G4NistManager.hh"                    << 
 46 #include "G4PhysicalConstants.hh"              << 
 47 #include "G4Pow.hh"                            << 
 48 #include "G4SystemOfUnits.hh"                  << 
 49                                                << 
 50 G4DensityEffectData* G4IonisParamMat::fDensity << 
 51                                                << 
 52 namespace                                      << 
 53 {                                              << 
 54   G4Mutex ionisMutex = G4MUTEX_INITIALIZER;    << 
 55 }                                              << 
 56                                                    40 
 57 //....oooOO0OOooo........oooOO0OOooo........oo     41 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
 58                                                    42 
 59 G4IonisParamMat::G4IonisParamMat(const G4Mater <<  43 G4IonisParamMat::G4IonisParamMat(G4Material* material)
                                                   >>  44 :fMaterial(material)
 60 {                                                  45 {
 61   fBirks = 0.;                                 << 
 62   fMeanEnergyPerIon = 0.0;                     << 
 63   twoln10 = 2. * G4Pow::GetInstance()->logZ(10 << 
 64                                                << 
 65   // minimal set of default parameters for den << 
 66   fCdensity = 0.0;                             << 
 67   fD0density = 0.0;                            << 
 68   fAdjustmentFactor = 1.0;                     << 
 69   if (fDensityData == nullptr) {               << 
 70     fDensityData = new G4DensityEffectData();  << 
 71   }                                            << 
 72   fDensityEffectCalc = nullptr;                << 
 73                                                << 
 74   // compute parameters                        << 
 75   ComputeMeanParameters();                         46   ComputeMeanParameters();
 76   ComputeDensityEffectParameters();            <<  47   ComputeDensityEffect();
 77   ComputeFluctModel();                             48   ComputeFluctModel();
 78   ComputeIonParameters();                      << 
 79 }                                              << 
 80                                                << 
 81 //....oooOO0OOooo........oooOO0OOooo........oo << 
 82                                                << 
 83 G4IonisParamMat::~G4IonisParamMat()            << 
 84 {                                              << 
 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                                                << 
 95 G4double G4IonisParamMat::GetDensityCorrection << 
 96 {                                              << 
 97   // x = log10(beta*gamma)                     << 
 98   G4double y = 0.0;                            << 
 99   if (x < fX0density) {                        << 
100     if (fD0density > 0.0) {                    << 
101       y = fD0density * G4Exp(twoln10 * (x - fX << 
102     }                                          << 
103   }                                            << 
104   else if (x >= fX1density) {                  << 
105     y = twoln10 * x - fCdensity;               << 
106   }                                            << 
107   else {                                       << 
108     y = twoln10 * x - fCdensity + fAdensity *  << 
109   }                                            << 
110   return y;                                    << 
111 }                                                  49 }
112                                                    50 
113 //....oooOO0OOooo........oooOO0OOooo........oo     51 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
114                                                    52 
115 void G4IonisParamMat::ComputeMeanParameters()      53 void G4IonisParamMat::ComputeMeanParameters()
116 {                                                  54 {
117   // compute mean excitation energy and shell      55   // compute mean excitation energy and shell correction vector
118   fTaul = (*(fMaterial->GetElementVector()))[0 << 
119                                                    56 
120   std::size_t nElements = fMaterial->GetNumber <<  57   fTaul = (*(fMaterial->GetElementVector()))[0]->GetIonisation()->GetTaul();
121   const G4ElementVector* elmVector = fMaterial << 
122   const G4double* nAtomsPerVolume = fMaterial- << 
123                                                    58 
124   fMeanExcitationEnergy = FindMeanExcitationEn <<  59   fMeanExcitationEnergy = 0.;
125   fLogMeanExcEnergy = 0.;                          60   fLogMeanExcEnergy = 0.;
126                                                    61 
127   // Chemical formula defines mean excitation  << 
128   if (fMeanExcitationEnergy > 0.0) {           << 
129     fLogMeanExcEnergy = G4Log(fMeanExcitationE << 
130                                                    62 
131     // Compute average                         <<  63   for (size_t i=0; i < fMaterial->GetNumberOfElements(); i++) {
132   }                                            <<  64     fLogMeanExcEnergy += (fMaterial->GetVecNbOfAtomsPerVolume())[i]
133   else {                                       <<  65                        *((*(fMaterial->GetElementVector()))[i]->GetZ())
134     for (std::size_t i = 0; i < nElements; ++i <<  66                        *log((*(fMaterial->GetElementVector()))[i]->GetIonisation()
135       const G4Element* elm = (*elmVector)[i];  <<  67                       ->GetMeanExcitationEnergy());
136       fLogMeanExcEnergy +=                     << 
137         nAtomsPerVolume[i] * elm->GetZ() * G4L << 
138     }                                          << 
139     fLogMeanExcEnergy /= fMaterial->GetTotNbOf << 
140     fMeanExcitationEnergy = G4Exp(fLogMeanExcE << 
141   }                                                68   }
142                                                    69 
                                                   >>  70   fLogMeanExcEnergy /= fMaterial->GetTotNbOfElectPerVolume();
                                                   >>  71   fMeanExcitationEnergy = exp(fLogMeanExcEnergy);
                                                   >>  72 
143   fShellCorrectionVector = new G4double[3];        73   fShellCorrectionVector = new G4double[3];
144                                                    74 
145   for (G4int j = 0; j <= 2; ++j) {             <<  75   for (G4int j=0; j<=2; j++)
                                                   >>  76   {
146     fShellCorrectionVector[j] = 0.;                77     fShellCorrectionVector[j] = 0.;
147                                                    78 
148     for (std::size_t k = 0; k < nElements; ++k <<  79     for (size_t k=0; k<fMaterial->GetNumberOfElements(); k++)
149       fShellCorrectionVector[j] +=             <<  80       fShellCorrectionVector[j] += (fMaterial->GetVecNbOfAtomsPerVolume())[k] 
150         nAtomsPerVolume[k] * (((*elmVector)[k] <<  81               *((*(fMaterial->GetElementVector()))[k]->GetIonisation()
151     }                                          <<  82                                                      ->GetShellCorrectionVector()[j]);
152     fShellCorrectionVector[j] *= 2.0 / fMateri <<  83      
153   }                                            <<  84     fShellCorrectionVector[j] /= fMaterial->GetTotNbOfElectPerVolume();
                                                   >>  85   } 
154 }                                                  86 }
155                                                    87 
156 //....oooOO0OOooo........oooOO0OOooo........oo     88 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
157                                                <<  89                     
158 G4DensityEffectData* G4IonisParamMat::GetDensi <<  90 void G4IonisParamMat::ComputeDensityEffect()
159   return fDensityData;                         << 
160 }                                              << 
161                                                << 
162 //....oooOO0OOooo........oooOO0OOooo........oo << 
163                                                << 
164 void G4IonisParamMat::ComputeDensityEffectPara << 
165 {                                                  91 {
166   G4State State = fMaterial->GetState();       <<  92   // Compute parameters for the density effect correction in DE/Dx formula.
167   G4double density = fMaterial->GetDensity();  <<  93   // The parametrization is from R.M. Sternheimer, Phys. Rev.B,3:3681 (1971)
168                                                << 
169   // Check if density effect data exist in the << 
170   // R.M. Sternheimer, Atomic Data and Nuclear << 
171   // or is assign to one of data set in this t << 
172   G4int idx = fDensityData->GetIndex(fMaterial << 
173   auto nelm = (G4int)fMaterial->GetNumberOfEle << 
174   G4int Z0 = ((*(fMaterial->GetElementVector() << 
175   const G4Material* bmat = fMaterial->GetBaseM << 
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   }                                            << 
215                                                    94 
216   // for compound non-NIST materials with one  <<  95   const G4double Cd2 = 4*pi*hbarc_squared*classic_electr_radius;
217   if (idx < 0 && 1 < nelm) {                   <<  96   const G4double twoln10 = 2.*log(10.);
218     const G4double tot = fMaterial->GetTotNbOf << 
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                                                    97 
238   if (idx >= 0) {                              <<  98   G4int icase;
239     // Take parameters for the density effect  <<  99   
240     // R.M. Sternheimer et al. Density Effect  << 100   fCdensity = 1. + log(fMeanExcitationEnergy*fMeanExcitationEnergy
241     // of Charged Particles in Various Substan << 101               /(Cd2*fMaterial->GetTotNbOfElectPerVolume()));
242     // Atom. Data Nucl. Data Tabl. 30 (1984) 2 << 
243                                                << 
244     fCdensity = fDensityData->GetCdensity(idx) << 
245     fMdensity = fDensityData->GetMdensity(idx) << 
246     fAdensity = fDensityData->GetAdensity(idx) << 
247     fX0density = fDensityData->GetX0density(id << 
248     fX1density = fDensityData->GetX1density(id << 
249     fD0density = fDensityData->GetDelta0densit << 
250     fPlasmaEnergy = fDensityData->GetPlasmaEne << 
251     fAdjustmentFactor = fDensityData->GetAdjus << 
252                                                << 
253     // parameter C is computed and not taken f << 
254     // fCdensity = 1. + 2*G4Log(fMeanExcitatio << 
255     // G4cout << "IonisParamMat: " << fMateria << 
256     //     << "  Cst= " << Cdensity << " C= "  << 
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                                                << 
267     // Compute parameters for the density effe << 
268     // The parametrization is from R.M. Sternh << 
269     G4int icase;                               << 
270                                                << 
271     fCdensity = 1. + 2 * G4Log(fMeanExcitation << 
272     //                                         << 
273     // condensed materials                     << 
274     //                                         << 
275     if ((State == kStateSolid) || (State == kS << 
276       static const G4double E100eV = 100. * CL << 
277       static const G4double ClimiS[] = {3.681, << 
278       static const G4double X0valS[] = {1.0, 1 << 
279       static const G4double X1valS[] = {2.0, 3 << 
280                                                   102 
281       if (fMeanExcitationEnergy < E100eV) {    << 103   //
282         icase = 0;                             << 104   // condensed materials
283       }                                        << 105   //
284       else {                                   << 106   G4State State = fMaterial->GetState();
285         icase = 1;                             << 107   
286       }                                        << 108   if ((State == kStateSolid)||(State == kStateLiquid)) {
287                                                   109 
288       if (fCdensity < ClimiS[icase]) {         << 110       const G4double E100eV  = 100.*eV; 
289         fX0density = 0.2;                      << 111       const G4double ClimiS[] = {3.681 , 5.215 };
290       }                                        << 112       const G4double X0valS[] = {1.0   , 1.5   };
291       else {                                   << 113       const G4double X1valS[] = {2.0   , 3.0   };
292         fX0density = 0.326 * fCdensity - X0val << 114                                 
293       }                                        << 115       if(fMeanExcitationEnergy < E100eV) icase = 0;
                                                   >> 116          else                            icase = 1;
                                                   >> 117 
                                                   >> 118       if(fCdensity < ClimiS[icase]) fX0density = 0.2;
                                                   >> 119          else                       fX0density = 0.326*fCdensity-X0valS[icase];
                                                   >> 120 
                                                   >> 121       fX1density = X1valS[icase] ; fMdensity = 3.0;
                                                   >> 122       
                                                   >> 123       //special: Hydrogen
                                                   >> 124       if ((fMaterial->GetNumberOfElements()==1)&&(fMaterial->GetZ()==1.)) {
                                                   >> 125          fX0density = 0.425; fX1density = 2.0; fMdensity = 5.949;
                                                   >> 126       }
                                                   >> 127   }
                                                   >> 128 
                                                   >> 129   //
                                                   >> 130   // gases
                                                   >> 131   //
                                                   >> 132   if (State == kStateGas) { 
                                                   >> 133 
                                                   >> 134       const G4double ClimiG[] = { 10. , 10.5 , 11. , 11.5 , 12.25 , 13.804};
                                                   >> 135       const G4double X0valG[] = { 1.6 , 1.7 ,  1.8 ,  1.9 , 2.0   ,  2.0 };
                                                   >> 136       const G4double X1valG[] = { 4.0 , 4.0 ,  4.0 ,  4.0 , 4.0   ,  5.0 };
                                                   >> 137 
                                                   >> 138       icase = 5;
                                                   >> 139       fX0density = 0.326*fCdensity-2.5 ; fX1density = 5.0 ; fMdensity = 3. ; 
                                                   >> 140       while((icase > 0)&&(fCdensity < ClimiG[icase])) icase-- ;
                                                   >> 141       fX0density = X0valG[icase]  ; fX1density = X1valG[icase] ;
                                                   >> 142       
                                                   >> 143       //special: Hydrogen
                                                   >> 144       if ((fMaterial->GetNumberOfElements()==1)&&(fMaterial->GetZ()==1.)) {
                                                   >> 145          fX0density = 1.837; fX1density = 3.0; fMdensity = 4.754;
                                                   >> 146       }
                                                   >> 147       
                                                   >> 148       //special: Helium
                                                   >> 149       if ((fMaterial->GetNumberOfElements()==1)&&(fMaterial->GetZ()==2.)) {
                                                   >> 150          fX0density = 2.191; fX1density = 3.0; fMdensity = 3.297;
                                                   >> 151       }
                                                   >> 152 
                                                   >> 153       // change parameters if the gas is not in STP.
                                                   >> 154       // For the correction the density(STP) is needed. Density(STP) is calculated here : 
                                                   >> 155       
                                                   >> 156       G4double Density  = fMaterial->GetDensity();
                                                   >> 157       G4double Pressure = fMaterial->GetPressure();
                                                   >> 158       G4double Temp     = fMaterial->GetTemperature();
                                                   >> 159       
                                                   >> 160       G4double DensitySTP = Density*STP_Pressure*Temp/(Pressure*STP_Temperature);
                                                   >> 161 
                                                   >> 162       G4double ParCorr = log(Density/DensitySTP);
                                                   >> 163   
                                                   >> 164       fCdensity  -= ParCorr;
                                                   >> 165       fX0density -= ParCorr/twoln10;
                                                   >> 166       fX1density -= ParCorr/twoln10;
                                                   >> 167   }
                                                   >> 168 
                                                   >> 169   G4double Xa = fCdensity/twoln10;
                                                   >> 170   fAdensity = twoln10*(Xa-fX0density)
                                                   >> 171               /pow((fX1density-fX0density),fMdensity);
                                                   >> 172 }
294                                                   173 
295       fX1density = X1valS[icase];              << 174 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
296       fMdensity = 3.0;                         << 
297                                                   175 
298       // special: Hydrogen                     << 176 void G4IonisParamMat::ComputeFluctModel()
299       if (1 == nelm && 1 == Z0) {              << 177 {
300         fX0density = 0.425;                    << 178   // compute parameters for the energy loss fluctuation model
301         fX1density = 2.0;                      << 
302         fMdensity = 5.949;                     << 
303       }                                        << 
304     }                                          << 
305     else {                                     << 
306       //                                       << 
307       // gases                                 << 
308       //                                       << 
309       fMdensity = 3.;                          << 
310       fX1density = 4.0;                        << 
311                                                   179 
312       if (fCdensity <= 10.) {                  << 180   // need an 'effective Z' ?????
313         fX0density = 1.6;                      << 181   G4double Zeff = 0.;
314       }                                        << 182   for (size_t i=0;i<fMaterial->GetNumberOfElements();i++) 
315       else if (fCdensity <= 10.5) {            << 183      Zeff += (fMaterial->GetFractionVector())[i]
316         fX0density = 1.7;                      << 184              *((*(fMaterial->GetElementVector()))[i]->GetZ());
317       }                                        << 185 
318       else if (fCdensity <= 11.0) {            << 186   if (Zeff > 2.) fF2fluct = 2./Zeff ;
319         fX0density = 1.8;                      << 187     else         fF2fluct = 0.;
320       }                                        << 188 
321       else if (fCdensity <= 11.5) {            << 189   fF1fluct         = 1. - fF2fluct;
322         fX0density = 1.9;                      << 190   fEnergy2fluct    = 10.*Zeff*Zeff*eV;
323       }                                        << 191   fLogEnergy2fluct = log(fEnergy2fluct);
324       else if (fCdensity <= 12.25) {           << 192   fLogEnergy1fluct = (fLogMeanExcEnergy - fF2fluct*fLogEnergy2fluct)
325         fX0density = 2.0;                      << 193                      /fF1fluct;
326       }                                        << 194   fEnergy1fluct    = exp(fLogEnergy1fluct);
327       else if (fCdensity <= 13.804) {          << 195   fEnergy0fluct    = 10.*eV;
328         fX0density = 2.0;                      << 196   fRateionexcfluct = 0.4;
329         fX1density = 5.0;                      << 197 }
330       }                                        << 
331       else {                                   << 
332         fX0density = 0.326 * fCdensity - 2.5;  << 
333         fX1density = 5.0;                      << 
334       }                                        << 
335                                                   198 
336       // special: Hydrogen                     << 199 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
337       if (1 == nelm && 1 == Z0) {              << 
338         fX0density = 1.837;                    << 
339         fX1density = 3.0;                      << 
340         fMdensity = 4.754;                     << 
341       }                                        << 
342                                                   200 
343       // special: Helium                       << 201 void G4IonisParamMat::SetMeanExcitationEnergy(G4double value)
344       if (1 == nelm && 2 == Z0) {              << 202 {
345         fX0density = 2.191;                    << 203   if(value == fMeanExcitationEnergy || value <= 0.0) return;
346         fX1density = 3.0;                      << 
347         fMdensity = 3.297;                     << 
348       }                                        << 
349     }                                          << 
350   }                                            << 
351                                                   204 
352   // change parameters if the gas is not in ST << 205   if(fMeanExcitationEnergy > 0.0) {
353   // For the correction the density(STP) is ne << 
354   // Density(STP) is calculated here :         << 
355                                                   206 
356   if (State == kStateGas) {                    << 207     G4cout << "G4Material: Mean excitation energy is changed for " << fMaterial->GetName()
357     G4double Pressure = fMaterial->GetPressure << 208            << " Iold= " << fMeanExcitationEnergy/eV
358     G4double Temp = fMaterial->GetTemperature( << 209            << "eV; Inew= " << value/eV << " eV;"
                                                   >> 210            << G4endl;
                                                   >> 211   }  
                                                   >> 212   
                                                   >> 213   fMeanExcitationEnergy = value;
                                                   >> 214   fLogMeanExcEnergy = log(value);
                                                   >> 215  
                                                   >> 216 }
359                                                   217 
360     G4double DensitySTP = density * STP_Pressu << 218 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
361                                                   219 
362     G4double ParCorr = G4Log(density / Density << 220 G4double G4IonisParamMat::FindMeanExcitationEnergy(const G4String& chFormula)
                                                   >> 221 {
363                                                   222 
364     fCdensity -= ParCorr;                      << 223   // The data on mean excitation energy for compaunds
365     fX0density -= ParCorr / twoln10;           << 224   // from "Stopping Powers for Electrons and Positrons"
366     fX1density -= ParCorr / twoln10;           << 225   // ICRU Report N#37, 1984  (energy in eV)
367   }                                            << 
368                                                   226 
369   // fAdensity parameter can be fixed for not  << 227   const size_t numberOfMolecula = 79 ;
370   if (0.0 == fD0density) {                     << 228   
371     G4double Xa = fCdensity / twoln10;         << 229   static G4String name[numberOfMolecula] = {
372     fAdensity = twoln10 * (Xa - fX0density) /  << 230 
                                                   >> 231     // gas
                                                   >> 232     "NH_3",       "C_4H_10",    "CO_2",       "C_2H_6",      "C_7H_16",
                                                   >> 233     "C_6H_14",    "CH_4",       "NO",         "N_2O",        "C_8H_18",
                                                   >> 234     "C_5H_12",    "C_3H_8",     "H_2O-Gas", 
                                                   >> 235 
                                                   >> 236     // liquid
                                                   >> 237     "C_3H_6O",    "C_6H_5NH_2",  "C_6H_6",    "C_4H_9OH",    "CCl_4",    
                                                   >> 238     "C_6H_5Cl",   "CHCl_3",      "C_6H_12",   "C_6H_4Cl_2",  "C_4Cl_2H_8O", 
                                                   >> 239     "C_2Cl_2H_4", "(C_2H_5)_2O", "C_2H_5OH",  "C_3H_5(OH)_3","C_7H_16",     
                                                   >> 240     "C_6H_14",    "CH_3OH",      "C_6H_5NO_2","C_5H_12",     "C_3H_7OH",    
                                                   >> 241     "C_5H_5N",    "C_8H_8",      "C_2Cl_4",   "C_7H_8",      "C_2Cl_3H",    
                                                   >> 242     "H_2O",       "C_8H_10"
                                                   >> 243 
                                                   >> 244     //solid
                                                   >> 245     "C_5H_5N_5",  "C_5H_5N_5O",  "(C_6H_11NO)-nylon",  "C_25H_52", 
                                                   >> 246     "(C_2H_4)-Polyethylene",     "(C_5H_8O-2)-Polymethil_Methacrylate",   
                                                   >> 247     "(C_8H_8)-Polystyrene",      "A-150-tissue",       "Al_2O_3",  "CaF_2", 
                                                   >> 248     "LiF",        "Photo_Emulsion",  "(C_2F_4)-Teflon",  "SiO_2"     
                                                   >> 249 
                                                   >> 250   } ;
                                                   >> 251     
                                                   >> 252   static G4double meanExcitation[numberOfMolecula] = {
                                                   >> 253 
                                                   >> 254     53.7,   48.3,  85.0,  45.4,  49.2,
                                                   >> 255     49.1,   41.7,  87.8,  84.9,  49.5,
                                                   >> 256     48.2,   47.1,  71.6,
                                                   >> 257 
                                                   >> 258     64.2,   66.2,  63.4,  59.9,  166.3,
                                                   >> 259     89.1,  156.0,  56.4, 106.5,  103.3, 
                                                   >> 260    111.9,   60.0,  62.9,  72.6,   54.4,  
                                                   >> 261     54.0,  67.6,   75.8,  53.6,   61.1,  
                                                   >> 262     66.2,  64.0,  159.2,  62.5,  148.1,  
                                                   >> 263     75.0,  61.8,
                                                   >> 264 
                                                   >> 265     71.4,  75.0,   63.9,  48.3,   57.4,
                                                   >> 266     74.0,  68.7,   65.1, 145.2,  166.,
                                                   >> 267     94.0, 331.0,   99.1, 139.2 
                                                   >> 268 
                                                   >> 269   } ;
                                                   >> 270 
                                                   >> 271   G4double x = fMeanExcitationEnergy;
                                                   >> 272 
                                                   >> 273   for(size_t i=0; i<numberOfMolecula; i++) {
                                                   >> 274     if(chFormula == name[i]) {
                                                   >> 275       x = meanExcitation[i]*eV;
                                                   >> 276       break;
                                                   >> 277     }
373   }                                               278   }
                                                   >> 279   return x;
374 }                                                 280 }
375                                                   281 
376 //....oooOO0OOooo........oooOO0OOooo........oo    282 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
377                                                   283 
378 void G4IonisParamMat::ComputeFluctModel()      << 284 G4IonisParamMat::~G4IonisParamMat()
379 {                                                 285 {
380   // compute parameters for the energy loss fl << 286   if (fShellCorrectionVector) delete [] fShellCorrectionVector;
381   // needs an 'effective Z'                    << 
382   G4double Zeff = 0.;                          << 
383   for (std::size_t i = 0; i < fMaterial->GetNu << 
384     Zeff += (fMaterial->GetFractionVector())[i << 
385   }                                            << 
386   if (Zeff > 2.1) {                            << 
387     fF2fluct = 2.0 / Zeff;                     << 
388     fF1fluct = 1. - fF2fluct;                  << 
389     fEnergy2fluct = 10. * Zeff * Zeff * CLHEP: << 
390     fLogEnergy2fluct = G4Log(fEnergy2fluct);   << 
391     fLogEnergy1fluct = (fLogMeanExcEnergy - fF << 
392   } else if (Zeff > 1.1) {                     << 
393     fF2fluct = 0.0;                            << 
394     fF1fluct = 1.0;                            << 
395     fEnergy2fluct = 40. * CLHEP::eV;           << 
396     fLogEnergy2fluct = G4Log(fEnergy2fluct);   << 
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;                      << 
408 }                                                 287 }
409                                                   288 
410 //....oooOO0OOooo........oooOO0OOooo........oo    289 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
411                                                   290 
412 void G4IonisParamMat::ComputeIonParameters()   << 291 G4IonisParamMat::G4IonisParamMat(const G4IonisParamMat& right)
413 {                                                 292 {
414   // get elements in the actual material,      << 293   *this = right;
415   const G4ElementVector* theElementVector = fM << 
416   const G4double* theAtomicNumDensityVector =  << 
417   const auto NumberOfElements = (G4int)fMateri << 
418                                                << 
419   //  loop for the elements in the material    << 
420   //  to find out average values Z, vF, lF     << 
421   G4double z(0.0), vF(0.0), lF(0.0), a23(0.0); << 
422                                                << 
423   G4Pow* g4pow = G4Pow::GetInstance();         << 
424   if (1 == NumberOfElements) {                 << 
425     const G4Element* element = (*theElementVec << 
426     z = element->GetZ();                       << 
427     vF = element->GetIonisation()->GetFermiVel << 
428     lF = element->GetIonisation()->GetLFactor( << 
429     a23 = 1.0 / g4pow->A23(element->GetN());   << 
430   }                                            << 
431   else {                                       << 
432     G4double norm(0.0);                        << 
433     for (G4int iel = 0; iel < NumberOfElements << 
434       const G4Element* element = (*theElementV << 
435       const G4double weight = theAtomicNumDens << 
436       norm += weight;                          << 
437       z += element->GetZ() * weight;           << 
438       vF += element->GetIonisation()->GetFermi << 
439       lF += element->GetIonisation()->GetLFact << 
440       a23 += weight / g4pow->A23(element->GetN << 
441     }                                          << 
442     if (norm > 0.0) { norm = 1.0/norm; }       << 
443     z *= norm;                                 << 
444     vF *= norm;                                << 
445     lF *= norm;                                << 
446     a23 *= norm;                               << 
447   }                                            << 
448   fZeff = z;                                   << 
449   fLfactor = lF;                               << 
450   fFermiEnergy = 25. * CLHEP::keV * vF * vF;   << 
451   fInvA23 = a23;                               << 
452 }                                                 294 }
453                                                   295 
454 //....oooOO0OOooo........oooOO0OOooo........oo    296 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
455                                                   297 
456 void G4IonisParamMat::SetMeanExcitationEnergy( << 298 const G4IonisParamMat& G4IonisParamMat::operator=(const G4IonisParamMat& right)
457 {                                                 299 {
458   if (value == fMeanExcitationEnergy || value  << 300   if (this != &right)
459     return;                                    << 301     {
460   }                                            << 302       fMaterial                 = right.fMaterial;
461   if (G4NistManager::Instance()->GetVerbose()  << 303       fMeanExcitationEnergy     = right.fMeanExcitationEnergy;
462     G4cout << "G4Material: Mean excitation ene << 304       fLogMeanExcEnergy         = right.fLogMeanExcEnergy;
463            << " Iold= " << fMeanExcitationEner << 305       if (fShellCorrectionVector) delete [] fShellCorrectionVector;      
464            << G4endl;                          << 306       fShellCorrectionVector    = new G4double[3];             
465   }                                            << 307       fShellCorrectionVector[0] = right.fShellCorrectionVector[0];
466                                                << 308       fShellCorrectionVector[1] = right.fShellCorrectionVector[1];
467   fMeanExcitationEnergy = value;               << 309       fShellCorrectionVector[2] = right.fShellCorrectionVector[2];
468                                                << 310       fTaul                     = right.fTaul;
469   // add corrections to density effect         << 311       fCdensity                 = right.fCdensity;
470   G4double newlog = G4Log(value);              << 312       fMdensity                 = right.fMdensity;
471   G4double corr = 2 * (newlog - fLogMeanExcEne << 313       fAdensity                 = right.fAdensity;
472   fCdensity += corr;                           << 314       fX0density                = right.fX0density;
473   fX0density += corr / twoln10;                << 315       fX1density                = right.fX1density;
474   fX1density += corr / twoln10;                << 316       fF1fluct                  = right.fF1fluct;
475                                                << 317       fF2fluct                  = right.fF2fluct;
476   // recompute parameters of fluctuation model << 318       fEnergy1fluct             = right.fEnergy1fluct;
477   fLogMeanExcEnergy = newlog;                  << 319       fLogEnergy1fluct          = right.fLogEnergy1fluct;      
478   ComputeFluctModel();                         << 320       fEnergy2fluct             = right.fEnergy2fluct;
                                                   >> 321       fLogEnergy2fluct          = right.fLogEnergy2fluct;      
                                                   >> 322       fEnergy0fluct             = right.fEnergy0fluct;
                                                   >> 323       fRateionexcfluct          = right.fRateionexcfluct;
                                                   >> 324      } 
                                                   >> 325   return *this;
479 }                                                 326 }
480                                                   327 
481 //....oooOO0OOooo........oooOO0OOooo........oo    328 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
482                                                   329 
483 void G4IonisParamMat::SetDensityEffectParamete << 330 G4int G4IonisParamMat::operator==(const G4IonisParamMat& right) const
484   G4double cd, G4double md, G4double ad, G4dou << 
485 {                                                 331 {
486   // no check on consistence of user parameter << 332   return (this == (G4IonisParamMat*) &right);
487   G4AutoLock l(&ionisMutex);                   << 
488   fCdensity = cd;                              << 
489   fMdensity = md;                              << 
490   fAdensity = ad;                              << 
491   fX0density = x0;                             << 
492   fX1density = x1;                             << 
493   fD0density = d0;                             << 
494   l.unlock();                                  << 
495 }                                                 333 }
496                                                   334 
497 //....oooOO0OOooo........oooOO0OOooo........oo    335 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
498                                                   336 
499 void G4IonisParamMat::SetDensityEffectParamete << 337 G4int G4IonisParamMat::operator!=(const G4IonisParamMat& right) const
500 {                                              << 338 {
501   G4AutoLock l(&ionisMutex);                   << 339   return (this != (G4IonisParamMat*) &right);
502   const G4IonisParamMat* ipm = bmat->GetIonisa << 
503   fCdensity = ipm->GetCdensity();              << 
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 }                                                 340 }
538                                                   341 
539 //....oooOO0OOooo........oooOO0OOooo........oo    342 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
540                                                   343 
541 G4double G4IonisParamMat::FindMeanExcitationEn << 
542 {                                              << 
543   G4double res = 0.0;                          << 
544   // data from density effect data             << 
545   if (fDensityData != nullptr) {               << 
546     G4int idx = fDensityData->GetIndex(mat->Ge << 
547     if (idx >= 0) {                            << 
548       res = fDensityData->GetMeanIonisationPot << 
549     }                                          << 
550   }                                            << 
551                                                << 
552   // The data on mean excitation energy for co << 
553   // from "Stopping Powers for Electrons and P << 
554   // ICRU Report N#37, 1984  (energy in eV)    << 
555   // this value overwrites Density effect data << 
556   G4String chFormula = mat->GetChemicalFormula << 
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 }                                              << 
623                                                   344