Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/processes/electromagnetic/standard/src/G4eIonisation.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/G4eIonisation.cc (Version 11.3.0) and /processes/electromagnetic/standard/src/G4eIonisation.cc (Version 5.1.p1)


  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 // ------------------------------------------- << 
 27 //                                                 23 //
 28 // GEANT4 Class file                           <<  24 // $Id: G4eIonisation.cc,v 1.29 2003/04/26 11:38:12 vnivanch Exp $
                                                   >>  25 // GEANT4 tag $Name: geant4-05-01-patch-01 $
 29 //                                                 26 //
                                                   >>  27 //--------------- G4eIonisation physics process --------------------------------
                                                   >>  28 //                by Laszlo Urban, 20 March 1997
                                                   >>  29 //------------------------------------------------------------------------------
 30 //                                                 30 //
 31 // File name:     G4eIonisation                <<  31 // 07-04-98 remove 'tracking cut' of the ionizing particle, mma
 32 //                                             <<  32 // 04-09-98 new methods SetBining() PrintInfo()
 33 // Author:        Laszlo Urban                 <<  33 // 07-09-98 Cleanup
 34 //                                             <<  34 // 02-02-99 correction inDoIt , L.Urban
 35 // Creation date: 20.03.1997                   <<  35 // 10-02-00 modifications , new e.m. structure, L.Urban
 36 //                                             <<  36 // 28-05-01 V.Ivanchenko minor changes to provide ANSI -wall compilation
 37 // Modified by Michel Maire and Vladimir Ivanc <<  37 // 09-08-01 new methods Store/Retrieve PhysicsTable (mma)
 38 //                                             <<  38 // 13-08-01 new function ComputeRestrictedMeandEdx()  (mma)
 39 // ------------------------------------------- <<  39 // 17-09-01 migration of Materials to pure STL (mma)
 40 //                                             <<  40 // 21-09-01 completion of RetrievePhysicsTable() (mma)
 41 //....oooOO0OOooo........oooOO0OOooo........oo <<  41 // 29-10-01 all static functions no more inlined (mma)
 42 //....oooOO0OOooo........oooOO0OOooo........oo <<  42 // 07-11-01 particleMass and Charge become local variables
                                                   >>  43 // 26-03-02 change access to cuts in BuildLossTables (V.Ivanchenko)
                                                   >>  44 // 16-01-03 Migrade to cut per region (V.Ivanchenko)
                                                   >>  45 // 08-04-03 finalRange is region aware (V.Ivanchenko)
                                                   >>  46 // 26-04-03 fix problems of retrieve tables (V.Ivanchenko)
                                                   >>  47 //------------------------------------------------------------------------------
                                                   >>  48 
                                                   >>  49 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >>  50 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 43                                                    51 
 44 #include "G4eIonisation.hh"                        52 #include "G4eIonisation.hh"
 45 #include "G4Electron.hh"                       <<  53 #include "G4UnitsTable.hh"
 46 #include "G4MollerBhabhaModel.hh"              <<  54 #include "G4ProductionCutsTable.hh"
 47 #include "G4EmParameters.hh"                   <<  55 
 48 #include "G4EmStandUtil.hh"                    <<  56 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >>  57 
                                                   >>  58 G4double G4eIonisation::LowerBoundLambda = 1.*keV;
                                                   >>  59 G4double G4eIonisation::UpperBoundLambda = 100.*TeV;
                                                   >>  60 G4int    G4eIonisation::NbinLambda = 100;
                                                   >>  61 
                                                   >>  62 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >>  63 
                                                   >>  64 G4eIonisation::G4eIonisation(const G4String& processName)
                                                   >>  65    : G4VeEnergyLoss(processName),
                                                   >>  66      theMeanFreePathTable(NULL)
                                                   >>  67 {}
 49                                                    68 
 50 //....oooOO0OOooo........oooOO0OOooo........oo <<  69 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 51                                                    70 
 52 G4eIonisation::G4eIonisation(const G4String& n <<  71 G4eIonisation::~G4eIonisation()
 53   : G4VEnergyLossProcess(name),                << 
 54     theElectron(G4Electron::Electron()),       << 
 55     isElectron(true),                          << 
 56     isInitialised(false)                       << 
 57 {                                                  72 {
 58   SetProcessSubType(fIonisation);              <<  73      if (theMeanFreePathTable)
 59   SetSecondaryParticle(theElectron);           <<  74        {theMeanFreePathTable->clearAndDestroy(); delete theMeanFreePathTable;}
 60 }                                                  75 }
 61                                                    76 
 62 //....oooOO0OOooo........oooOO0OOooo........oo <<  77 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >>  78 
                                                   >>  79 void G4eIonisation::SetLowerBoundLambda(G4double val)
                                                   >>  80      {LowerBoundLambda = val;}
                                                   >>  81 
                                                   >>  82 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >>  83 
                                                   >>  84 void G4eIonisation::SetUpperBoundLambda(G4double val)
                                                   >>  85      {UpperBoundLambda = val;}
                                                   >>  86 
                                                   >>  87 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >>  88 
                                                   >>  89 void G4eIonisation::SetNbinLambda(G4int n)
                                                   >>  90      {NbinLambda = n;}
                                                   >>  91 
                                                   >>  92 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >>  93 
                                                   >>  94 G4double G4eIonisation::GetLowerBoundLambda()
                                                   >>  95         {return LowerBoundLambda;}
                                                   >>  96 
                                                   >>  97 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >>  98 
                                                   >>  99 G4double G4eIonisation::GetUpperBoundLambda()
                                                   >> 100         {return UpperBoundLambda;}
                                                   >> 101 
                                                   >> 102 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >> 103 
                                                   >> 104 G4int G4eIonisation::GetNbinLambda()
                                                   >> 105      {return NbinLambda;}
                                                   >> 106 
                                                   >> 107 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >> 108 
                                                   >> 109 void G4eIonisation::BuildPhysicsTable(const G4ParticleDefinition& aParticleType)
                                                   >> 110 {
                                                   >> 111   if( !CutsWhereModified() && theLossTable) return;
                                                   >> 112 
                                                   >> 113   LowestKineticEnergy  = GetLowerBoundEloss();
                                                   >> 114   HighestKineticEnergy = GetUpperBoundEloss();
                                                   >> 115   TotBin               = GetNbinEloss();
                                                   >> 116 
                                                   >> 117   BuildLossTable(aParticleType);
                                                   >> 118 
                                                   >> 119   if (&aParticleType==G4Electron::Electron())
                                                   >> 120     {
                                                   >> 121      RecorderOfElectronProcess[CounterOfElectronProcess] = (*this).theLossTable;
                                                   >> 122      CounterOfElectronProcess++;
                                                   >> 123     }
                                                   >> 124   else
                                                   >> 125     {
                                                   >> 126      RecorderOfPositronProcess[CounterOfPositronProcess] = (*this).theLossTable;
                                                   >> 127      CounterOfPositronProcess++;
                                                   >> 128     }
                                                   >> 129 
                                                   >> 130   BuildLambdaTable(aParticleType);
                                                   >> 131 
                                                   >> 132   BuildDEDXTable(aParticleType);
                                                   >> 133 
                                                   >> 134   if (&aParticleType==G4Electron::Electron()) PrintInfoDefinition();
                                                   >> 135 }
                                                   >> 136 
                                                   >> 137 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >> 138 
                                                   >> 139 void G4eIonisation::BuildLossTable(const G4ParticleDefinition& aParticleType)
                                                   >> 140 {
                                                   >> 141 
                                                   >> 142   const G4ProductionCutsTable* theCoupleTable=
                                                   >> 143         G4ProductionCutsTable::GetProductionCutsTable();
                                                   >> 144   size_t numOfCouples = theCoupleTable->GetTableSize();
                                                   >> 145 
                                                   >> 146   if (theLossTable) {theLossTable->clearAndDestroy(); delete theLossTable;}
                                                   >> 147   theLossTable = new G4PhysicsTable(numOfCouples);
                                                   >> 148 
                                                   >> 149   secondaryEnergyCuts = theCoupleTable->GetEnergyCutsVector(1);
                                                   >> 150 
                                                   >> 151   //  loop for materials
                                                   >> 152   //
                                                   >> 153   for (size_t J=0; J<numOfCouples; J++)
                                                   >> 154    {
                                                   >> 155 
                                                   >> 156      G4PhysicsLogVector* aVector = new G4PhysicsLogVector(
                                                   >> 157                          LowestKineticEnergy, HighestKineticEnergy, TotBin);
                                                   >> 158 
                                                   >> 159      const G4MaterialCutsCouple* couple = theCoupleTable->GetMaterialCutsCouple(J);
                                                   >> 160      const G4Material* material= couple->GetMaterial();
                                                   >> 161 
                                                   >> 162      // get  electron cut in kinetic energy for the material
                                                   >> 163      G4double DeltaThreshold = SecondaryEnergyThreshold(J);
                                                   >> 164 
                                                   >> 165 
                                                   >> 166      // now comes the loop for the kinetic energy values
                                                   >> 167      //
                                                   >> 168       for (G4int i = 0; i < TotBin; i++)
                                                   >> 169          {
                                                   >> 170           G4double dEdx = ComputeRestrictedMeandEdx(aParticleType,
                                                   >> 171                                              aVector->GetLowEdgeEnergy(i),
                                                   >> 172                                              material,
                                                   >> 173                                              DeltaThreshold);
                                                   >> 174       if(1 < verboseLevel) {
                                                   >> 175         G4cout << "Material= " << material->GetName()
                                                   >> 176                << "   E(MeV)= " << aVector->GetLowEdgeEnergy(i)/MeV
                                                   >> 177                << "  dEdx(MeV/mm)= " << dEdx*mm/MeV
                                                   >> 178                << G4endl;
                                                   >> 179       }
                                                   >> 180           aVector->PutValue(i,dEdx);
                                                   >> 181          }
                                                   >> 182       theLossTable->insert(aVector);
                                                   >> 183     }
                                                   >> 184 }
                                                   >> 185 
                                                   >> 186 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >> 187 
                                                   >> 188 void G4eIonisation::BuildLambdaTable(const G4ParticleDefinition& aParticleType)
                                                   >> 189 {
                                                   >> 190 
                                                   >> 191   if(0 < verboseLevel) {
                                                   >> 192     G4cout << "G4eIonisation::BuildLambdaTable() for process "
                                                   >> 193            << GetProcessName() << " and particle "
                                                   >> 194            << aParticleType.GetParticleName() << G4endl;
                                                   >> 195   }
 63                                                   196 
 64 G4eIonisation::~G4eIonisation() = default;     << 197   //create table
                                                   >> 198   //
                                                   >> 199   const G4ProductionCutsTable* theCoupleTable=
                                                   >> 200         G4ProductionCutsTable::GetProductionCutsTable();
                                                   >> 201   size_t numOfCouples = theCoupleTable->GetTableSize();
                                                   >> 202 
                                                   >> 203   if (theMeanFreePathTable)
                                                   >> 204     { theMeanFreePathTable->clearAndDestroy(); delete theMeanFreePathTable;}
                                                   >> 205 
                                                   >> 206   theMeanFreePathTable = new G4PhysicsTable(numOfCouples);
                                                   >> 207 
                                                   >> 208   secondaryEnergyCuts = theCoupleTable->GetEnergyCutsVector(1);
                                                   >> 209 
                                                   >> 210   // loop for materials
                                                   >> 211 
                                                   >> 212   for (size_t J=0 ; J < numOfCouples; J++)
                                                   >> 213     {
                                                   >> 214 
                                                   >> 215       G4PhysicsLogVector* aVector = new G4PhysicsLogVector(
                                                   >> 216                LowerBoundLambda, UpperBoundLambda, NbinLambda);
                                                   >> 217 
                                                   >> 218      // compute the (macroscopic) cross section first
                                                   >> 219       const G4MaterialCutsCouple* couple = theCoupleTable->GetMaterialCutsCouple(J);
                                                   >> 220       const G4Material* material= couple->GetMaterial();
                                                   >> 221 
                                                   >> 222       // get  electron cut in kinetic energy for the material
                                                   >> 223       G4double DeltaThreshold = SecondaryEnergyThreshold(J);
                                                   >> 224 
                                                   >> 225       const G4ElementVector* theElementVector = material->GetElementVector();
                                                   >> 226       const G4double* NbOfAtomsPerVolume = material->GetVecNbOfAtomsPerVolume();
                                                   >> 227       G4int NumberOfElements = material->GetNumberOfElements();
                                                   >> 228 
                                                   >> 229       for (G4int i = 0 ; i < NbinLambda ; i++)
                                                   >> 230         {
                                                   >> 231     G4double LowEdgeEnergy = aVector->GetLowEdgeEnergy(i);
                                                   >> 232     G4double SIGMA = 0.;
                                                   >> 233           for (G4int iel=0; iel<NumberOfElements; iel++ )
                                                   >> 234              {
                                                   >> 235               SIGMA += NbOfAtomsPerVolume[iel]*
                                                   >> 236                        ComputeCrossSectionPerAtom(aParticleType,
                                                   >> 237                                                   LowEdgeEnergy,
                                                   >> 238                                (*theElementVector)[iel]->GetZ(),
                                                   >> 239                                                 DeltaThreshold);
                                                   >> 240              }
                                                   >> 241 
                                                   >> 242           // mean free path = 1./macroscopic cross section
                                                   >> 243           G4double Value = SIGMA > DBL_MIN ? 1./SIGMA : DBL_MAX;
                                                   >> 244           aVector->PutValue(i, Value);
                                                   >> 245         }
                                                   >> 246      theMeanFreePathTable->insert(aVector);
                                                   >> 247     }
                                                   >> 248 }
 65                                                   249 
 66 //....oooOO0OOooo........oooOO0OOooo........oo << 250 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 67                                                   251 
 68 G4double G4eIonisation::MinPrimaryEnergy(const << 252 G4double G4eIonisation::ComputeRestrictedMeandEdx (
 69            const G4Material*,                  << 253                                  const G4ParticleDefinition& aParticleType,
 70            G4double cut)                       << 254                                  G4double KineticEnergy,
                                                   >> 255          const G4Material* material,
                                                   >> 256          G4double DeltaThreshold)
 71 {                                                 257 {
 72   G4double x = cut;                            << 258  // calculate the dE/dx due to the ionization process (Geant4 internal units)
 73   if(isElectron) x += cut;                     << 259  // Seltzer-Berger formula
 74   return x;                                    << 260  //
                                                   >> 261  G4double particleMass = aParticleType.GetPDGMass();
                                                   >> 262 
                                                   >> 263  G4double ElectronDensity = material->GetElectronDensity();
                                                   >> 264  G4double Eexc = material->GetIonisation()->GetMeanExcitationEnergy();
                                                   >> 265  Eexc  /= particleMass; G4double Eexcm2 = Eexc*Eexc;
                                                   >> 266 
                                                   >> 267  // for the lowenergy extrapolation
                                                   >> 268  G4double Zeff = material->GetTotNbOfElectPerVolume()/
                                                   >> 269                  material->GetTotNbOfAtomsPerVolume();
                                                   >> 270  G4double Th = 0.25*sqrt(Zeff)*keV;
                                                   >> 271  G4double Tsav = 0.;
                                                   >> 272  if (KineticEnergy < Th) {Tsav = KineticEnergy; KineticEnergy = Th;}
                                                   >> 273  
                                                   >> 274  G4double tau = KineticEnergy/particleMass;
                                                   >> 275  G4double gamma = tau + 1., gamma2 = gamma*gamma, bg2 = tau*(tau+2.);
                                                   >> 276  G4double beta2 = bg2/gamma2;
                                                   >> 277 
                                                   >> 278  G4double Tmax,d,dEdx;
                                                   >> 279 
                                                   >> 280  // electron
                                                   >> 281  if (&aParticleType==G4Electron::Electron())
                                                   >> 282    {
                                                   >> 283      Tmax = KineticEnergy/2.;
                                                   >> 284      d = G4std::min(DeltaThreshold, Tmax)/particleMass;
                                                   >> 285      dEdx = log(2.*(tau+2.)/Eexcm2)-1.-beta2
                                                   >> 286             + log((tau-d)*d)+tau/(tau-d)
                                                   >> 287             + (0.5*d*d+(2.*tau+1.)*log(1.-d/tau))/gamma2;
                                                   >> 288    }
                                                   >> 289    
                                                   >> 290  else        //positron
                                                   >> 291    {
                                                   >> 292      Tmax = KineticEnergy;  
                                                   >> 293      d = G4std::min(DeltaThreshold, Tmax)/particleMass;
                                                   >> 294      G4double d2=d*d/2., d3=d*d*d/3., d4=d*d*d*d/4.;
                                                   >> 295      G4double y=1./(1.+gamma);
                                                   >> 296      dEdx = log(2.*(tau+2.)/Eexcm2)+log(tau*d)
                                                   >> 297             - beta2*(tau+2.*d-y*(3.*d2+y*(d-d3+y*(d2-tau*d3+d4))))/tau;
                                                   >> 298    }
                                                   >> 299 
                                                   >> 300  //density correction
                                                   >> 301  G4double Cden   = material->GetIonisation()->GetCdensity();
                                                   >> 302  G4double Mden   = material->GetIonisation()->GetMdensity();
                                                   >> 303  G4double Aden   = material->GetIonisation()->GetAdensity();
                                                   >> 304  G4double X0den  = material->GetIonisation()->GetX0density();
                                                   >> 305  G4double X1den  = material->GetIonisation()->GetX1density();
                                                   >> 306 
                                                   >> 307  const G4double twoln10 = 2.*log(10.); 
                                                   >> 308  G4double  x = log(bg2)/twoln10;
                                                   >> 309  G4double delta;
                                                   >> 310  if (x < X0den) delta = 0.;
                                                   >> 311  else          {delta = twoln10*x - Cden;
                                                   >> 312                 if (x < X1den) delta += Aden*pow((X1den-x),Mden);
                                                   >> 313                } 
                                                   >> 314 
                                                   >> 315  //now you can compute the total ionization loss
                                                   >> 316  dEdx -= delta;
                                                   >> 317  dEdx *= twopi_mc2_rcl2*ElectronDensity/beta2;
                                                   >> 318  if (dEdx <= 0.) dEdx = 0.;
                                                   >> 319 
                                                   >> 320  // low energy ?
                                                   >> 321  const G4double Tl = 0.2*keV; 
                                                   >> 322  if (Tsav > 0.)
                                                   >> 323    {
                                                   >> 324     if (Tsav >= Tl) dEdx *= sqrt(KineticEnergy/Tsav);
                                                   >> 325     else            dEdx *= sqrt(KineticEnergy*Tsav)/Tl;
                                                   >> 326    }
                                                   >> 327  return dEdx;
 75 }                                                 328 }
 76                                                   329 
 77 //....oooOO0OOooo........oooOO0OOooo........oo << 330 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 78                                                   331 
 79 G4bool G4eIonisation::IsApplicable(const G4Par << 332 G4double G4eIonisation::ComputeCrossSectionPerAtom(
                                                   >> 333                                  const G4ParticleDefinition& aParticleType,
                                                   >> 334                                  G4double KineticEnergy,
                                                   >> 335                                  G4double AtomicNumber ,
                                                   >> 336                                  G4double DeltaThreshold)
 80 {                                                 337 {
 81   return (&p == theElectron || &p == G4Positro << 338   // calculates the cross section per atom (Geant4 internal units) 
                                                   >> 339   //(it is called for elements , AtomicNumber = Z )
                                                   >> 340 
                                                   >> 341   G4double particleMass = aParticleType.GetPDGMass();
                                                   >> 342   G4double TotalEnergy = KineticEnergy + particleMass;
                                                   >> 343 
                                                   >> 344   G4double betasquare = KineticEnergy*(TotalEnergy+particleMass)
                                                   >> 345                        /(TotalEnergy*TotalEnergy);
                                                   >> 346   G4double gamma = TotalEnergy/particleMass, gamma2 = gamma*gamma;
                                                   >> 347   G4double x=DeltaThreshold/KineticEnergy, x2 = x*x;
                                                   >> 348 
                                                   >> 349   G4double MaxKineticEnergyTransfer;
                                                   >> 350   if (&aParticleType==G4Electron::Electron())
                                                   >> 351                       MaxKineticEnergyTransfer = 0.5*KineticEnergy;
                                                   >> 352   else                MaxKineticEnergyTransfer =     KineticEnergy;
                                                   >> 353 
                                                   >> 354 
                                                   >> 355   G4double TotalCrossSection = 0.;
                                                   >> 356   if (MaxKineticEnergyTransfer > DeltaThreshold)
                                                   >> 357     {
                                                   >> 358       if (&aParticleType==G4Electron::Electron())   //Moller (e-e-) scattering
                                                   >> 359         {
                                                   >> 360           TotalCrossSection  = (gamma-1.)*(gamma-1.)*(0.5-x)/gamma2 + 1./x
                                                   >> 361                              - 1./(1.-x)-(2.*gamma-1.)*log((1.-x)/x)/gamma2;
                                                   >> 362           TotalCrossSection /= betasquare;
                                                   >> 363         }
                                                   >> 364       else                                         //Bhabha (e+e-) scattering
                                                   >> 365         {
                                                   >> 366           G4double y=1./(1.+gamma), y2 =y*y, y12=1.-2.*y;
                                                   >> 367           G4double b1=2.-y2, b2=y12*(3.+y2), b4=y12*y12*y12, b3=b4+y12*y12;
                                                   >> 368           TotalCrossSection = (1./x-1.)/betasquare+b1*log(x)+b2*(1.-x)
                                                   >> 369                             - b3*(1.-x2)/2.+b4*(1.-x2*x)/3.;
                                                   >> 370         }
                                                   >> 371       TotalCrossSection *= (twopi_mc2_rcl2*AtomicNumber/KineticEnergy);
                                                   >> 372      }
                                                   >> 373  return TotalCrossSection ;
 82 }                                                 374 }
 83                                                   375 
 84 //....oooOO0OOooo........oooOO0OOooo........oo << 376 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 85                                                   377 
 86 void G4eIonisation::InitialiseEnergyLossProces << 378 G4VParticleChange* G4eIonisation::PostStepDoIt( const G4Track& trackData,
 87         const G4ParticleDefinition* part,      << 379                                                 const G4Step&  stepData)
 88         const G4ParticleDefinition*)           << 
 89 {                                                 380 {
 90   if(!isInitialised) {                         << 381   aParticleChange.Initialize(trackData);
 91     if(part != theElectron) { isElectron = fal << 382 
 92     if (nullptr == EmModel(0)) { SetEmModel(ne << 383   const G4MaterialCutsCouple* couple = trackData.GetMaterialCutsCouple();
 93     G4EmParameters* param = G4EmParameters::In << 384   const G4DynamicParticle*  aParticle = trackData.GetDynamicParticle();
 94     EmModel(0)->SetLowEnergyLimit(param->MinKi << 385 
 95     EmModel(0)->SetHighEnergyLimit(param->MaxK << 386   G4double particleMass = aParticle->GetDefinition()->GetPDGMass();
 96     if (nullptr == FluctModel()) {             << 387   G4double Charge       = aParticle->GetDefinition()->GetPDGCharge();
 97       SetFluctModel(G4EmStandUtil::ModelOfFluc << 388   G4double KineticEnergy = aParticle->GetKineticEnergy();
                                                   >> 389   G4double TotalEnergy = KineticEnergy + particleMass;
                                                   >> 390   G4double Psquare = KineticEnergy*(TotalEnergy+particleMass);
                                                   >> 391   G4double TotalMomentum = sqrt(Psquare);
                                                   >> 392   G4ParticleMomentum ParticleDirection = aParticle->GetMomentumDirection();
                                                   >> 393 
                                                   >> 394   // get kinetic energy cut for the electron
                                                   >> 395   G4double DeltaThreshold = SecondaryEnergyThreshold(couple->GetIndex());
                                                   >> 396 
                                                   >> 397   // some kinematics
                                                   >> 398   G4double MaxKineticEnergyTransfer;
                                                   >> 399   if (Charge < 0.) MaxKineticEnergyTransfer = 0.5*KineticEnergy;
                                                   >> 400   else             MaxKineticEnergyTransfer =     KineticEnergy;
                                                   >> 401 
                                                   >> 402   // sampling kinetic energy of the delta ray
                                                   >> 403 
                                                   >> 404   if (MaxKineticEnergyTransfer <= DeltaThreshold)
                                                   >> 405      // pathological case (should not happen, there is no change at all)
                                                   >> 406      return G4VContinuousDiscreteProcess::PostStepDoIt(trackData,stepData);
                                                   >> 407 
                                                   >> 408 
                                                   >> 409   // normal case
                                                   >> 410   G4double cc,y,y2,c2,b0,b1,b2,b3,b4,x,x1,grej,grejc;
                                                   >> 411 
                                                   >> 412   G4double tau = KineticEnergy/particleMass;
                                                   >> 413   G4double gamma = tau+1., gamma2=gamma*gamma;
                                                   >> 414   G4double xc = DeltaThreshold/KineticEnergy, xc1=1.-xc;
                                                   >> 415 
                                                   >> 416   if (Charge < 0.)  // Moller (e-e-) scattering
                                                   >> 417     {
                                                   >> 418       b1=4./(9.*gamma2-10.*gamma+5.);
                                                   >> 419       b2=tau*tau*b1; b3=(2.*gamma2+2.*gamma-1.)*b1;
                                                   >> 420       cc=1.-2.*xc;
                                                   >> 421       do {
                                                   >> 422            x    = xc/(1.-cc*G4UniformRand()); x1 = 1.-x;
                                                   >> 423            grej = b2*x*x-b3*x/x1+b1*gamma2/(x1*x1);
                                                   >> 424          } while (G4UniformRand()>grej);
                                                   >> 425     }
                                                   >> 426   else             // Bhabha (e+e-) scattering
                                                   >> 427     {
                                                   >> 428       y=1./(gamma+1.); y2=y*y; cc=1.-2.*y;
                                                   >> 429       b1=2.-y2; b2=cc*(3.+y2);
                                                   >> 430       c2=cc*cc; b4=c2*cc; b3=c2+b4;
                                                   >> 431       b0=gamma2/(gamma2-1.);
                                                   >> 432       grejc=(((b4*xc-b3)*xc+b2)*xc-b1)*xc+b0;
                                                   >> 433       do {
                                                   >> 434            x    = xc/(1.-xc1*G4UniformRand());
                                                   >> 435            grej = ((((b4*x-b3)*x+b2)*x-b1)*x+b0)/grejc;
                                                   >> 436          } while (G4UniformRand()>grej);
 98     }                                             437     }
 99     AddEmModel(1, EmModel(), FluctModel());    << 438 
100     isInitialised = true;                      << 439     G4double DeltaKineticEnergy = x * KineticEnergy;
                                                   >> 440 
                                                   >> 441   // protection :do not produce a secondary with 0. kinetic energy !
                                                   >> 442   if (DeltaKineticEnergy <= 0.)
                                                   >> 443      return G4VContinuousDiscreteProcess::PostStepDoIt(trackData,stepData);
                                                   >> 444 
                                                   >> 445   G4double DeltaTotalMomentum = sqrt(DeltaKineticEnergy*(DeltaKineticEnergy +
                                                   >> 446                                                       2.*electron_mass_c2 ));
                                                   >> 447 
                                                   >> 448   G4double costheta = DeltaKineticEnergy * (TotalEnergy + electron_mass_c2)
                                                   >> 449                       /(DeltaTotalMomentum * TotalMomentum);
                                                   >> 450 
                                                   >> 451   if (costheta < -1.) costheta = -1.;
                                                   >> 452   if (costheta > +1.) costheta = +1.;
                                                   >> 453 
                                                   >> 454   //  direction of the delta electron
                                                   >> 455 
                                                   >> 456   G4double phi = twopi * G4UniformRand();
                                                   >> 457   G4double sintheta = sqrt((1.+costheta)*(1.-costheta));
                                                   >> 458   G4double dirx = sintheta*cos(phi), diry = sintheta*sin(phi), dirz = costheta;
                                                   >> 459 
                                                   >> 460   G4ThreeVector DeltaDirection(dirx,diry,dirz);
                                                   >> 461   DeltaDirection.rotateUz(ParticleDirection);
                                                   >> 462 
                                                   >> 463   // create G4DynamicParticle object for delta ray
                                                   >> 464 
                                                   >> 465   G4DynamicParticle* theDeltaRay = new G4DynamicParticle;
                                                   >> 466   theDeltaRay->SetKineticEnergy( DeltaKineticEnergy );
                                                   >> 467   theDeltaRay->SetMomentumDirection(
                                                   >> 468                    DeltaDirection.x(),DeltaDirection.y(),DeltaDirection.z());
                                                   >> 469   theDeltaRay->SetDefinition(G4Electron::Electron());
                                                   >> 470 
                                                   >> 471   // fill aParticleChange
                                                   >> 472   // changed energy and momentum of the actual particle
                                                   >> 473   G4double finalKineticEnergy = KineticEnergy - DeltaKineticEnergy;
                                                   >> 474 
                                                   >> 475   G4double Edep = 0.;
                                                   >> 476 
                                                   >> 477   if (finalKineticEnergy > MinKineticEnergy)
                                                   >> 478     {
                                                   >> 479       G4double finalPx = TotalMomentum*ParticleDirection.x()
                                                   >> 480                         - DeltaTotalMomentum*DeltaDirection.x();
                                                   >> 481       G4double finalPy = TotalMomentum*ParticleDirection.y()
                                                   >> 482                         - DeltaTotalMomentum*DeltaDirection.y();
                                                   >> 483       G4double finalPz = TotalMomentum*ParticleDirection.z()
                                                   >> 484                         - DeltaTotalMomentum*DeltaDirection.z();
                                                   >> 485       G4double finalMomentum =
                                                   >> 486                 sqrt(finalPx*finalPx+finalPy*finalPy+finalPz*finalPz);
                                                   >> 487       finalPx /= finalMomentum;
                                                   >> 488       finalPy /= finalMomentum;
                                                   >> 489       finalPz /= finalMomentum;
                                                   >> 490 
                                                   >> 491       aParticleChange.SetMomentumChange(finalPx, finalPy, finalPz);
                                                   >> 492     }
                                                   >> 493   else
                                                   >> 494     {
                                                   >> 495       Edep = finalKineticEnergy;
                                                   >> 496       finalKineticEnergy = 0.;
                                                   >> 497       if (Charge < 0.) aParticleChange.SetStatusChange(fStopAndKill);
                                                   >> 498       else             aParticleChange.SetStatusChange(fStopButAlive);
                                                   >> 499     }
                                                   >> 500 
                                                   >> 501   aParticleChange.SetEnergyChange(finalKineticEnergy);
                                                   >> 502   aParticleChange.SetNumberOfSecondaries(1);
                                                   >> 503   aParticleChange.AddSecondary(theDeltaRay);
                                                   >> 504   aParticleChange.SetLocalEnergyDeposit(Edep);
                                                   >> 505 
                                                   >> 506   return G4VContinuousDiscreteProcess::PostStepDoIt(trackData,stepData);
                                                   >> 507 }
                                                   >> 508 
                                                   >> 509 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >> 510 
                                                   >> 511 G4bool G4eIonisation::StorePhysicsTable(G4ParticleDefinition* particle,
                                                   >> 512                       const G4String& directory,
                                                   >> 513                       G4bool          ascii)
                                                   >> 514 {
                                                   >> 515   G4String filename;
                                                   >> 516 
                                                   >> 517   // store stopping power table
                                                   >> 518   filename = GetPhysicsTableFileName(particle,directory,"StoppingPower",ascii);
                                                   >> 519   if ( !theLossTable->StorePhysicsTable(filename, ascii) ){
                                                   >> 520     G4cout << " FAIL theLossTable->StorePhysicsTable in " << filename
                                                   >> 521            << G4endl;
                                                   >> 522     return false;
                                                   >> 523   }
                                                   >> 524   // store mean free path table
                                                   >> 525   filename = GetPhysicsTableFileName(particle,directory,"MeanFreePath",ascii);
                                                   >> 526   if ( !theMeanFreePathTable->StorePhysicsTable(filename, ascii) ){
                                                   >> 527     G4cout << " FAIL theMeanFreePathTable->StorePhysicsTable in " << filename
                                                   >> 528            << G4endl;
                                                   >> 529     return false;
                                                   >> 530   }
                                                   >> 531 
                                                   >> 532   G4cout << GetProcessName() << " for " << particle->GetParticleName()
                                                   >> 533          << ": Success to store the PhysicsTables in "
                                                   >> 534          << directory << G4endl;
                                                   >> 535   return true;
                                                   >> 536 }
                                                   >> 537 
                                                   >> 538 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >> 539 
                                                   >> 540 G4bool G4eIonisation::RetrievePhysicsTable(G4ParticleDefinition* particle,
                                                   >> 541                    const G4String& directory,
                                                   >> 542                          G4bool          ascii)
                                                   >> 543 {
                                                   >> 544   // delete theLossTable and theMeanFreePathTable
                                                   >> 545   if (theLossTable != 0) {
                                                   >> 546     theLossTable->clearAndDestroy();
                                                   >> 547     delete theLossTable;
                                                   >> 548   }
                                                   >> 549   if (theMeanFreePathTable != 0) {
                                                   >> 550     theMeanFreePathTable->clearAndDestroy();
                                                   >> 551     delete theMeanFreePathTable;
101   }                                               552   }
                                                   >> 553 
                                                   >> 554   // get bining from EnergyLoss
                                                   >> 555   LowestKineticEnergy  = GetLowerBoundEloss();
                                                   >> 556   HighestKineticEnergy = GetUpperBoundEloss();
                                                   >> 557   TotBin               = GetNbinEloss();
                                                   >> 558 
                                                   >> 559   G4String filename;
                                                   >> 560   const G4ProductionCutsTable* theCoupleTable=
                                                   >> 561         G4ProductionCutsTable::GetProductionCutsTable();
                                                   >> 562   size_t numOfCouples = theCoupleTable->GetTableSize();
                                                   >> 563 
                                                   >> 564   secondaryEnergyCuts = theCoupleTable->GetEnergyCutsVector(1);
                                                   >> 565 
                                                   >> 566   // retreive stopping power table
                                                   >> 567   filename = GetPhysicsTableFileName(particle,directory,"StoppingPower",ascii);
                                                   >> 568   theLossTable = new G4PhysicsTable(numOfCouples);
                                                   >> 569   if ( !theLossTable->RetrievePhysicsTable(filename, ascii) ){
                                                   >> 570     G4cout << " FAIL theLossTable->RetrievePhysicsTable in " << filename
                                                   >> 571            << G4endl;
                                                   >> 572     return false;
                                                   >> 573   }
                                                   >> 574 
                                                   >> 575   // retreive mean free path table
                                                   >> 576   filename = GetPhysicsTableFileName(particle,directory,"MeanFreePath",ascii);
                                                   >> 577   theMeanFreePathTable = new G4PhysicsTable(numOfCouples);
                                                   >> 578   if ( !theMeanFreePathTable->RetrievePhysicsTable(filename, ascii) ){
                                                   >> 579     G4cout << " FAIL theMeanFreePathTable->RetrievePhysicsTable in " << filename
                                                   >> 580            << G4endl;
                                                   >> 581     return false;
                                                   >> 582   }
                                                   >> 583 
                                                   >> 584   G4cout << GetProcessName() << " for " << particle->GetParticleName()
                                                   >> 585          << ": Success to retrieve the PhysicsTables from "
                                                   >> 586          << directory << G4endl;
                                                   >> 587 
                                                   >> 588   if (particle==G4Electron::Electron())
                                                   >> 589     {
                                                   >> 590      RecorderOfElectronProcess[CounterOfElectronProcess] = (*this).theLossTable;
                                                   >> 591      CounterOfElectronProcess++;
                                                   >> 592     }
                                                   >> 593   else
                                                   >> 594     {
                                                   >> 595      RecorderOfPositronProcess[CounterOfPositronProcess] = (*this).theLossTable;
                                                   >> 596      CounterOfPositronProcess++;
                                                   >> 597     }
                                                   >> 598 
                                                   >> 599   BuildDEDXTable(*particle);
                                                   >> 600   if (particle==G4Electron::Electron()) PrintInfoDefinition();
                                                   >> 601 
                                                   >> 602   return true;
102 }                                                 603 }
103                                                   604 
104 //....oooOO0OOooo........oooOO0OOooo........oo << 605 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
105                                                   606 
106 void G4eIonisation::ProcessDescription(std::os << 607 void G4eIonisation::PrintInfoDefinition()
107 {                                                 608 {
108   out << "  Ionisation";                       << 609   G4String comments = "delta cross sections from Moller+Bhabha. "
109   G4VEnergyLossProcess::ProcessDescription(out << 610             "Good description from 1 KeV to 100 GeV.\n"
                                                   >> 611             "        delta ray energy sampled from  differential Xsection.";
                                                   >> 612                      
                                                   >> 613   G4cout << G4endl << GetProcessName() << ":  " << comments
                                                   >> 614          << "\n        PhysicsTables from "
                                                   >> 615    << G4BestUnit(LowerBoundLambda,"Energy")
                                                   >> 616          << " to " << G4BestUnit(UpperBoundLambda,"Energy") 
                                                   >> 617          << " in " << NbinLambda << " bins."
                                                   >> 618    << "\n        Step function: finalRange(mm)= " << finalRange
                                                   >> 619    << ",  dRoverRange= " << dRoverRange 
                                                   >> 620    << G4endl;
110 }                                                 621 }
111                                                   622 
112 //....oooOO0OOooo........oooOO0OOooo........oo    623 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
113                                                   624