Geant4 Cross Reference |
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 // G4RToEConvForGamma class implementation << 27 // 23 // 28 // Author: H.Kurashige, 05 October 2002 - Firs << 24 // $Id: G4RToEConvForGamma.cc,v 1.1 2003/09/19 14:47:01 gcosmo Exp $ 29 // ------------------------------------------- << 25 // GEANT4 tag $Name: geant4-06-00-patch-01 $ >> 26 // >> 27 // >> 28 // -------------------------------------------------------------- >> 29 // GEANT 4 class implementation file/ History: >> 30 // 5 Oct. 2002, H.Kuirashige : Structure created based on object model >> 31 // -------------------------------------------------------------- 30 32 31 #include "G4RToEConvForGamma.hh" 33 #include "G4RToEConvForGamma.hh" 32 #include "G4ParticleDefinition.hh" 34 #include "G4ParticleDefinition.hh" 33 #include "G4ParticleTable.hh" 35 #include "G4ParticleTable.hh" 34 #include "G4SystemOfUnits.hh" << 36 #include "G4Material.hh" 35 #include "G4Log.hh" << 37 #include "G4PhysicsLogVector.hh" 36 #include "G4Exp.hh" << 38 37 #include "G4Pow.hh" << 39 #include "G4ios.hh" 38 << 40 #include <iomanip> 39 // ------------------------------------------- << 41 #include <strstream> 40 G4RToEConvForGamma::G4RToEConvForGamma() << 42 41 : G4VRangeToEnergyConverter() << 43 G4RToEConvForGamma::G4RToEConvForGamma() : G4VRangeToEnergyConverter() 42 { 44 { 43 theParticle = G4ParticleTable::GetParticleTa << 45 theParticle = G4ParticleTable::GetParticleTable()->FindParticle("gamma"); 44 if (theParticle == nullptr) << 46 if (theParticle ==0) { 45 { << 46 #ifdef G4VERBOSE 47 #ifdef G4VERBOSE 47 if (GetVerboseLevel()>0) << 48 if (GetVerboseLevel()>0) { 48 { << 49 G4cout << " G4RToEConvForGamma::G4RToEConvForGamma() "; 49 G4cout << " G4RToEConvForGamma::G4RToECo << 50 G4cout << " Gamma is not defined !!" << G4endl; 50 G4cout << "Gamma is not defined !!" << G << 51 } 51 } 52 #endif 52 #endif 53 } 53 } 54 else << 54 TotBin = 100; 55 { << 56 fPDG = theParticle->GetPDGEncoding(); << 57 } << 58 } 55 } 59 56 60 // ------------------------------------------- << 57 G4RToEConvForGamma::~G4RToEConvForGamma() 61 G4RToEConvForGamma::~G4RToEConvForGamma() << 58 { 62 {} << 59 } 63 << 60 64 // ------------------------------------------- << 61 65 G4double G4RToEConvForGamma::ComputeValue(cons << 62 // *********************************************************************** 66 cons << 63 // ******************* BuildAbsorptionLengthVector *********************** >> 64 // *********************************************************************** >> 65 void G4RToEConvForGamma::BuildAbsorptionLengthVector( >> 66 const G4Material* aMaterial, >> 67 G4double , >> 68 G4double , >> 69 G4RangeVector* absorptionLengthVector ) 67 { 70 { 68 // Compute the "absorption" cross-section of << 71 // fill the absorption length vector for this material 69 // Cross-section means here the sum of the c << 72 // absorption length is defined here as 70 // pair production, Compton scattering and p << 73 // 71 << 74 // absorption length = 5./ macroscopic absorption cross section 72 const G4double t1keV = 1.*CLHEP::keV; << 75 // 73 const G4double t200keV = 200.*CLHEP::keV; << 76 const G4CrossSectionTable* aCrossSectionTable = (G4CrossSectionTable*)(theLossTable); 74 const G4double t100MeV = 100.*CLHEP::MeV; << 77 const G4ElementVector* elementVector = aMaterial->GetElementVector(); 75 << 78 const G4double* atomicNumDensityVector = aMaterial->GetAtomicNumDensityVector(); 76 G4double Zsquare = Z*Z; << 79 77 G4double Zlog = G4Pow::GetInstance()->logZ(Z << 80 // fill absorption length vector 78 G4double Zlogsquare = Zlog*Zlog; << 81 G4int NumEl = aMaterial->GetNumberOfElements(); 79 << 82 G4double absorptionLengthMax = 0.0; 80 G4double tmin = (0.552+218.5/Z+557.17/Zsquar << 83 for (size_t ibin=0; ibin<size_t(TotBin); ibin++) { 81 G4double tlow = 0.2*G4Exp(-7.355/std::sqrt(Z << 84 G4double lowEdgeEnergy = absorptionLengthVector->GetLowEdgeEnergy(ibin); 82 << 85 83 G4double smin = (0.01239+0.005585*Zlog-0.000 << 86 G4double SIGMA = 0. ; 84 G4double s200keV = (0.2651-0.1501*Zlog+0.022 << 87 85 << 88 for (size_t iel=0; iel<size_t(NumEl); iel++) { 86 G4double cminlog = G4Log(tmin/t200keV); << 89 G4bool isOut; 87 G4double cmin = G4Log(s200keV/smin)/(cminlog << 90 G4int IndEl = (*elementVector)[iel]->GetIndex(); 88 << 91 SIGMA += atomicNumDensityVector[iel]* 89 G4double slowlog = G4Log(t200keV/tlow); << 92 (*aCrossSectionTable)[IndEl]->GetValue(lowEdgeEnergy,isOut); 90 G4double slow = s200keV * G4Exp(0.042*Z*slow << 93 } 91 G4double logtlow = G4Log(tlow/t1keV); << 94 // absorption length=5./SIGMA 92 G4double clow = G4Log(300.*Zsquare/slow)/log << 95 absorptionLengthVector->PutValue(ibin, 5./SIGMA); 93 G4double chigh = (7.55e-5 - 0.0542e-5*Z)*Zsq << 96 if (absorptionLengthMax < 5./SIGMA ) absorptionLengthMax = 5./SIGMA; 94 << 95 // Calculate the cross-section (using an app << 96 G4double xs; << 97 if ( energy < tlow ) << 98 { << 99 xs = (energy < t1keV) ? slow*G4Exp(clow*lo << 100 slow*G4Exp(clow*G4Log(tlow/energy)); << 101 } << 102 else if ( energy < t200keV ) << 103 { << 104 G4double x = G4Log(t200keV/energy); << 105 xs = s200keV * G4Exp(0.042*Z*x*x); << 106 } 97 } 107 else if( energy<tmin ) << 98 } 108 { << 99 109 const G4double x = G4Log(tmin/energy); << 100 110 xs = smin * G4Exp(cmin*x*x); << 101 >> 102 // *********************************************************************** >> 103 // ********************** ComputeCrossSection **************************** >> 104 // *********************************************************************** >> 105 G4double G4RToEConvForGamma::ComputeCrossSection(G4double AtomicNumber, >> 106 G4double KineticEnergy) const >> 107 { >> 108 // Compute the "absorption" cross section of the photon "absorption" >> 109 // cross section means here the sum of the cross sections of the >> 110 // pair production, Compton scattering and photoelectric processes >> 111 static G4double Z; >> 112 const G4double t1keV = 1.*keV; >> 113 const G4double t200keV = 200.*keV; >> 114 const G4double t100MeV = 100.*MeV; >> 115 >> 116 static G4double s200keV, s1keV; >> 117 static G4double tmin, tlow; >> 118 static G4double smin, slow; >> 119 static G4double cmin, clow, chigh; >> 120 // compute Z dependent quantities in the case of a new AtomicNumber >> 121 if(abs(AtomicNumber-Z)>0.1) { >> 122 Z = AtomicNumber; >> 123 G4double Zsquare = Z*Z; >> 124 G4double Zlog = log(Z); >> 125 G4double Zlogsquare = Zlog*Zlog; >> 126 >> 127 s200keV = (0.2651-0.1501*Zlog+0.02283*Zlogsquare)*Zsquare; >> 128 tmin = (0.552+218.5/Z+557.17/Zsquare)*MeV; >> 129 smin = (0.01239+0.005585*Zlog-0.000923*Zlogsquare)*exp(1.5*Zlog); >> 130 cmin=log(s200keV/smin)/(log(tmin/t200keV)*log(tmin/t200keV)); >> 131 tlow = 0.2*exp(-7.355/sqrt(Z))*MeV; >> 132 slow = s200keV*exp(0.042*Z*log(t200keV/tlow)*log(t200keV/tlow)); >> 133 s1keV = 300.*Zsquare; >> 134 clow =log(s1keV/slow)/log(tlow/t1keV); >> 135 >> 136 chigh=(7.55e-5-0.0542e-5*Z)*Zsquare*Z/log(t100MeV/tmin); 111 } 137 } 112 else << 138 113 { << 139 // calculate the cross section (using an approximate empirical formula) 114 xs = smin + chigh*G4Log(energy/tmin); << 140 G4double s; >> 141 if ( KineticEnergy<tlow ) { >> 142 if(KineticEnergy<t1keV) s = slow*exp(clow*log(tlow/t1keV)); >> 143 else s = slow*exp(clow*log(tlow/KineticEnergy)); >> 144 >> 145 } else if ( KineticEnergy<t200keV ) { >> 146 s = s200keV >> 147 * exp(0.042*Z*log(t200keV/KineticEnergy)*log(t200keV/KineticEnergy)); >> 148 >> 149 } else if( KineticEnergy<tmin ){ >> 150 s = smin >> 151 * exp(cmin*log(tmin/KineticEnergy)*log(tmin/KineticEnergy)); >> 152 >> 153 } else { >> 154 s = smin + chigh*log(KineticEnergy/tmin); >> 155 115 } 156 } 116 return xs * CLHEP::barn; << 157 return s * barn; 117 } 158 } 118 159 119 // ------------------------------------------- << 120 160