Geant4 Cross Reference

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