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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/lowenergy/src/G4LivermoreGammaConversion5DModel.cc (Version 11.3.0) and /processes/electromagnetic/lowenergy/src/G4LivermoreGammaConversion5DModel.cc (Version 9.4.p4)


  1 //                                                  1 
  2 // *******************************************    
  3 // * License and Disclaimer                       
  4 // *                                              
  5 // * The  Geant4 software  is  copyright of th    
  6 // * the Geant4 Collaboration.  It is provided    
  7 // * conditions of the Geant4 Software License    
  8 // * LICENSE and available at  http://cern.ch/    
  9 // * include a list of copyright holders.         
 10 // *                                              
 11 // * Neither the authors of this software syst    
 12 // * institutes,nor the agencies providing fin    
 13 // * work  make  any representation or  warran    
 14 // * regarding  this  software system or assum    
 15 // * use.  Please see the license in the file     
 16 // * for the full disclaimer and the limitatio    
 17 // *                                              
 18 // * This  code  implementation is the result     
 19 // * technical work of the GEANT4 collaboratio    
 20 // * By using,  copying,  modifying or  distri    
 21 // * any work based  on the software)  you  ag    
 22 // * use  in  resulting  scientific  publicati    
 23 // * acceptance of all terms of the Geant4 Sof    
 24 // *******************************************    
 25 //                                                
 26 // Author: Zhuxin Li@CENBG                        
 27 //         11 March 2020                          
 28 //         on the base of G4LivermoreGammaConv    
 29 //         derives from G4BetheHeitler5DModel     
 30 // -------------------------------------------    
 31                                                   
 32 #include "G4LivermoreGammaConversion5DModel.hh    
 33                                                   
 34 #include "G4AutoLock.hh"                          
 35 #include "G4Electron.hh"                          
 36 #include "G4EmParameters.hh"                      
 37 #include "G4Exp.hh"                               
 38 #include "G4ParticleChangeForGamma.hh"            
 39 #include "G4PhysicalConstants.hh"                 
 40 #include "G4PhysicsFreeVector.hh"                 
 41 #include "G4SystemOfUnits.hh"                     
 42                                                   
 43 namespace                                         
 44 {                                                 
 45 G4Mutex LivermoreGammaConversion5DModelMutex =    
 46 }                                                 
 47                                                   
 48 //....oooOO0OOooo........oooOO0OOooo........oo    
 49 //....oooOO0OOooo........oooOO0OOooo........oo    
 50                                                   
 51 G4PhysicsFreeVector* G4LivermoreGammaConversio    
 52 G4String G4LivermoreGammaConversion5DModel::gD    
 53                                                   
 54 G4LivermoreGammaConversion5DModel::G4Livermore    
 55                                                   
 56   : G4BetheHeitler5DModel(p, nam)                 
 57 {                                                 
 58   fParticleChange = nullptr;                      
 59   lowEnergyLimit = 2. * CLHEP::electron_mass_c    
 60   verboseLevel = 0;                               
 61   // Verbosity scale for debugging purposes:      
 62   // 0 = nothing                                  
 63   // 1 = calculation of cross sections, file o    
 64   // 2 = entering in methods                      
 65   if (verboseLevel > 0) {                         
 66     G4cout << "G4LivermoreGammaConversion5DMod    
 67   }                                               
 68 }                                                 
 69                                                   
 70 //....oooOO0OOooo........oooOO0OOooo........oo    
 71                                                   
 72 G4LivermoreGammaConversion5DModel::~G4Livermor    
 73 {                                                 
 74   if (IsMaster()) {                               
 75     for (G4int i = 0; i < maxZ; ++i) {            
 76       if (data[i]) {                              
 77         delete data[i];                           
 78         data[i] = nullptr;                        
 79       }                                           
 80     }                                             
 81   }                                               
 82 }                                                 
 83                                                   
 84 //....oooOO0OOooo........oooOO0OOooo........oo    
 85                                                   
 86 void G4LivermoreGammaConversion5DModel::Initia    
 87                                                   
 88 {                                                 
 89   G4BetheHeitler5DModel::Initialise(particle,     
 90                                                   
 91   if (verboseLevel > 1) {                         
 92     G4cout << "Calling Initialise() of G4Liver    
 93            << "Energy range: " << LowEnergyLim    
 94            << " GeV isMater: " << IsMaster() <    
 95   }                                               
 96                                                   
 97   if (IsMaster()) {                               
 98     // Initialise element selector                
 99     InitialiseElementSelectors(particle, cuts)    
100                                                   
101     // Access to elements                         
102     const G4ElementTable* elemTable = G4Elemen    
103     std::size_t numElems = (*elemTable).size()    
104     for (std::size_t ie = 0; ie < numElems; ++    
105       const G4Element* elem = (*elemTable)[ie]    
106       const G4int Z = std::min(maxZ, elem->Get    
107       if (data[Z] == nullptr) {                   
108         ReadData(Z);                              
109       }                                           
110     }                                             
111   }                                               
112                                                   
113   if (isInitialised) {                            
114     return;                                       
115   }                                               
116   fParticleChange = GetParticleChangeForGamma(    
117   isInitialised = true;                           
118 }                                                 
119                                                   
120 //....oooOO0OOooo........oooOO0OOooo........oo    
121                                                   
122 const G4String& G4LivermoreGammaConversion5DMo    
123 {                                                 
124   // no check in this method - environment var    
125   if (gDataDirectory.empty()) {                   
126     auto param = G4EmParameters::Instance();      
127     std::ostringstream ost;                       
128     if (param->LivermoreDataDir() == "livermor    
129       ost << param->GetDirLEDATA() << "/liverm    
130       useSpline = true;                           
131     }                                             
132     else {                                        
133       ost << param->GetDirLEDATA() << "/epics2    
134     }                                             
135     gDataDirectory = ost.str();                   
136   }                                               
137   return gDataDirectory;                          
138 }                                                 
139                                                   
140 //....oooOO0OOooo........oooOO0OOooo........oo    
141                                                   
142 void G4LivermoreGammaConversion5DModel::ReadDa    
143 {                                                 
144   if (verboseLevel > 1) {                         
145     G4cout << "Calling ReadData() of G4Livermo    
146   }                                               
147                                                   
148   if (data[Z]) {                                  
149     return;                                       
150   }                                               
151                                                   
152   std::ostringstream ost;                         
153   ost << FindDirectoryPath() << "pp-cs-" << Z     
154                                                   
155   data[Z] = new G4PhysicsFreeVector(useSpline)    
156                                                   
157   std::ifstream fin(ost.str().c_str());           
158                                                   
159   if (!fin.is_open()) {                           
160     G4ExceptionDescription ed;                    
161     ed << "G4LivermoreGammaConversion5DModel d    
162        << G4endl;                                 
163     G4Exception("G4LivermoreGammaConversion5DM    
164                 "G4LEDATA version should be G4    
165     return;                                       
166   }                                               
167   else {                                          
168     if (verboseLevel > 1) {                       
169       G4cout << "File " << ost.str() << " is o    
170     }                                             
171     data[Z]->Retrieve(fin, true);                 
172   }                                               
173   // Activation of spline interpolation           
174   if (useSpline) data[Z]->FillSecondDerivative    
175 }                                                 
176                                                   
177 //....oooOO0OOooo........oooOO0OOooo........oo    
178                                                   
179 G4double                                          
180 G4LivermoreGammaConversion5DModel::ComputeCros    
181                                                   
182                                                   
183 {                                                 
184   if (verboseLevel > 1) {                         
185     G4cout << "G4LivermoreGammaConversion5DMod    
186   }                                               
187   G4double xs = 0.0;                              
188   if (GammaEnergy < lowEnergyLimit) {             
189     return xs;                                    
190   }                                               
191                                                   
192   G4int intZ = std::max(1, std::min(G4lrint(Z)    
193   G4PhysicsFreeVector* pv = data[intZ];           
194   // if element was not initialised               
195   // do initialisation safely for MT mode         
196   if (!pv) {                                      
197     InitialiseForElement(particle, intZ);         
198     pv = data[intZ];                              
199     if (!pv) {                                    
200       return xs;                                  
201     }                                             
202   }                                               
203   // x-section is taken from the table            
204   xs = pv->Value(GammaEnergy);                    
205   if (verboseLevel > 0) {                         
206     G4cout << "*** Gamma conversion xs for Z="    
207            << "  cs=" << xs / millibarn << " m    
208   }                                               
209   return xs;                                      
210 }                                                 
211                                                   
212 //....oooOO0OOooo........oooOO0OOooo........oo    
213                                                   
214 void G4LivermoreGammaConversion5DModel::Initia    
215 {                                                 
216   G4AutoLock l(&LivermoreGammaConversion5DMode    
217   if (!data[Z]) {                                 
218     ReadData(Z);                                  
219   }                                               
220   l.unlock();                                     
221 }                                                 
222                                                   
223 //....oooOO0OOooo........oooOO0OOooo........oo    
224