Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/processes/electromagnetic/utils/src/G4VEmModel.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 /processes/electromagnetic/utils/src/G4VEmModel.cc (Version 11.3.0) and /processes/electromagnetic/utils/src/G4VEmModel.cc (Version 10.0)


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