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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 /examples/advanced/eRosita/physics/src/G4LowEnergyGammaConversion.cc (Version 11.3.0) and /examples/advanced/eRosita/physics/src/G4LowEnergyGammaConversion.cc (Version 9.4.p2)


  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 // -------------------------------------------    
 27 ///                                               
 28 //                                                
 29 //                                                
 30 // -------------------------------------------    
 31 //                                                
 32 // Author: A. Forti                               
 33 //         Maria Grazia Pia (Maria.Grazia.Pia@    
 34 //                                                
 35 // History:                                       
 36 // --------                                       
 37 // 02/03/1999 A. Forti 1st implementation         
 38 // 14.03.2000 Veronique Lefebure;                 
 39 // Change initialisation of lowestEnergyLimit     
 40 // Note that the hard coded value 1.022 should    
 41 // 2*electron_mass_c2 in order to agree with t    
 42 // 24.04.01 V.Ivanchenko remove RogueWave         
 43 // 27.07.01 F.Longo correct bug in energy dist    
 44 // 21.01.03 V.Ivanchenko Cut per region           
 45 // 25.03.03 F.Longo fix in angular distributio    
 46 // 24.04.03 V.Ivanchenko - Cut per region mfpt    
 47 //                                                
 48 // -------------------------------------------    
 49                                                   
 50 #include "G4LowEnergyGammaConversion.hh"          
 51                                                   
 52 #include "Randomize.hh"                           
 53 #include "G4PhysicalConstants.hh"                 
 54 #include "G4SystemOfUnits.hh"                     
 55 #include "G4ParticleDefinition.hh"                
 56 #include "G4Track.hh"                             
 57 #include "G4Step.hh"                              
 58 #include "G4ForceCondition.hh"                    
 59 #include "G4Gamma.hh"                             
 60 #include "G4Electron.hh"                          
 61 #include "G4DynamicParticle.hh"                   
 62 #include "G4VParticleChange.hh"                   
 63 #include "G4ThreeVector.hh"                       
 64 #include "G4Positron.hh"                          
 65 #include "G4IonisParamElm.hh"                     
 66 #include "G4Material.hh"                          
 67 #include "G4RDVCrossSectionHandler.hh"            
 68 #include "G4RDCrossSectionHandler.hh"             
 69 #include "G4RDVEMDataSet.hh"                      
 70 #include "G4RDVDataSetAlgorithm.hh"               
 71 #include "G4RDLogLogInterpolation.hh"             
 72 #include "G4RDVRangeTest.hh"                      
 73 #include "G4RDRangeTest.hh"                       
 74 #include "G4MaterialCutsCouple.hh"                
 75                                                   
 76 G4LowEnergyGammaConversion::G4LowEnergyGammaCo    
 77   : G4VDiscreteProcess(processName),              
 78     lowEnergyLimit(1.022000*MeV),                 
 79     highEnergyLimit(100*GeV),                     
 80     intrinsicLowEnergyLimit(1.022000*MeV),        
 81     intrinsicHighEnergyLimit(100*GeV),            
 82     smallEnergy(2.*MeV)                           
 83                                                   
 84 {                                                 
 85   if (lowEnergyLimit < intrinsicLowEnergyLimit    
 86       highEnergyLimit > intrinsicHighEnergyLim    
 87     {                                             
 88       G4Exception("G4LowEnergyGammaConversion:    
 89                   "OutOfRange", FatalException    
 90                   "Energy limit outside intrin    
 91     }                                             
 92                                                   
 93   // The following pointer is owned by G4DataH    
 94                                                   
 95   crossSectionHandler = new G4RDCrossSectionHa    
 96   crossSectionHandler->Initialise(0,1.0220*MeV    
 97   meanFreePathTable = 0;                          
 98   rangeTest = new G4RDRangeTest;                  
 99                                                   
100    if (verboseLevel > 0)                          
101      {                                            
102        G4cout << GetProcessName() << " is crea    
103         << "Energy range: "                       
104         << lowEnergyLimit / MeV << " MeV - "      
105         << highEnergyLimit / GeV << " GeV"        
106         << G4endl;                                
107      }                                            
108 }                                                 
109                                                   
110 G4LowEnergyGammaConversion::~G4LowEnergyGammaC    
111 {                                                 
112   delete meanFreePathTable;                       
113   delete crossSectionHandler;                     
114   delete rangeTest;                               
115 }                                                 
116                                                   
117 void G4LowEnergyGammaConversion::BuildPhysicsT    
118 {                                                 
119                                                   
120   crossSectionHandler->Clear();                   
121   G4String crossSectionFile = "pair/pp-cs-";      
122   crossSectionHandler->LoadData(crossSectionFi    
123                                                   
124   delete meanFreePathTable;                       
125   meanFreePathTable = crossSectionHandler->Bui    
126 }                                                 
127                                                   
128 G4VParticleChange* G4LowEnergyGammaConversion:    
129                   const G4Step& aStep)            
130 {                                                 
131 // The energies of the e+ e- secondaries are s    
132 // cross sections with Coulomb correction. A m    
133 // number techniques of Butcher & Messel is us    
134                                                   
135 // Note 1 : Effects due to the breakdown of th    
136 // energy are ignored.                            
137 // Note 2 : The differential cross section imp    
138 // pair creation in both nuclear and atomic el    
139 // prodution is not generated.                    
140                                                   
141   aParticleChange.Initialize(aTrack);             
142                                                   
143   const G4MaterialCutsCouple* couple = aTrack.    
144                                                   
145   const G4DynamicParticle* incidentPhoton = aT    
146   G4double photonEnergy = incidentPhoton->GetK    
147   G4ParticleMomentum photonDirection = inciden    
148                                                   
149   G4double epsilon ;                              
150   G4double epsilon0 = electron_mass_c2 / photo    
151                                                   
152   // Do it fast if photon energy < 2. MeV         
153   if (photonEnergy < smallEnergy )                
154     {                                             
155       epsilon = epsilon0 + (0.5 - epsilon0) *     
156     }                                             
157   else                                            
158     {                                             
159       // Select randomly one element in the cu    
160       const G4Element* element = crossSectionH    
161                                                   
162       if (element == 0)                           
163   {                                               
164     G4cout << "G4LowEnergyGammaConversion::Pos    
165   }                                               
166       G4IonisParamElm* ionisation = element->G    
167        if (ionisation == 0)                       
168   {                                               
169     G4cout << "G4LowEnergyGammaConversion::Pos    
170   }                                               
171                                                   
172       // Extract Coulomb factor for this Eleme    
173       G4double fZ = 8. * (ionisation->GetlogZ3    
174       if (photonEnergy > 50. * MeV) fZ += 8. *    
175                                                   
176       // Limits of the screening variable         
177       G4double screenFactor = 136. * epsilon0     
178       G4double screenMax = std::exp ((42.24 -     
179       G4double screenMin = std::min(4.*screenF    
180                                                   
181       // Limits of the energy sampling            
182       G4double epsilon1 = 0.5 - 0.5 * std::sqr    
183       G4double epsilonMin = std::max(epsilon0,    
184       G4double epsilonRange = 0.5 - epsilonMin    
185                                                   
186       // Sample the energy rate of the created    
187       G4double screen;                            
188       G4double gReject ;                          
189                                                   
190       G4double f10 = ScreenFunction1(screenMin    
191       G4double f20 = ScreenFunction2(screenMin    
192       G4double normF1 = std::max(f10 * epsilon    
193       G4double normF2 = std::max(1.5 * f20,0.)    
194                                                   
195       do {                                        
196   if (normF1 / (normF1 + normF2) > G4UniformRa    
197     {                                             
198       epsilon = 0.5 - epsilonRange * std::pow(    
199       screen = screenFactor / (epsilon * (1. -    
200       gReject = (ScreenFunction1(screen) - fZ)    
201     }                                             
202   else                                            
203     {                                             
204       epsilon = epsilonMin + epsilonRange * G4    
205       screen = screenFactor / (epsilon * (1 -     
206       gReject = (ScreenFunction2(screen) - fZ)    
207     }                                             
208       } while ( gReject < G4UniformRand() );      
209                                                   
210     }   //  End of epsilon sampling               
211                                                   
212   // Fix charges randomly                         
213                                                   
214   G4double electronTotEnergy;                     
215   G4double positronTotEnergy;                     
216                                                   
217   if (CLHEP::RandBit::shootBit())                 
218     {                                             
219       electronTotEnergy = (1. - epsilon) * pho    
220       positronTotEnergy = epsilon * photonEner    
221     }                                             
222   else                                            
223     {                                             
224       positronTotEnergy = (1. - epsilon) * pho    
225       electronTotEnergy = epsilon * photonEner    
226     }                                             
227                                                   
228   // Scattered electron (positron) angles. ( Z    
229   // Universal distribution suggested by L. Ur    
230   // derived from Tsai distribution (Rev. Mod.    
231                                                   
232   G4double u;                                     
233   const G4double a1 = 0.625;                      
234   G4double a2 = 3. * a1;                          
235   //  G4double d = 27. ;                          
236                                                   
237   //  if (9. / (9. + d) > G4UniformRand())        
238   if (0.25 > G4UniformRand())                     
239     {                                             
240       u = - std::log(G4UniformRand() * G4Unifo    
241     }                                             
242   else                                            
243     {                                             
244       u = - std::log(G4UniformRand() * G4Unifo    
245     }                                             
246                                                   
247   G4double thetaEle = u*electron_mass_c2/elect    
248   G4double thetaPos = u*electron_mass_c2/posit    
249   G4double phi  = twopi * G4UniformRand();        
250                                                   
251   G4double dxEle= std::sin(thetaEle)*std::cos(    
252   G4double dxPos=-std::sin(thetaPos)*std::cos(    
253                                                   
254                                                   
255   // Kinematics of the created pair:              
256   // the electron and positron are assumed to     
257   // distribution with respect to the Z axis a    
258                                                   
259   G4double localEnergyDeposit = 0. ;              
260                                                   
261   aParticleChange.SetNumberOfSecondaries(2) ;     
262   G4double electronKineEnergy = std::max(0.,el    
263                                                   
264   // Generate the electron only if with large     
265                                                   
266   G4double safety = aStep.GetPostStepPoint()->    
267                                                   
268   if (rangeTest->Escape(G4Electron::Electron()    
269     {                                             
270       G4ThreeVector electronDirection (dxEle,     
271       electronDirection.rotateUz(photonDirecti    
272                                                   
273       G4DynamicParticle* particle1 = new G4Dyn    
274                   electronDirection,              
275                   electronKineEnergy);            
276       aParticleChange.AddSecondary(particle1)     
277     }                                             
278   else                                            
279     {                                             
280       localEnergyDeposit += electronKineEnergy    
281     }                                             
282                                                   
283   // The e+ is always created (even with kinet    
284   G4double positronKineEnergy = std::max(0.,po    
285                                                   
286   // Is the local energy deposit correct, if t    
287   if (! (rangeTest->Escape(G4Positron::Positro    
288     {                                             
289       localEnergyDeposit += positronKineEnergy    
290       positronKineEnergy = 0. ;                   
291     }                                             
292                                                   
293   G4ThreeVector positronDirection (dxPos, dyPo    
294   positronDirection.rotateUz(photonDirection);    
295                                                   
296   // Create G4DynamicParticle object for the p    
297   G4DynamicParticle* particle2 = new G4Dynamic    
298                    positronDirection, positron    
299   aParticleChange.AddSecondary(particle2) ;       
300                                                   
301   aParticleChange.ProposeLocalEnergyDeposit(lo    
302                                                   
303   // Kill the incident photon                     
304   aParticleChange.ProposeMomentumDirection(0.,    
305   aParticleChange.ProposeEnergy(0.) ;             
306   aParticleChange.ProposeTrackStatus(fStopAndK    
307                                                   
308   //  Reset NbOfInteractionLengthLeft and retu    
309   return G4VDiscreteProcess::PostStepDoIt(aTra    
310 }                                                 
311                                                   
312 G4bool G4LowEnergyGammaConversion::IsApplicabl    
313 {                                                 
314   return ( &particle == G4Gamma::Gamma() );       
315 }                                                 
316                                                   
317 G4double G4LowEnergyGammaConversion::GetMeanFr    
318                  G4double, // previousStepSize    
319                  G4ForceCondition*)               
320 {                                                 
321   const G4DynamicParticle* photon = track.GetD    
322   G4double energy = photon->GetKineticEnergy()    
323   const G4MaterialCutsCouple* couple = track.G    
324   size_t materialIndex = couple->GetIndex();      
325                                                   
326   G4double meanFreePath;                          
327   if (energy > highEnergyLimit) meanFreePath =    
328   else if (energy < lowEnergyLimit) meanFreePa    
329   else meanFreePath = meanFreePathTable->FindV    
330   return meanFreePath;                            
331 }                                                 
332                                                   
333 G4double G4LowEnergyGammaConversion::ScreenFun    
334 {                                                 
335   // Compute the value of the screening functi    
336                                                   
337   G4double value;                                 
338                                                   
339   if (screenVariable > 1.)                        
340     value = 42.24 - 8.368 * std::log(screenVar    
341   else                                            
342     value = 42.392 - screenVariable * (7.796 -    
343                                                   
344   return value;                                   
345 }                                                 
346                                                   
347 G4double G4LowEnergyGammaConversion::ScreenFun    
348 {                                                 
349   // Compute the value of the screening functi    
350                                                   
351   G4double value;                                 
352                                                   
353   if (screenVariable > 1.)                        
354     value = 42.24 - 8.368 * std::log(screenVar    
355   else                                            
356     value = 41.405 - screenVariable * (5.828 -    
357                                                   
358   return value;                                   
359 }                                                 
360