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 11.0.p4)


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