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.1.p1)


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