Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/processes/electromagnetic/standard/src/G4PhotoElectricEffect.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /processes/electromagnetic/standard/src/G4PhotoElectricEffect.cc (Version 11.3.0) and /processes/electromagnetic/standard/src/G4PhotoElectricEffect.cc (Version 4.0.p2)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                    <<   3 // * DISCLAIMER                                                       *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th <<   5 // * The following disclaimer summarizes all the specific disclaimers *
  6 // * the Geant4 Collaboration.  It is provided <<   6 // * of contributors to this software. The specific disclaimers,which *
  7 // * conditions of the Geant4 Software License <<   7 // * govern, are listed with their locations in:                      *
  8 // * LICENSE and available at  http://cern.ch/ <<   8 // *   http://cern.ch/geant4/license                                  *
  9 // * include a list of copyright holders.      << 
 10 // *                                                9 // *                                                                  *
 11 // * Neither the authors of this software syst     10 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     11 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     12 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     13 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file  <<  14 // * use.                                                             *
 16 // * for the full disclaimer and the limitatio << 
 17 // *                                               15 // *                                                                  *
 18 // * This  code  implementation is the result  <<  16 // * This  code  implementation is the  intellectual property  of the *
 19 // * technical work of the GEANT4 collaboratio <<  17 // * GEANT4 collaboration.                                            *
 20 // * By using,  copying,  modifying or  distri <<  18 // * By copying,  distributing  or modifying the Program (or any work *
 21 // * any work based  on the software)  you  ag <<  19 // * based  on  the Program)  you indicate  your  acceptance of  this *
 22 // * use  in  resulting  scientific  publicati <<  20 // * statement, and all its terms.                                    *
 23 // * acceptance of all terms of the Geant4 Sof << 
 24 // *******************************************     21 // ********************************************************************
 25 //                                                 22 //
 26 //                                                 23 //
                                                   >>  24 // $Id: G4PhotoElectricEffect.cc,v 1.23 2002/01/10 18:26:36 maire Exp $
                                                   >>  25 // GEANT4 tag $Name: geant4-04-00-patch-02 $
 27 //                                                 26 //
 28 //------------------ G4PhotoElectricEffect phy <<  27 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 29 //                   by Michel Maire, 24 May 1 <<  28 
 30 //                                             <<  29 // 12-06-96, Added SelectRandomAtom() method, by M.Maire
 31 // Modified by Michel Maire and Vladimir Ivanc <<  30 // 21-06-96, SetCuts implementation, M.Maire
 32 //                                             <<  31 // 17-09-96, PartialSumSigma(i)
 33 // ------------------------------------------- <<  32 //           split of ComputeBindingEnergy, M.Maire
                                                   >>  33 // 08-01-97, crossection table + meanfreepath table, M.Maire
                                                   >>  34 // 13-03-97, adapted for the new physics scheme, M.Maire
                                                   >>  35 // 28-03-97, protection in BuildPhysicsTable, M.Maire
                                                   >>  36 // 04-06-98, in DoIt, secondary production condition:
                                                   >>  37 //                        range > G4std::min(threshold,safety)
                                                   >>  38 // 13-08-98, new methods SetBining() PrintInfo()
                                                   >>  39 // 17-11-98, use table of Atomic shells in PostStepDoIt
                                                   >>  40 // 06-01-99, use Sandia crossSection below 50 keV, V.Grichine mma
                                                   >>  41 // 20-05-99, protection against very low energy photons ,L.Urban
                                                   >>  42 // 08-06-99, removed this above protection from the DoIt. mma
                                                   >>  43 // 21-06-00, in DoIt, killing photon: aParticleChange.SetEnergyChange(0.); mma
                                                   >>  44 // 22-06-00, in DoIt, absorbe very low energy photon (back to 20-05-99); mma
                                                   >>  45 // 22-02-01, back to 08-06-99 after correc in SandiaTable (materials-V03-00-05)
                                                   >>  46 // 28-05-01, V.Ivanchenko minor changes to provide ANSI -wall compilation
                                                   >>  47 // 13-07-01, DoIt: suppression of production cut of the electron (mma)
                                                   >>  48 // 06-08-01, new methods Store/Retrieve PhysicsTable (mma)
                                                   >>  49 // 06-08-01, BuildThePhysicsTable() called from constructor (mma)
                                                   >>  50 // 17-09-01, migration of Materials to pure STL (mma)
                                                   >>  51 // 20-09-01, DoIt: fminimalEnergy = 1*eV (mma)
                                                   >>  52 // 01-10-01, come back to BuildPhysicsTable(const G4ParticleDefinition&)       
                                                   >>  53 // 10-01-02, moved few function from icc to cc
                                                   >>  54 //    
                                                   >>  55 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >>  56 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 34                                                    57 
 35 #include "G4PhotoElectricEffect.hh"                58 #include "G4PhotoElectricEffect.hh"
 36 #include "G4SystemOfUnits.hh"                  <<  59 #include "G4UnitsTable.hh"
 37 #include "G4PEEffectFluoModel.hh"              << 
 38 #include "G4Electron.hh"                       << 
 39 #include "G4EmParameters.hh"                   << 
 40                                                    60 
 41 //....oooOO0OOooo........oooOO0OOooo........oo     61 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >>  62  
                                                   >>  63 // constructor
                                                   >>  64  
                                                   >>  65 G4PhotoElectricEffect::G4PhotoElectricEffect(const G4String& processName)
                                                   >>  66   : G4VDiscreteProcess (processName),             // initialization
                                                   >>  67     theCrossSectionTable(NULL),
                                                   >>  68     theMeanFreePathTable(NULL),
                                                   >>  69     LowestEnergyLimit (50*keV),
                                                   >>  70     HighestEnergyLimit(50*MeV),
                                                   >>  71     NumbBinTable(100),
                                                   >>  72     fminimalEnergy(1*eV)
                                                   >>  73 {}
 42                                                    74 
 43 using namespace std;                           <<  75 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >>  76  
                                                   >>  77 // destructor
                                                   >>  78  
                                                   >>  79 G4PhotoElectricEffect::~G4PhotoElectricEffect()
                                                   >>  80 {
                                                   >>  81    if (theCrossSectionTable) {
                                                   >>  82       theCrossSectionTable->clearAndDestroy();
                                                   >>  83       delete theCrossSectionTable;
                                                   >>  84    }
                                                   >>  85 
                                                   >>  86    if (theMeanFreePathTable) {
                                                   >>  87       theMeanFreePathTable->clearAndDestroy();
                                                   >>  88       delete theMeanFreePathTable;
                                                   >>  89    }
                                                   >>  90 }
                                                   >>  91 
                                                   >>  92 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 44                                                    93 
 45 G4PhotoElectricEffect::G4PhotoElectricEffect(c <<  94 void G4PhotoElectricEffect::SetPhysicsTableBining(
 46   G4ProcessType type):G4VEmProcess (processNam <<  95                                      G4double lowE, G4double highE, G4int nBins)
 47 {                                                  96 {
 48   SetBuildTableFlag(false);                    <<  97   LowestEnergyLimit = lowE; HighestEnergyLimit = highE; NumbBinTable = nBins;
 49   SetSecondaryParticle(G4Electron::Electron()) <<  98 }  
 50   SetProcessSubType(fPhotoElectricEffect);     <<  99 
 51   SetMinKinEnergyPrim(200*keV);                << 100 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >> 101  
                                                   >> 102 void G4PhotoElectricEffect::BuildPhysicsTable(const G4ParticleDefinition&)
                                                   >> 103 
                                                   >> 104 // Build cross section per atom and mean free path tables
                                                   >> 105 {
                                                   >> 106    G4double LowEdgeEnergy, Value;
                                                   >> 107    G4PhysicsLogVector* ptrVector;
                                                   >> 108 
                                                   >> 109 // Build cross section per atom tables for the Photo Electric Effect
                                                   >> 110 
                                                   >> 111    if (theCrossSectionTable) {
                                                   >> 112        theCrossSectionTable->clearAndDestroy(); delete theCrossSectionTable;}
                                                   >> 113 
                                                   >> 114    theCrossSectionTable = new G4PhysicsTable( G4Element::GetNumberOfElements());
                                                   >> 115    const G4ElementTable* theElementTable = G4Element::GetElementTable();
                                                   >> 116    G4double AtomicNumber;
                                                   >> 117    size_t J;
                                                   >> 118 
                                                   >> 119    for ( J=0 ; J < G4Element::GetNumberOfElements(); J++ )  
                                                   >> 120       { 
                                                   >> 121         //create physics vector then fill it ....
                                                   >> 122         ptrVector = new G4PhysicsLogVector(LowestEnergyLimit,HighestEnergyLimit,
                                                   >> 123                                            NumbBinTable ) ;
                                                   >> 124         AtomicNumber = (*theElementTable)[J]->GetZ();
                                                   >> 125  
                                                   >> 126         for ( G4int i = 0 ; i < NumbBinTable ; i++ )      
                                                   >> 127            {
                                                   >> 128              LowEdgeEnergy = ptrVector->GetLowEdgeEnergy( i ) ;
                                                   >> 129              Value = ComputeCrossSectionPerAtom( LowEdgeEnergy, AtomicNumber);  
                                                   >> 130              ptrVector->PutValue( i , Value ) ;
                                                   >> 131            }
                                                   >> 132 
                                                   >> 133         theCrossSectionTable->insertAt( J , ptrVector ) ;
                                                   >> 134 
                                                   >> 135       }
                                                   >> 136 
                                                   >> 137 // Build mean free path table for the Photo Electric Effect
                                                   >> 138 
                                                   >> 139    if (theMeanFreePathTable) {
                                                   >> 140        theMeanFreePathTable->clearAndDestroy(); delete theMeanFreePathTable;}
                                                   >> 141 
                                                   >> 142    theMeanFreePathTable= new G4PhysicsTable(G4Material::GetNumberOfMaterials());
                                                   >> 143    const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable() ;
                                                   >> 144    G4Material* material;
                                                   >> 145 
                                                   >> 146    for ( J=0 ; J < G4Material::GetNumberOfMaterials(); J++ )  
                                                   >> 147      { 
                                                   >> 148         //create physics vector then fill it ....
                                                   >> 149         ptrVector = new G4PhysicsLogVector(LowestEnergyLimit,HighestEnergyLimit,
                                                   >> 150                                            NumbBinTable );
                                                   >> 151         material = (*theMaterialTable)[J];
                                                   >> 152  
                                                   >> 153         for ( G4int i = 0 ; i < NumbBinTable ; i++ )      
                                                   >> 154            {
                                                   >> 155              LowEdgeEnergy = ptrVector->GetLowEdgeEnergy( i ) ;
                                                   >> 156              Value = ComputeMeanFreePath( LowEdgeEnergy, material);  
                                                   >> 157              ptrVector->PutValue( i , Value ) ;
                                                   >> 158            }
                                                   >> 159 
                                                   >> 160         theMeanFreePathTable->insertAt( J , ptrVector ) ;
                                                   >> 161 
                                                   >> 162      }
                                                   >> 163                                     
                                                   >> 164     PrintInfoDefinition();  
 52 }                                                 165 }
 53                                                   166 
 54 //....oooOO0OOooo........oooOO0OOooo........oo    167 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >> 168  
                                                   >> 169 G4double G4PhotoElectricEffect::ComputeCrossSectionPerAtom(
                                                   >> 170                                                         G4double PhotonEnergy,
                                                   >> 171                                                         G4double AtomicNumber)
                                                   >> 172  
                                                   >> 173 // Calculates the cross section per atom in GEANT4 internal units.
                                                   >> 174 // A parametrized formula from L. Urban is used to estimate the 
                                                   >> 175 // total cross section.
                                                   >> 176 // It gives a good description of the elements : 5 < Atomic Number < 100 and
                                                   >> 177 //                                               from 10 keV to 50 MeV.
                                                   >> 178  
                                                   >> 179 {
                                                   >> 180  G4double CrossSection = 0.0 ;
                                                   >> 181  if ( AtomicNumber < 1. )      return CrossSection;
                                                   >> 182  if ( PhotonEnergy > 50.*MeV ) return CrossSection;
                                                   >> 183       
                                                   >> 184  static const G4double
                                                   >> 185    p1K =-8.8893e+2*nanobarn, p2K = 2.4394   *nanobarn, p3K = 2.8835e+2*nanobarn,
                                                   >> 186    p4K = 1.2133e+1*nanobarn, p5K =-3.1104e+2*nanobarn, p6K =-1.7284e-1*nanobarn,
                                                   >> 187    p7K = 1.4400e+1*nanobarn, p8K = 6.8357e+1*nanobarn, p9K = 7.3945e-4*nanobarn,
                                                   >> 188    p10K=-4.8149e-2*nanobarn, p11K= 5.5823e-1*nanobarn, p12K=-1.0089e-1*nanobarn;
                                                   >> 189  static const G4double
                                                   >> 190    p1L1=-1.0927e+3*nanobarn, p2L1=-9.7897e-1*nanobarn, p3L1= 1.2854e+2*nanobarn;
                                                   >> 191  static const G4double
                                                   >> 192    p1L2=-4.5803e+3*nanobarn, p2L2= 1.6858e-3*nanobarn, p3L2= 1.2013e+2*nanobarn;
                                                   >> 193  static const G4double 
                                                   >> 194    p1M = 1.6924e+1*nanobarn;
                                                   >> 195 
                                                   >> 196  const G4double pwZ = 3.845 ,  pwE = 2.975 ; 
                                                   >> 197     
                                                   >> 198  G4double Z  = AtomicNumber,                  Z2  = Z*Z,   Z3  = Z*Z*Z;
                                                   >> 199  G4double Em = PhotonEnergy/electron_mass_c2, Em2 = Em*Em, Em3 = Em*Em*Em;
                                                   >> 200 
                                                   >> 201  CrossSection = pow(Z,pwZ)/pow(Em,pwE);
                                                   >> 202 
                                                   >> 203  if (PhotonEnergy > ComputeKBindingEnergy(Z) ) {
                                                   >> 204       CrossSection *= (p1K/Z  + p2K/Em + p3K + p4K*Z + p5K*Em
                                                   >> 205                     +  p6K*Z2 + p7K *Z *Em + p8K   *Em2
                                                   >> 206                     +  p9K*Z3 + p10K*Z2*Em + p11K*Z*Em2 + p12K*Em3);
                                                   >> 207       if (CrossSection < 0.) CrossSection = 0. ;
                                                   >> 208     }
                                                   >> 209 
                                                   >> 210  else if (PhotonEnergy > ComputeL1BindingEnergy(Z) ) {
                                                   >> 211       CrossSection *= (p1L1/Z + p2L1/Em + p3L1 );
                                                   >> 212       if (CrossSection < 0.) CrossSection = 0. ;
                                                   >> 213     }
                                                   >> 214 
                                                   >> 215  else if (PhotonEnergy > ComputeL2BindingEnergy(Z) ) {
                                                   >> 216       CrossSection *= (p1L2/Z + p2L2/Em + p3L2 );
                                                   >> 217       if (CrossSection < 0.) CrossSection = 0. ;
                                                   >> 218     }
 55                                                   219 
 56 G4PhotoElectricEffect::~G4PhotoElectricEffect( << 220  else CrossSection *= p1M;
 57                                                   221 
 58 //....oooOO0OOooo........oooOO0OOooo........oo << 222  return CrossSection;
                                                   >> 223 }
                                                   >> 224 
                                                   >> 225 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >> 226  
                                                   >> 227 G4double G4PhotoElectricEffect::ComputeKBindingEnergy (G4double Z)
                                                   >> 228  
                                                   >> 229 // Calculates the binding energy of the K electronic shell, as a function
                                                   >> 230 // of the Atomic Number, from a parametrized formula of L. Urban.
                                                   >> 231 
                                                   >> 232 {
                                                   >> 233   const G4double
                                                   >> 234   aK (6.6644*eV), bK (2.2077e-1*eV), cK (-3.2552e-3*eV), dK (1.8199e-5*eV);
                                                   >> 235 
                                                   >> 236   return Z*Z*(aK  + Z* (bK + Z* (cK + Z* dK))); 
                                                   >> 237 }
                                                   >> 238 
                                                   >> 239 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >> 240 
                                                   >> 241 G4double G4PhotoElectricEffect::ComputeL1BindingEnergy (G4double Z)
                                                   >> 242  
                                                   >> 243 // Calculates the binding energy of the L1 electronic shell, as a function
                                                   >> 244 // of the Atomic Number, from a parametrized formula of L. Urban.
 59                                                   245 
 60 G4bool G4PhotoElectricEffect::IsApplicable(con << 
 61 {                                                 246 {
 62   return (&p == G4Gamma::Gamma());             << 247   const G4double
                                                   >> 248   aL1(-2.9179e-1*eV), bL1(8.7983e-2*eV), cL1(-1.2589e-3*eV), dL1(6.9602e-6*eV);
                                                   >> 249   
                                                   >> 250   return Z*Z*(aL1 + Z* (bL1 + Z* (cL1 + Z* dL1)));
 63 }                                                 251 }
 64                                                   252 
 65 //....oooOO0OOooo........oooOO0OOooo........oo    253 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 66                                                   254 
 67 void G4PhotoElectricEffect::InitialiseProcess( << 255 G4double G4PhotoElectricEffect::ComputeL2BindingEnergy (G4double Z)
                                                   >> 256  
                                                   >> 257 // Calculates the binding energy of the L2 electronic shell, as a function
                                                   >> 258 // of the Atomic Number, from a parametrized formula of L. Urban.
                                                   >> 259 
 68 {                                                 260 {
 69   if(!isInitialised) {                         << 261   const G4double
 70     isInitialised = true;                      << 262   aL2(-6.8606e-1*eV), bL2(1.0078e-1*eV), cL2(-1.4496e-3*eV), dL2(7.8809e-6*eV);
 71     if(nullptr == EmModel()) { SetEmModel(new  << 263 
 72     G4EmParameters* param = G4EmParameters::In << 264   return Z*Z*(aL2 + Z* (bL2 + Z* (cL2 + Z* dL2)));
 73     EmModel()->SetLowEnergyLimit(param->MinKin << 265 }
 74     EmModel()->SetHighEnergyLimit(param->MaxKi << 266 
 75     AddEmModel(1, EmModel());                  << 267 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >> 268                                                           
                                                   >> 269 G4double G4PhotoElectricEffect::ComputeSandiaCrossSection(G4double PhotonEnergy,
                                                   >> 270                                                           G4double AtomicNumber)
                                                   >> 271 {  
                                                   >> 272   G4double energy2 = PhotonEnergy*PhotonEnergy, energy3 = PhotonEnergy*energy2, 
                                                   >> 273            energy4 = energy2*energy2;
                                                   >> 274 
                                                   >> 275   G4double* SandiaCof 
                                                   >> 276            = G4SandiaTable::GetSandiaCofPerAtom((int)AtomicNumber,PhotonEnergy);
                                                   >> 277 
                                                   >> 278   return SandiaCof[0]/PhotonEnergy + SandiaCof[1]/energy2 +
                                                   >> 279    SandiaCof[2]/energy3      + SandiaCof[3]/energy4; 
                                                   >> 280 }
                                                   >> 281  
                                                   >> 282 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >> 283 
                                                   >> 284 G4double G4PhotoElectricEffect::ComputeMeanFreePath(G4double GammaEnergy,
                                                   >> 285                                                           G4Material* aMaterial)
                                                   >> 286 
                                                   >> 287 // returns the gamma mean free path in GEANT4 internal units
                                                   >> 288 
                                                   >> 289 {
                                                   >> 290   const G4ElementVector* theElementVector = aMaterial->GetElementVector();
                                                   >> 291   const G4double* NbOfAtomsPerVolume = aMaterial->GetVecNbOfAtomsPerVolume();   
                                                   >> 292 
                                                   >> 293   G4double SIGMA = 0;
                                                   >> 294 
                                                   >> 295   for ( size_t elm=0 ; elm < aMaterial->GetNumberOfElements() ; elm++ )
                                                   >> 296       {             
                                                   >> 297             SIGMA += NbOfAtomsPerVolume[elm] * 
                                                   >> 298                      ComputeCrossSectionPerAtom(GammaEnergy,
                                                   >> 299                                              (*theElementVector)[elm]->GetZ());
                                                   >> 300       }       
                                                   >> 301 
                                                   >> 302   return SIGMA > DBL_MIN ? 1./SIGMA : DBL_MAX ;
                                                   >> 303 }
                                                   >> 304 
                                                   >> 305 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >> 306                                                          
                                                   >> 307 G4double G4PhotoElectricEffect::ComputeSandiaMeanFreePath(G4double GammaEnergy,
                                                   >> 308                                                           G4Material* aMaterial)
                                                   >> 309 {
                                                   >> 310   G4double energy2 = GammaEnergy*GammaEnergy, energy3 = GammaEnergy*energy2, 
                                                   >> 311            energy4 = energy2*energy2;
                                                   >> 312 
                                                   >> 313   G4double* SandiaCof = aMaterial->GetSandiaTable()
                                                   >> 314                                  ->GetSandiaCofForMaterial(GammaEnergy);
                                                   >> 315 
                                                   >> 316   G4double SIGMA = SandiaCof[0]/GammaEnergy + SandiaCof[1]/energy2 +
                                                   >> 317              SandiaCof[2]/energy3     + SandiaCof[3]/energy4; 
                                                   >> 318           
                                                   >> 319   return SIGMA > DBL_MIN ? 1./SIGMA : DBL_MAX ;
                                                   >> 320 }
                                                   >> 321 
                                                   >> 322 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >> 323  
                                                   >> 324 G4VParticleChange* G4PhotoElectricEffect::PostStepDoIt(const G4Track& aTrack,
                                                   >> 325                                                       const G4Step&  aStep)
                                                   >> 326 //
                                                   >> 327 // Generate an electron resulting of a photo electric effect.
                                                   >> 328 // The incident photon disappear.
                                                   >> 329 // GEANT4 internal units
                                                   >> 330 //
                                                   >> 331  
                                                   >> 332 {  aParticleChange.Initialize(aTrack);
                                                   >> 333    G4Material* aMaterial = aTrack.GetMaterial();
                                                   >> 334 
                                                   >> 335    const G4DynamicParticle* aDynamicPhoton = aTrack.GetDynamicParticle();
                                                   >> 336 
                                                   >> 337    G4double PhotonEnergy = aDynamicPhoton->GetKineticEnergy();
                                                   >> 338    G4ParticleMomentum PhotonDirection = aDynamicPhoton->GetMomentumDirection();
                                                   >> 339    
                                                   >> 340    // select randomly one element constituing the material.
                                                   >> 341    G4Element* anElement = SelectRandomAtom(aDynamicPhoton, aMaterial);
                                                   >> 342 
                                                   >> 343    //
                                                   >> 344    // Photo electron
                                                   >> 345    //
                                                   >> 346 
                                                   >> 347    G4int NbOfShells = anElement->GetNbOfAtomicShells();
                                                   >> 348    G4int i=0;
                                                   >> 349    while ((i<NbOfShells)&&(PhotonEnergy<anElement->GetAtomicShell(i))) i++;
                                                   >> 350 
                                                   >> 351    if (i==NbOfShells) return G4VDiscreteProcess::PostStepDoIt(aTrack,aStep);
                                                   >> 352       
                                                   >> 353    G4double ElecKineEnergy = PhotonEnergy - anElement->GetAtomicShell(i);
                                                   >> 354 
                                                   >> 355    if (ElecKineEnergy > fminimalEnergy)
                                                   >> 356      {
                                                   >> 357       // the electron is created in the direction of the incident photon ...  
                                                   >> 358       G4DynamicParticle* aElectron = new G4DynamicParticle (
                                                   >> 359                         G4Electron::Electron(),PhotonDirection, ElecKineEnergy);
                                                   >> 360       aParticleChange.SetNumberOfSecondaries(1);
                                                   >> 361       aParticleChange.AddSecondary( aElectron ); 
                                                   >> 362      }
                                                   >> 363    else
                                                   >> 364      {
                                                   >> 365       ElecKineEnergy = 0.;
                                                   >> 366       aParticleChange.SetNumberOfSecondaries(0);
                                                   >> 367      }
                                                   >> 368 
                                                   >> 369    //
                                                   >> 370    // Kill the incident photon 
                                                   >> 371    //
                                                   >> 372    aParticleChange.SetLocalEnergyDeposit(PhotonEnergy-ElecKineEnergy);
                                                   >> 373    aParticleChange.SetEnergyChange(0.);  
                                                   >> 374    aParticleChange.SetStatusChange(fStopAndKill); 
                                                   >> 375 
                                                   >> 376    //  Reset NbOfInteractionLengthLeft and return aParticleChange
                                                   >> 377    return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
                                                   >> 378 }
                                                   >> 379 
                                                   >> 380 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >> 381 
                                                   >> 382 G4Element* G4PhotoElectricEffect::SelectRandomAtom(
                                                   >> 383                                      const G4DynamicParticle* aDynamicPhoton,
                                                   >> 384                                            G4Material* aMaterial)
                                                   >> 385 {
                                                   >> 386   // select randomly 1 element within the material
                                                   >> 387 
                                                   >> 388   const G4int NumberOfElements            = aMaterial->GetNumberOfElements();
                                                   >> 389   const G4ElementVector* theElementVector = aMaterial->GetElementVector();
                                                   >> 390   if (NumberOfElements == 1) return (*theElementVector)[0];
                                                   >> 391 
                                                   >> 392   const G4double* NbOfAtomsPerVolume = aMaterial->GetVecNbOfAtomsPerVolume();
                                                   >> 393 
                                                   >> 394   G4double PartialSumSigma = 0. ;
                                                   >> 395   G4double rval = G4UniformRand();
                                                   >> 396  
                                                   >> 397   for ( G4int elm=0 ; elm < NumberOfElements ; elm++ )
                                                   >> 398      {PartialSumSigma += NbOfAtomsPerVolume[elm] *
                                                   >> 399                          GetCrossSectionPerAtom(aDynamicPhoton,
                                                   >> 400                                          (*theElementVector)[elm]);
                                                   >> 401       if (rval<=PartialSumSigma*MeanFreePath) return ((*theElementVector)[elm]);
                                                   >> 402      }
                                                   >> 403   return ((*theElementVector)[NumberOfElements-1]);    
                                                   >> 404 }
                                                   >> 405 
                                                   >> 406 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >> 407 
                                                   >> 408 G4bool G4PhotoElectricEffect::StorePhysicsTable(G4ParticleDefinition* particle,
                                                   >> 409                       const G4String& directory, 
                                                   >> 410                       G4bool          ascii)
                                                   >> 411 {
                                                   >> 412   G4String filename;
                                                   >> 413 
                                                   >> 414   // store cross section table
                                                   >> 415   filename = GetPhysicsTableFileName(particle,directory,"CrossSection",ascii);
                                                   >> 416   if ( !theCrossSectionTable->StorePhysicsTable(filename, ascii) ){
                                                   >> 417     G4cout << " FAIL theCrossSectionTable->StorePhysicsTable in " << filename
                                                   >> 418            << G4endl;
                                                   >> 419     return false;
                                                   >> 420   }
                                                   >> 421 
                                                   >> 422   // store mean free path table
                                                   >> 423   filename = GetPhysicsTableFileName(particle,directory,"MeanFreePath",ascii);
                                                   >> 424   if ( !theMeanFreePathTable->StorePhysicsTable(filename, ascii) ){
                                                   >> 425     G4cout << " FAIL theMeanFreePathTable->StorePhysicsTable in " << filename
                                                   >> 426            << G4endl;
                                                   >> 427     return false;
 76   }                                               428   }
                                                   >> 429   
                                                   >> 430   G4cout << GetProcessName() << " for " << particle->GetParticleName()
                                                   >> 431          << ": Success to store the PhysicsTables in "  
                                                   >> 432          << directory << G4endl;
                                                   >> 433   return true;
 77 }                                                 434 }
 78                                                   435 
 79 //....oooOO0OOooo........oooOO0OOooo........oo    436 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 80                                                   437 
 81 void G4PhotoElectricEffect::ProcessDescription << 438 G4bool G4PhotoElectricEffect::RetrievePhysicsTable(
                                                   >> 439                                                  G4ParticleDefinition* particle,
                                                   >> 440                    const G4String& directory, 
                                                   >> 441                          G4bool          ascii)
 82 {                                                 442 {
 83   out << "  Photoelectric effect";             << 443   // delete theCrossSectionTable and theMeanFreePathTable
 84   G4VEmProcess::ProcessDescription(out);       << 444   if (theCrossSectionTable != 0) {
                                                   >> 445     theCrossSectionTable->clearAndDestroy();
                                                   >> 446     delete theCrossSectionTable;
                                                   >> 447   }
                                                   >> 448   if (theMeanFreePathTable != 0) {
                                                   >> 449     theMeanFreePathTable->clearAndDestroy();
                                                   >> 450     delete theMeanFreePathTable;
                                                   >> 451   }
                                                   >> 452 
                                                   >> 453   G4String filename;
                                                   >> 454 
                                                   >> 455   // retreive cross section table
                                                   >> 456   filename = GetPhysicsTableFileName(particle,directory,"CrossSection",ascii);
                                                   >> 457   theCrossSectionTable = new G4PhysicsTable(G4Element::GetNumberOfElements());
                                                   >> 458   if ( !theCrossSectionTable->RetrievePhysicsTable(filename, ascii) ){
                                                   >> 459     G4cout << " FAIL theCrossSectionTable->RetrievePhysicsTable in " << filename
                                                   >> 460            << G4endl;  
                                                   >> 461     return false;
                                                   >> 462   }
                                                   >> 463 
                                                   >> 464   // retreive mean free path table
                                                   >> 465   filename = GetPhysicsTableFileName(particle,directory,"MeanFreePath",ascii);
                                                   >> 466   theMeanFreePathTable = new G4PhysicsTable(G4Material::GetNumberOfMaterials());
                                                   >> 467   if ( !theMeanFreePathTable->RetrievePhysicsTable(filename, ascii) ){
                                                   >> 468     G4cout << " FAIL theMeanFreePathTable->RetrievePhysicsTable in " << filename
                                                   >> 469            << G4endl;  
                                                   >> 470     return false;
                                                   >> 471   }
                                                   >> 472   
                                                   >> 473   G4cout << GetProcessName() << " for " << particle->GetParticleName()
                                                   >> 474          << ": Success to retrieve the PhysicsTables from "
                                                   >> 475          << directory << G4endl;
                                                   >> 476   return true;
 85 }                                                 477 }
                                                   >> 478  
                                                   >> 479 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >> 480 
                                                   >> 481 void G4PhotoElectricEffect::PrintInfoDefinition()
                                                   >> 482 {
                                                   >> 483   G4String comments = "Total cross sections from a parametrisation. ";
                                                   >> 484            comments += "Good description from 10 KeV to 50 MeV for all Z";
                                                   >> 485            comments += "\n        Sandia crossSection below 50 KeV";
                                                   >> 486                
                                                   >> 487   G4cout << G4endl << GetProcessName() << ":  " << comments
                                                   >> 488          << "\n       PhysicsTables from "
                                                   >> 489              << G4BestUnit(LowestEnergyLimit, "Energy")
                                                   >> 490          << " to " << G4BestUnit(HighestEnergyLimit,"Energy") 
                                                   >> 491          << " in " << NumbBinTable << " bins. \n";
                                                   >> 492 }         
 86                                                   493 
 87 //....oooOO0OOooo........oooOO0OOooo........oo    494 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 88                                                   495