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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 /particles/leptons/src/G4Electron.cc (Version 11.3.0) and /particles/leptons/src/G4Electron.cc (Version 1.0)


                                                   >>   1 // This code implementation is the intellectual property of
                                                   >>   2 // the GEANT4 collaboration.
  1 //                                                  3 //
  2 // ******************************************* <<   4 // By copying, distributing or modifying the Program (or any work
  3 // * License and Disclaimer                    <<   5 // based on the Program) you indicate your acceptance of this statement,
  4 // *                                           <<   6 // and all its terms.
  5 // * The  Geant4 software  is  copyright of th << 
  6 // * the Geant4 Collaboration.  It is provided << 
  7 // * conditions of the Geant4 Software License << 
  8 // * LICENSE and available at  http://cern.ch/ << 
  9 // * include a list of copyright holders.      << 
 10 // *                                           << 
 11 // * Neither the authors of this software syst << 
 12 // * institutes,nor the agencies providing fin << 
 13 // * work  make  any representation or  warran << 
 14 // * regarding  this  software system or assum << 
 15 // * use.  Please see the license in the file  << 
 16 // * for the full disclaimer and the limitatio << 
 17 // *                                           << 
 18 // * This  code  implementation is the result  << 
 19 // * technical work of the GEANT4 collaboratio << 
 20 // * By using,  copying,  modifying or  distri << 
 21 // * any work based  on the software)  you  ag << 
 22 // * use  in  resulting  scientific  publicati << 
 23 // * acceptance of all terms of the Geant4 Sof << 
 24 // ******************************************* << 
 25 //                                                  7 //
                                                   >>   8 // $Id: G4Electron.cc,v 1.1.10.1 1999/12/07 20:49:47 gunter Exp $
                                                   >>   9 // GEANT4 tag $Name: geant4-01-00 $
                                                   >>  10 //
                                                   >>  11 // 
 26 // -------------------------------------------     12 // ----------------------------------------------------------------------
 27 //      GEANT 4 class implementation file          13 //      GEANT 4 class implementation file
 28 //                                                 14 //
                                                   >>  15 //      For information related to this code contact:
                                                   >>  16 //      CERN, CN Division, ASD Group
 29 //      History: first implementation, based o     17 //      History: first implementation, based on object model of
 30 //      4th April 1996, G.Cosmo                    18 //      4th April 1996, G.Cosmo
 31 // *******************************************     19 // **********************************************************************
 32 //  New impelemenataion as an utility class  M <<  20 //  Added particle definitions, H.Kurashige, 19 April 1996
                                                   >>  21 //  Added SetCuts implementation, L.Urban, 30 May 1996
                                                   >>  22 //  Revised, G.Cosmo, 6 June 1996
                                                   >>  23 //  Code uses operators (+=, *=, ++, -> etc.) correctly, P. Urban, 26/6/96
                                                   >>  24 //  Add ElectronDefinition() H.Kurashige 4 July 1996
 33 // -------------------------------------------     25 // ----------------------------------------------------------------------
 34                                                    26 
                                                   >>  27 #include <fstream.h>
                                                   >>  28 #include <iomanip.h>
                                                   >>  29     
 35 #include "G4Electron.hh"                           30 #include "G4Electron.hh"
                                                   >>  31 // ######################################################################
                                                   >>  32 // ###                         ELECTRON                               ###
                                                   >>  33 // ######################################################################
                                                   >>  34 
                                                   >>  35 G4Electron::G4Electron(
                                                   >>  36        const G4String&     aName,        G4double            mass,
                                                   >>  37        G4double            width,        G4double            charge,   
                                                   >>  38        G4int               iSpin,        G4int               iParity,    
                                                   >>  39        G4int               iConjugation, G4int               iIsospin,   
                                                   >>  40        G4int               iIsospin3,    G4int               gParity,
                                                   >>  41        const G4String&     pType,        G4int               lepton,      
                                                   >>  42        G4int               baryon,       G4int               encoding,
                                                   >>  43        G4bool              stable,       G4double            lifetime,
                                                   >>  44        G4DecayTable        *decaytable )
                                                   >>  45  : G4VLepton( aName,mass,width,charge,iSpin,iParity,
                                                   >>  46         iConjugation,iIsospin,iIsospin3,gParity,pType,
                                                   >>  47               lepton,baryon,encoding,stable,lifetime,decaytable )
                                                   >>  48 {
                                                   >>  49 }
 36                                                    50 
 37 #include "G4ParticleTable.hh"                  <<  51 // ......................................................................
 38 #include "G4PhysicalConstants.hh"              <<  52 // ...                 static member definitions                      ...
 39 #include "G4String.hh"                         <<  53 // ......................................................................
 40 #include "G4SystemOfUnits.hh"                  <<  54 //     
 41 #include "G4Types.hh"                          <<  55 //    Arguments for constructor are as follows
 42                                                <<  56 //               name             mass          width         charge
 43 G4Electron* G4Electron::theInstance = nullptr; <<  57 //             2*spin           parity  C-conjugation
                                                   >>  58 //          2*Isospin       2*Isospin3       G-parity
                                                   >>  59 //               type    lepton number  baryon number   PDG encoding
                                                   >>  60 //             stable         lifetime    decay table 
                                                   >>  61 
                                                   >>  62 G4Electron G4Electron::theElectron(
                                                   >>  63      "e-",  0.51099906*MeV,       0.0*MeV,    -1.*eplus, 
                                                   >>  64         1,               0,             0,          
                                                   >>  65         0,               0,             0,             
                                                   >>  66        "lepton",               1,             0,          11,
                                                   >>  67      true,            -1.0,          NULL
                                                   >>  68 );
                                                   >>  69 
                                                   >>  70 G4Electron* G4Electron::ElectronDefinition(){return &theElectron;}
                                                   >>  71 // initialization for static cut values
                                                   >>  72 G4double   G4Electron::theElectronLengthCut = -1.0;
                                                   >>  73 G4double*  G4Electron::theElectronKineticEnergyCuts = NULL;
 44                                                    74 
 45 G4Electron* G4Electron::Definition()           <<  75 // **********************************************************************
                                                   >>  76 // ************************* ComputeLoss ********************************
                                                   >>  77 // **********************************************************************
                                                   >>  78 G4double G4Electron::ComputeLoss(G4double AtomicNumber,
                                                   >>  79                                  G4double KineticEnergy) const
 46 {                                                  80 {
 47   if (theInstance != nullptr) return theInstan <<  81   static G4double Z;  
 48   const G4String name = "e-";                  <<  82   static G4double taul, ionpot, ionpotlog;
 49   // search in particle table]                 <<  83   const  G4double cbr1=0.02, cbr2=-5.7e-5, cbr3=1., cbr4=0.072;
 50   G4ParticleTable* pTable = G4ParticleTable::G <<  84   const  G4double Tlow=10.*keV, Thigh=1.*GeV;
 51   G4ParticleDefinition* anInstance = pTable->F <<  85 
 52   if (anInstance == nullptr) {                 <<  86   static G4double bremfactor= 0.1 ;
 53     // create particle                         <<  87 
 54     //                                         <<  88   //  calculate dE/dx for electrons
 55     //    Arguments for constructor are as fol <<  89   if( abs(AtomicNumber-Z)>0.1 )
 56     //               name             mass     <<  90   {
 57     //             2*spin           parity  C- <<  91     Z = AtomicNumber;
 58     //          2*Isospin       2*Isospin3     <<  92     taul = Tlow/GetPDGMass();
 59     //               type    lepton number  ba <<  93     ionpot = 1.6e-5*MeV*exp(0.9*log(Z))/GetPDGMass();
 60     //             stable         lifetime     <<  94     ionpotlog = log(ionpot);
 61     //             shortlived      subType     <<  95   } 
 62                                                <<  96 
 63     // use constants in CLHEP                  <<  97 
 64     //  static const double electron_mass_c2 = <<  98   G4double tau = KineticEnergy/GetPDGMass();
 65                                                <<  99   G4double dEdx;
 66     // clang-format off                        << 100 
 67     anInstance = new G4ParticleDefinition(     << 101   if(tau<taul) {
 68                  name,  electron_mass_c2,      << 102     G4double t1 = taul+1.;
 69         1,                 0,             0,   << 103     G4double t2 = taul+2.;
 70         0,                 0,             0,   << 104     G4double tsq = taul*taul;
 71        "lepton",                 1,            << 105     G4double beta2 = taul*t2/(t1*t1);
 72      true,              -1.0,          nullptr << 106     G4double f = 1.-beta2+log(tsq/2.)
 73              false,                  "e"       << 107                   +(0.5+0.25*tsq+(1.+2.*taul)*log(0.5))/(t1*t1);
 74               );                               << 108     dEdx = (log(2.*taul+4.)-2.*ionpotlog+f)/beta2;
 75     // clang-format on                         << 109     dEdx = twopi_mc2_rcl2*Z*dEdx;
                                                   >> 110     G4double clow = dEdx*sqrt(taul);
                                                   >> 111     dEdx = clow/sqrt(KineticEnergy/GetPDGMass());
                                                   >> 112   } else {
                                                   >> 113     G4double t1 = tau+1.;
                                                   >> 114     G4double t2 = tau+2.;
                                                   >> 115     G4double tsq = tau*tau;
                                                   >> 116     G4double beta2 = tau*t2/(t1*t1);
                                                   >> 117     G4double f = 1.-beta2+log(tsq/2.)
                                                   >> 118                    +(0.5+0.25*tsq+(1.+2.*tau)*log(0.5))/(t1*t1);
                                                   >> 119     dEdx = (log(2.*tau+4.)-2.*ionpotlog+f)/beta2;
                                                   >> 120     dEdx = twopi_mc2_rcl2*Z*dEdx;
                                                   >> 121 
                                                   >> 122     // loss from bremsstrahlung follows
                                                   >> 123     G4double cbrem = (cbr1+cbr2*Z)
                                                   >> 124                        *(cbr3+cbr4*log(KineticEnergy/Thigh));
                                                   >> 125     cbrem = Z*(Z+1.)*cbrem*tau/beta2;
 76                                                   126 
 77     // Bohr Magnetron                          << 127     cbrem *= bremfactor ;
 78     G4double muB = -0.5 * eplus * hbar_Planck  << 
 79                                                   128 
 80     anInstance->SetPDGMagneticMoment(muB * 1.0 << 129     dEdx += twopi_mc2_rcl2*cbrem;
 81   }                                               130   }
 82   theInstance = static_cast<G4Electron*>(anIns << 
 83   return theInstance;                          << 
 84 }                                              << 
 85                                                   131 
 86 G4Electron* G4Electron::ElectronDefinition()   << 132   return dEdx;
 87 {                                              << 
 88   return Definition();                         << 
 89 }                                                 133 }
 90                                                   134 
 91 G4Electron* G4Electron::Electron()             << 135 // **********************************************************************
                                                   >> 136 // *********************** BuildRangeVector *****************************
                                                   >> 137 // **********************************************************************
                                                   >> 138 
                                                   >> 139 void G4Electron::BuildRangeVector(const G4Material* aMaterial,
                                                   >> 140           const G4LossTable* aLossTable,
                                                   >> 141           G4double       maxEnergy,
                                                   >> 142           G4double       aMass,
                                                   >> 143                                   G4PhysicsLogVector* rangeVector)
 92 {                                                 144 {
 93   return Definition();                         << 145   //  create range vector for a material
 94 }                                              << 146   const G4double tlim = 10.*keV;
                                                   >> 147   const G4int maxnbint = 100;
                                                   >> 148 
                                                   >> 149   const G4ElementVector* elementVector = aMaterial->GetElementVector();
                                                   >> 150   const G4double* atomicNumDensityVector = aMaterial->GetAtomicNumDensityVector();
                                                   >> 151   G4int NumEl = aMaterial->GetNumberOfElements();
                                                   >> 152 
                                                   >> 153   // calculate parameters of the low energy part first
                                                   >> 154   G4int i;
                                                   >> 155   G4double loss=0.;
                                                   >> 156   for (i=0; i<NumEl; i++)
                                                   >> 157   {
                                                   >> 158     G4bool isOut;
                                                   >> 159     G4int IndEl = (*elementVector)(i)->GetIndex();
                                                   >> 160     loss += atomicNumDensityVector[i]*
                                                   >> 161            (*aLossTable)[IndEl]->GetValue(tlim,isOut);
                                                   >> 162   }
                                                   >> 163   G4double taulim = tlim/aMass;
                                                   >> 164   G4double clim = sqrt(taulim)*loss;
                                                   >> 165   G4double taumax = maxEnergy/aMass;
                                                   >> 166 
                                                   >> 167   // now the range vector can be filled
                                                   >> 168 
                                                   >> 169   for ( i=0; i<TotBin; i++)
                                                   >> 170   {
                                                   >> 171     G4double LowEdgeEnergy = rangeVector->GetLowEdgeEnergy(i);
                                                   >> 172     G4double tau = LowEdgeEnergy/aMass;
                                                   >> 173 
                                                   >> 174     if ( tau <= taulim ) {
                                                   >> 175       G4double Value = 2.*aMass*tau*sqrt(tau)/(3.*clim);
                                                   >> 176       rangeVector->PutValue(i,Value);
                                                   >> 177     } else {
                                                   >> 178       G4double rangelim = 2.*aMass*taulim*sqrt(taulim)/(3.*clim);
                                                   >> 179       G4double ltaulow = log(taulim);
                                                   >> 180       G4double ltauhigh = log(tau);
                                                   >> 181       G4double ltaumax = log(taumax);
                                                   >> 182       G4int    nbin = G4int(maxnbint*(ltauhigh-ltaulow)/(ltaumax-ltaulow));
                                                   >> 183       if( nbin < 1 ) nbin = 1;
                                                   >> 184       G4double Value = RangeLogSimpson(elementVector, atomicNumDensityVector,
                                                   >> 185                                        aLossTable,    aMass,
                                                   >> 186                ltaulow,       ltauhigh,
                                                   >> 187                                        nbin,          NumEl)    + rangelim;
                                                   >> 188       rangeVector->PutValue(i,Value);
                                                   >> 189     }
                                                   >> 190   }
                                                   >> 191 } 
                                                   >> 192 
                                                   >> 193 
                                                   >> 194 
                                                   >> 195 
                                                   >> 196 
                                                   >> 197 
 95                                                   198