Import Geant4 10.4.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2017-06-30 10:49:55 +02:00
parent 3a5407696b
commit 1a1316fea4
2180 changed files with 237880 additions and 59109 deletions
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4PairProductionRelModel.cc 96934 2016-05-18 09:10:41Z gcosmo $
// $Id: G4PairProductionRelModel.cc 104555 2017-06-06 07:31:32Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -38,13 +38,18 @@
//
// Modifications:
//
// 20.03.17 change LPMconstant such that it gives suppression variable 's'
// that consistent to Migdal's one; fix a small bug in 'logTS1'
// computation; suppression is consistent now with the one in the
// brem. model (F.Hariri)
//
// Class Description:
//
// Main References:
// J.W.Motz et.al., Rev. Mod. Phys. 41 (1969) 581.
// S.Klein, Rev. Mod. Phys. 71 (1999) 1501.
// T.Stanev et.al., Phys. Rev. D25 (1982) 1291.
// M.L.Ter-Mikaelian, High-energy Electromagnetic Processes in Condensed Media,
// M.L.Ter-Mikaelian, High-energy Electromagnetic Processes in Condensed Media,
// Wiley, 1972.
//
// -------------------------------------------------------------------
@@ -58,12 +63,8 @@
#include "G4Gamma.hh"
#include "G4Electron.hh"
#include "G4Positron.hh"
#include "G4Log.hh"
#include "G4ParticleChangeForGamma.hh"
#include "G4LossTableManager.hh"
#include "G4Exp.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -82,15 +83,16 @@ const G4double G4PairProductionRelModel::wgi[]={ 0.0506, 0.1112, 0.1569, 0.1813,
const G4double G4PairProductionRelModel::Fel_light[] = {0., 5.31 , 4.79 , 4.74 , 4.71};
const G4double G4PairProductionRelModel::Finel_light[] = {0., 6.144 , 5.621 , 5.805 , 5.924};
const G4double G4PairProductionRelModel::xsfactor =
4*fine_structure_const*classic_electr_radius*classic_electr_radius;
const G4double G4PairProductionRelModel::Egsmall=2.*MeV;
const G4double G4PairProductionRelModel::xsfactor =
4*CLHEP::fine_structure_const*CLHEP::classic_electr_radius*CLHEP::classic_electr_radius;
const G4double G4PairProductionRelModel::Egsmall = 2.*CLHEP::MeV;
const G4double G4PairProductionRelModel::Eghigh = 100.*CLHEP::GeV;
G4PairProductionRelModel::G4PairProductionRelModel(const G4ParticleDefinition*,
const G4String& nam)
: G4VEmModel(nam),
fLPMconstant(fine_structure_const*electron_mass_c2*electron_mass_c2/(4.*pi*hbarc)*0.5),
fLPMconstant(CLHEP::fine_structure_const*CLHEP::electron_mass_c2*CLHEP::electron_mass_c2/
(4.*CLHEP::pi*CLHEP::hbarc)),
fLPMflag(true),
lpmEnergy(0.),
use_completescreening(false)
@@ -100,10 +102,9 @@ G4PairProductionRelModel::G4PairProductionRelModel(const G4ParticleDefinition*,
thePositron = G4Positron::Positron();
theElectron = G4Electron::Electron();
nist = G4NistManager::Instance();
nist = G4NistManager::Instance();
currentZ = z13 = z23 = lnZ = Fel = Finel = fCoulomb = phiLPM = gLPM = xiLPM = 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -117,8 +118,8 @@ void G4PairProductionRelModel::Initialise(const G4ParticleDefinition* p,
const G4DataVector& cuts)
{
if(!fParticleChange) { fParticleChange = GetParticleChangeForGamma(); }
if(IsMaster() && LowEnergyLimit() < HighEnergyLimit()) {
InitialiseElementSelectors(p, cuts);
if(IsMaster() && LowEnergyLimit() < HighEnergyLimit()) {
InitialiseElementSelectors(p, cuts);
}
}
@@ -138,48 +139,44 @@ G4double G4PairProductionRelModel::ComputeXSectionPerAtom(G4double totalEnergy,
{
G4double cross = 0.0;
// number of intervals and integration step
// number of intervals and integration step
G4double vcut = electron_mass_c2/totalEnergy ;
// limits by the screening variable
G4double dmax = DeltaMax();
G4double dmin = min(DeltaMin(totalEnergy),dmax);
G4double vcut1 = 0.5 - 0.5*sqrt(1. - dmin/dmax) ;
G4double dmin = std::min(DeltaMin(totalEnergy),dmax);
G4double vcut1 = 0.5 - 0.5*sqrt(1. - dmin/dmax);
vcut = max(vcut, vcut1);
G4double vmax = 0.5;
G4int n = 1; // needs optimisation
G4double delta = (vmax - vcut)*totalEnergy/G4double(n);
G4double e0 = vcut*totalEnergy;
G4double xs;
// simple integration
for(G4int l=0; l<n; l++,e0 += delta) {
for(G4int i=0; i<8; i++) {
for(G4int l=0; l<n; ++l) {
e0 += delta;
for(G4int i=0; i<8; ++i) {
G4double eg = (e0 + xgi[i]*delta);
if (fLPMflag && totalEnergy>100.*GeV)
xs = ComputeRelDXSectionPerAtom(eg,totalEnergy,Z);
else
xs = ComputeDXSectionPerAtom(eg,totalEnergy,Z);
G4double xs = (fLPMflag && totalEnergy > Eghigh)
? ComputeRelDXSectionPerAtom(eg,totalEnergy,Z)
: ComputeDXSectionPerAtom(eg,totalEnergy,Z);
cross += wgi[i]*xs;
}
}
cross *= delta*2.;
return cross;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double
G4PairProductionRelModel::ComputeDXSectionPerAtom(G4double eplusEnergy,
G4double totalEnergy,
G4double
G4PairProductionRelModel::ComputeDXSectionPerAtom(G4double eplusEnergy,
G4double totalEnergy,
G4double /*Z*/)
{
// most simple case - complete screening:
@@ -191,7 +188,7 @@ G4PairProductionRelModel::ComputeDXSectionPerAtom(G4double eplusEnergy,
G4double ym=1.-yp;
G4double cross = 0.;
if (use_completescreening)
if (use_completescreening)
cross = (yp*yp + ym*ym + 2./3.*ym*yp)*(Fel - fCoulomb) + yp*ym/9.;
else {
G4double delta = 0.25*DeltaMin(totalEnergy)/(yp*ym);
@@ -199,13 +196,13 @@ G4PairProductionRelModel::ComputeDXSectionPerAtom(G4double eplusEnergy,
+ 2./3.*ym*yp*(0.25*Phi2(delta) - lnZ/3. - fCoulomb);
}
return cross/totalEnergy;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double
G4PairProductionRelModel::ComputeRelDXSectionPerAtom(G4double eplusEnergy,
G4double totalEnergy,
G4double
G4PairProductionRelModel::ComputeRelDXSectionPerAtom(G4double eplusEnergy,
G4double totalEnergy,
G4double /*Z*/)
{
// most simple case - complete screening:
@@ -219,12 +216,12 @@ G4PairProductionRelModel::ComputeRelDXSectionPerAtom(G4double eplusEnergy,
CalcLPMFunctions(totalEnergy,eplusEnergy); // gamma
G4double cross = 0.;
if (use_completescreening)
if (use_completescreening)
cross = xiLPM*(2./3.*phiLPM*(yp*yp + ym*ym) + gLPM)*(Fel - fCoulomb);
else {
G4double delta = 0.25*DeltaMin(totalEnergy)/(yp*ym);
cross = (1./3.*gLPM + 2./3.*phiLPM)*(yp*yp + ym*ym)
*(0.25*Phi1(delta) - lnZ/3. - fCoulomb)
*(0.25*Phi1(delta) - lnZ/3. - fCoulomb)
+ 2./3.*gLPM*ym*yp*(0.25*Phi2(delta) - lnZ/3. - fCoulomb);
cross *= xiLPM;
}
@@ -234,7 +231,7 @@ G4PairProductionRelModel::ComputeRelDXSectionPerAtom(G4double eplusEnergy,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void
void
G4PairProductionRelModel::CalcLPMFunctions(G4double k, G4double eplusEnergy)
{
// *** calculate lpm variable s & sprime ***
@@ -243,21 +240,21 @@ G4PairProductionRelModel::CalcLPMFunctions(G4double k, G4double eplusEnergy)
G4double s1 = preS1*z23;
G4double logS1 = 2./3.*lnZ-2.*facFel;
G4double logTS1 = logTwo+logS1;
G4double logTS1 = 0.5*logTwo+logS1;
xiLPM = 2.;
if (sprime>1)
if (sprime>1)
xiLPM = 1.;
else if (sprime>sqrt(2.)*s1) {
G4double h = G4Log(sprime)/logTS1;
xiLPM = 1+h-0.08*(1-h)*(1-sqr(1-h))/logTS1;
}
G4double s0 = sprime/sqrt(xiLPM);
G4double s0 = sprime/sqrt(xiLPM);
// G4cout<<"k="<<k<<" y="<<eplusEnergy/k<<G4endl;
// G4cout<<"s0="<<s0<<G4endl;
// *** calculate supression functions phi and G ***
// Klein eqs. (77)
G4double s2=s0*s0;
@@ -266,13 +263,13 @@ G4PairProductionRelModel::CalcLPMFunctions(G4double k, G4double eplusEnergy)
if (s0<0.1) {
// high suppression limit
phiLPM = 6.*s0 - 18.84955592153876*s2 + 39.47841760435743*s3
phiLPM = 6.*s0 - 18.84955592153876*s2 + 39.47841760435743*s3
- 57.69873135166053*s4;
gLPM = 37.69911184307752*s2 - 236.8705056261446*s3 + 807.7822389*s4;
}
else if (s0<1.9516) {
// intermediate suppression
// using eq.77 approxim. valid s0<2.
// using eq.77 approxim. valid s0<2.
phiLPM = 1.-G4Exp(-6.*s0*(1.+(3.-pi)*s0)
+s3/(0.623+0.795*s0+0.658*s2));
if (s0<0.415827397755) {
@@ -282,9 +279,9 @@ G4PairProductionRelModel::CalcLPMFunctions(G4double k, G4double eplusEnergy)
}
else {
// using alternative parametrisiation
G4double pre = -0.16072300849123999 + s0*3.7550300067531581 + s2*-1.7981383069010097
G4double pre = -0.16072300849123999 + s0*3.7550300067531581 + s2*-1.7981383069010097
+ s3*0.67282686077812381 + s4*-0.1207722909879257;
gLPM = tanh(pre);
gLPM = std::tanh(pre);
}
}
else {
@@ -295,18 +292,17 @@ G4PairProductionRelModel::CalcLPMFunctions(G4double k, G4double eplusEnergy)
// *** make sure suppression is smaller than 1 ***
// *** caused by Migdal approximation in xi ***
if (xiLPM*phiLPM>1. || s0>0.57) xiLPM=1./phiLPM;
if (xiLPM*phiLPM>1. || s0>0.57) { xiLPM=1./phiLPM; }
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double
G4double
G4PairProductionRelModel::ComputeCrossSectionPerAtom(const G4ParticleDefinition*,
G4double gammaEnergy, G4double Z, G4double, G4double, G4double)
{
G4double crossSection = 0.0 ;
if ( gammaEnergy <= 2.0*electron_mass_c2 ) return crossSection;
if ( gammaEnergy <= 2.0*electron_mass_c2 ) { return crossSection; }
SetCurrentElement(Z);
// choose calculator according to parameters and switches
@@ -321,7 +317,7 @@ G4PairProductionRelModel::ComputeCrossSectionPerAtom(const G4ParticleDefinition*
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void
void
G4PairProductionRelModel::SampleSecondaries(std::vector<G4DynamicParticle*>* fvect,
const G4MaterialCutsCouple* couple,
const G4DynamicParticle* aDynamicGamma,
@@ -336,7 +332,7 @@ G4PairProductionRelModel::SampleSecondaries(std::vector<G4DynamicParticle*>* fve
//
// Note 1 : Effects due to the breakdown of the Born approximation at
// low energy are ignored.
// Note 2 : The differential cross section implicitly takes account of
// Note 2 : The differential cross section implicitly takes account of
// pair creation in both nuclear and atomic electron fields.
// However triplet prodution is not generated.
{
@@ -349,34 +345,35 @@ G4PairProductionRelModel::SampleSecondaries(std::vector<G4DynamicParticle*>* fve
G4double epsil0 = electron_mass_c2/GammaEnergy ;
if(epsil0 > 1.0) { return; }
// do it fast if GammaEnergy < 2. MeV
SetupForMaterial(theGamma, aMaterial, GammaEnergy);
// select randomly one element constituing the material
const G4Element* anElement =
const G4Element* anElement =
SelectRandomAtom(aMaterial, theGamma, GammaEnergy);
CLHEP::HepRandomEngine* rndmEngine = G4Random::getTheEngine();
// do it fast if GammaEnergy < 2. MeV
if (GammaEnergy < Egsmall) {
epsil = epsil0 + (0.5-epsil0)*rndmEngine->flat();
} else {
// now comes the case with GammaEnergy >= 2. MeV
// Extract Coulomb factor for this Element
G4double FZ = 8.*(anElement->GetIonisation()->GetlogZ3());
if (GammaEnergy > 50.*MeV) { FZ += 8.*(anElement->GetfCoulomb()); }
static const G4double midEnergy = 50.*CLHEP::MeV;
if (GammaEnergy > midEnergy) { FZ += 8.*(anElement->GetfCoulomb()); }
// limits of the screening variable
G4double screenfac = 136.*epsil0/(anElement->GetIonisation()->GetZ3());
G4double screenmax = G4Exp ((42.24 - FZ)/8.368) - 0.952 ;
G4double screenmin = min(4.*screenfac,screenmax);
//F.Hariri : correct sign of last term
G4double screenmax = G4Exp ((42.24 - FZ)/8.368) + 0.952 ;
G4double screenmin = std::min(4.*screenfac, screenmax);
// limits of the energy sampling
G4double epsil1 = 0.5 - 0.5*sqrt(1. - screenmin/screenmax) ;
G4double epsilmin = max(epsil0,epsil1) , epsilrange = 0.5 - epsilmin;
G4double epsilmin = std::max(epsil0, epsil1);
G4double epsilrange = 0.5 - epsilmin;
//
// sample the energy rate of the created electron (or positron)
@@ -386,28 +383,28 @@ G4PairProductionRelModel::SampleSecondaries(std::vector<G4DynamicParticle*>* fve
G4double F10 = ScreenFunction1(screenmin) - FZ;
G4double F20 = ScreenFunction2(screenmin) - FZ;
G4double NormF1 = max(F10*epsilrange*epsilrange,0.);
G4double NormF2 = max(1.5*F20,0.);
G4double NormF1 = std::max(F10*epsilrange*epsilrange,0.);
G4double NormF2 = std::max(1.5*F20,0.);
do {
if ( NormF1/(NormF1+NormF2) > rndmEngine->flat() ) {
epsil = 0.5 - epsilrange*nist->GetZ13(rndmEngine->flat());
screenvar = screenfac/(epsil*(1-epsil));
if (fLPMflag && GammaEnergy>100.*GeV) {
if (fLPMflag && GammaEnergy > Eghigh) {
CalcLPMFunctions(GammaEnergy,GammaEnergy*epsil);
greject = xiLPM*((gLPM+2.*phiLPM)*Phi1(screenvar) -
greject = xiLPM*((gLPM+2.*phiLPM)*Phi1(screenvar) -
gLPM*Phi2(screenvar) - phiLPM*FZ)/F10;
}
else {
greject = (ScreenFunction1(screenvar) - FZ)/F10;
}
} else {
} else {
epsil = epsilmin + epsilrange*rndmEngine->flat();
screenvar = screenfac/(epsil*(1-epsil));
if (fLPMflag && GammaEnergy>100.*GeV) {
if (fLPMflag && GammaEnergy > Eghigh) {
CalcLPMFunctions(GammaEnergy,GammaEnergy*epsil);
greject = xiLPM*((0.5*gLPM+phiLPM)*Phi1(screenvar) +
greject = xiLPM*((0.5*gLPM+phiLPM)*Phi1(screenvar) +
0.5*gLPM*Phi2(screenvar) - 0.5*(gLPM+phiLPM)*FZ)/F20;
}
else {
@@ -419,19 +416,17 @@ G4PairProductionRelModel::SampleSecondaries(std::vector<G4DynamicParticle*>* fve
} while( greject < rndmEngine->flat());
} // end of epsil sampling
//
// fixe charges randomly
//
G4double ElectTotEnergy, PositTotEnergy;
if (rndmEngine->flat() > 0.5) {
ElectTotEnergy = (1.-epsil)*GammaEnergy;
PositTotEnergy = epsil*GammaEnergy;
} else {
PositTotEnergy = (1.-epsil)*GammaEnergy;
ElectTotEnergy = epsil*GammaEnergy;
}
@@ -439,21 +434,27 @@ G4PairProductionRelModel::SampleSecondaries(std::vector<G4DynamicParticle*>* fve
//
// scattered electron (positron) angles. ( Z - axis along the parent photon)
//
// universal distribution suggested by L. Urban
// universal distribution suggested by L. Urban
// (Geant3 manual (1993) Phys211),
// derived from Tsai distribution (Rev Mod Phys 49,421(1977))
G4double u = -G4Log(rndmEngine->flat()*rndmEngine->flat());
static const G4double a1 = 1.6;
static const G4double a2 = a1/3.;
G4double uu = -G4Log(rndmEngine->flat()*rndmEngine->flat());
G4double u = (0.25 > rndmEngine->flat()) ? uu*a1 : uu*a2;
if (9. > 36.*rndmEngine->flat()) { u *= 1.6; }
else { u *= 0.53333; }
G4double thetaEle = u*electron_mass_c2/ElectTotEnergy;
G4double sinte = std::sin(thetaEle);
G4double coste = std::cos(thetaEle);
G4double thetaPos = u*electron_mass_c2/PositTotEnergy;
G4double sintp = std::sin(thetaPos);
G4double costp = std::cos(thetaPos);
G4double phi = twopi * rndmEngine->flat();
G4double sinp = std::sin(phi);
G4double cosp = std::cos(phi);
G4double TetEl = u*electron_mass_c2/ElectTotEnergy;
G4double TetPo = u*electron_mass_c2/PositTotEnergy;
G4double Phi = twopi * rndmEngine->flat();
G4double dxEl= sin(TetEl)*cos(Phi),dyEl= sin(TetEl)*sin(Phi),dzEl=cos(TetEl);
G4double dxPo=-sin(TetPo)*cos(Phi),dyPo=-sin(TetPo)*sin(Phi),dzPo=cos(TetPo);
//
// kinematic of the created pair
//
@@ -462,21 +463,21 @@ G4PairProductionRelModel::SampleSecondaries(std::vector<G4DynamicParticle*>* fve
G4double ElectKineEnergy = max(0.,ElectTotEnergy - electron_mass_c2);
G4ThreeVector ElectDirection (dxEl, dyEl, dzEl);
ElectDirection.rotateUz(GammaDirection);
G4ThreeVector ElectDirection (sinte*cosp, sinte*sinp, coste);
ElectDirection.rotateUz(GammaDirection);
// create G4DynamicParticle object for the particle1
// create G4DynamicParticle object for the particle1
G4DynamicParticle* aParticle1= new G4DynamicParticle(
theElectron,ElectDirection,ElectKineEnergy);
// the e+ is always created (even with Ekine=0) for further annihilation.
G4double PositKineEnergy = max(0.,PositTotEnergy - electron_mass_c2);
G4double PositKineEnergy = std::max(0.,PositTotEnergy - electron_mass_c2);
G4ThreeVector PositDirection (dxPo, dyPo, dzPo);
PositDirection.rotateUz(GammaDirection);
G4ThreeVector PositDirection (-sintp*cosp, -sintp*sinp, costp);
PositDirection.rotateUz(GammaDirection);
// create G4DynamicParticle object for the particle2
// create G4DynamicParticle object for the particle2
G4DynamicParticle* aParticle2= new G4DynamicParticle(
thePositron,PositDirection,PositKineEnergy);
@@ -486,7 +487,7 @@ G4PairProductionRelModel::SampleSecondaries(std::vector<G4DynamicParticle*>* fve
// kill incident photon
fParticleChange->SetProposedKineticEnergy(0.);
fParticleChange->ProposeTrackStatus(fStopAndKill);
fParticleChange->ProposeTrackStatus(fStopAndKill);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......