Import Geant4 11.0.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2021-06-25 16:12:29 +02:00
parent c968e26a39
commit 6399a014b6
4200 changed files with 207479 additions and 237366 deletions
@@ -37,30 +37,29 @@
#include "G4Gamma.hh"
#include "G4ParticleChangeForGamma.hh"
#include "G4Exp.hh"
#include "G4AutoLock.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
using namespace std;
namespace { G4Mutex LivermoreGammaConversionModelRCMutex = G4MUTEX_INITIALIZER; }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4int G4LivermoreGammaConversionModelRC::maxZ = 99;
G4LPhysicsFreeVector* G4LivermoreGammaConversionModelRC::data[] = {nullptr};
G4PhysicsFreeVector* G4LivermoreGammaConversionModelRC::data[] = {nullptr};
G4LivermoreGammaConversionModelRC::G4LivermoreGammaConversionModelRC
(const G4ParticleDefinition*, const G4String& nam)
:G4VEmModel(nam),isInitialised(false),smallEnergy(2.*MeV)
:G4VEmModel(nam),smallEnergy(2.*MeV),isInitialised(false)
{
fParticleChange = nullptr;
lowEnergyLimit = 2.0*electron_mass_c2;
verboseLevel= 0;
// Verbosity scale for debugging purposes:
// 0 = nothing
// 1 = calculation of cross sections, file openings...
// 2 = entering in methods
if(verboseLevel > 0)
{
G4cout << "G4LivermoreGammaConversionModelRC is constructed " << G4endl;
@@ -75,7 +74,7 @@ G4LivermoreGammaConversionModelRC::~G4LivermoreGammaConversionModelRC()
for(G4int i=0; i<maxZ; ++i) {
if(data[i]) {
delete data[i];
data[i] = 0;
data[i] = nullptr;
}
}
}
@@ -96,16 +95,13 @@ void G4LivermoreGammaConversionModelRC::Initialise(
<< HighEnergyLimit() / GeV << " GeV"
<< G4endl;
}
if(IsMaster())
{
// Initialise element selector
InitialiseElementSelectors(particle, cuts);
// Access to elements
// Access to elements
char* path = std::getenv("G4LEDATA");
G4ProductionCutsTable* theCoupleTable =
@@ -178,10 +174,8 @@ void G4LivermoreGammaConversionModelRC::ReadData(size_t Z, const char* path)
}
}
//
data[Z] = new G4LPhysicsFreeVector();
//
data[Z] = new G4PhysicsFreeVector(0,/*spline=*/true);
//
std::ostringstream ost;
@@ -197,8 +191,7 @@ void G4LivermoreGammaConversionModelRC::ReadData(size_t Z, const char* path)
"em0003",FatalException,
ed,"G4LEDATA version should be G4EMLOW6.27 or later.");
return;
}
}
else
{
@@ -209,7 +202,7 @@ void G4LivermoreGammaConversionModelRC::ReadData(size_t Z, const char* path)
}
// Activation of spline interpolation
data[Z] ->SetSpline(true);
data[Z] ->FillSecondDerivatives();
}
@@ -235,7 +228,7 @@ G4LivermoreGammaConversionModelRC::ComputeCrossSectionPerAtom(const G4ParticleDe
if(intZ < 1 || intZ > maxZ) { return xs; }
G4LPhysicsFreeVector* pv = data[intZ];
G4PhysicsFreeVector* pv = data[intZ];
// if element was not initialised
// do initialisation safely for MT mode
@@ -271,17 +264,16 @@ void G4LivermoreGammaConversionModelRC::SampleSecondaries(
const G4DynamicParticle* aDynamicGamma,
G4double, G4double)
{
// The energies of the e+ e- secondaries are sampled using the Bethe - Heitler
// cross sections with Coulomb correction. A modified version of the random
// number techniques of Butcher & Messel is used (Nuc Phys 20(1960),15).
// 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
// pair creation in both nuclear and atomic electron fields. However triplet
// prodution is not generated.
// The energies of the e+ e- secondaries are sampled using the Bethe - Heitler
// cross sections with Coulomb correction. A modified version of the random
// number techniques of Butcher & Messel is used (Nuc Phys 20(1960),15).
// 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
// pair creation in both nuclear and atomic electron fields. However triplet
// prodution is not generated.
if (verboseLevel > 1) {
G4cout << "Calling SampleSecondaries() of G4LivermoreGammaConversionModelRC"
<< G4endl;
@@ -371,12 +363,10 @@ void G4LivermoreGammaConversionModelRC::SampleSecondaries(
G4double HardPhotonThreshold = 0.08;
G4double r1, r2, r3, beta=0, gbeta, sigt = 582.068, sigh, rejet;
// , Pi = 2.*acos(0.);
G4double cg = (11./2.)/(G4Exp(-11.*HardPhotonThreshold/2.)-G4Exp(-11./2.));
r1 = G4UniformRand();
sigh = 1028.58*G4Exp(-HardPhotonThreshold/0.09033) + 136.63; // sigma hard
sigh = 1028.58*G4Exp(-HardPhotonThreshold/0.09033) + 136.63; // sigma hard
if (r1 > 1.- sigh/sigt) {
r2 = G4UniformRand();
@@ -432,9 +422,7 @@ void G4LivermoreGammaConversionModelRC::SampleSecondaries(
else
{
Rechazo = deltaP_R2/NormaRC;
}
//G4cout << Rechazo << " " << NormaRC << " " << epsilon << G4endl;
}
} while (Rechazo < G4UniformRand() );
electronTotEnergy = (1. - epsilon) * photonEnergy;
@@ -448,13 +436,10 @@ void G4LivermoreGammaConversionModelRC::SampleSecondaries(
// Scattered electron (positron) angles. ( Z - axis along the parent photon)
// Universal distribution suggested by L. Urban (Geant3 manual (1993) Phys211),
// derived from Tsai distribution (Rev. Mod. Phys. 49, 421 (1977)
G4double u;
const G4double a1 = 0.625;
G4double a2 = 3. * a1;
// G4double d = 27. ;
// if (9. / (9. + d) > G4UniformRand())
if (0.25 > G4UniformRand())
{
u = - G4Log(G4UniformRand() * G4UniformRand()) / a1 ;
@@ -471,11 +456,9 @@ void G4LivermoreGammaConversionModelRC::SampleSecondaries(
G4double dxEle= std::sin(thetaEle)*std::cos(phi),dyEle= std::sin(thetaEle)*std::sin(phi),dzEle=std::cos(thetaEle);
G4double dxPos=-std::sin(thetaPos)*std::cos(phi),dyPos=-std::sin(thetaPos)*std::sin(phi),dzPos=std::cos(thetaPos);
// Kinematics of the created pair:
// the electron and positron are assumed to have a symetric angular
// distribution with respect to the Z axis along the parent photon
G4double electronKineEnergy = std::max(0.,electronTotEnergy - electron_mass_c2) ;
G4ThreeVector electronDirection (dxEle, dyEle, dzEle);
@@ -527,8 +510,7 @@ G4double G4LivermoreGammaConversionModelRC::ScreenFunction1(G4double screenVaria
{
// Compute the value of the screening function 3*phi1 - phi2
G4double value;
G4double value;
if (screenVariable > 1.)
value = 42.24 - 8.368 * G4Log(screenVariable + 0.952);
else
@@ -542,9 +524,7 @@ G4double G4LivermoreGammaConversionModelRC::ScreenFunction1(G4double screenVaria
G4double G4LivermoreGammaConversionModelRC::ScreenFunction2(G4double screenVariable)
{
// Compute the value of the screening function 1.5*phi1 - 0.5*phi2
G4double value;
G4double value;
if (screenVariable > 1.)
value = 42.24 - 8.368 * G4Log(screenVariable + 0.952);
else
@@ -554,15 +534,13 @@ G4double G4LivermoreGammaConversionModelRC::ScreenFunction2(G4double screenVaria
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4LivermoreGammaConversionModelRC::fbeta(G4double x)
{
// compute the probabililty distribution for hard photon
G4double Pi, gamma, eta, d, p1, p2, p3, p4, p5, p6, p7, ffbeta;
G4double gamma, eta, d, p1, p2, p3, p4, p5, p6, p7, ffbeta;
gamma = (1.-x)*(1.-x)/x;
eta = (1.-x)/(1.+x);
d = Dilog(1./x)-Dilog(x);
Pi = 2.*acos(0.);
p1 = -1.*(25528.*pow(gamma,2) + 116044.* gamma +151556.)/105.;
p2 = 256.* pow(gamma,3) + 1092.* pow(gamma,2) +1260.*gamma + 420.;
p3 = (676.*pow(gamma,3) + 9877.*pow(gamma,2) + 58415.*gamma + 62160.)/105.;
@@ -570,7 +548,7 @@ G4double G4LivermoreGammaConversionModelRC::fbeta(G4double x)
p5 = (676.*pow(gamma,3) + 38109.*pow(gamma,2) + 211637.*gamma + 266660. - 53632./gamma)/105.;
p6 = 32.*pow(gamma,2) + 416.*gamma + 1310. +1184./gamma;
p7 = 128.*pow(gamma,3) + 802.*pow(gamma,2) + 1028.*gamma - 470. - 1184./gamma;
ffbeta = (1.-x) * (p1 + p2*Pi*Pi/6. + p3*log(gamma) +
ffbeta = (1.-x) * (p1 + p2*pi*pi/6. + p3*log(gamma) +
p4*pow(log(x),2) + (p5 + p6*log(gamma))*eta*log(x) + p7*d*eta);
return ffbeta;
}
@@ -580,9 +558,8 @@ G4double G4LivermoreGammaConversionModelRC::fbeta(G4double x)
G4double G4LivermoreGammaConversionModelRC::Dilog(G4double y)
{
G4double fdilog = 0.0;
G4double Pi = 2.*acos(0.); // serve?
if (y <= 0.5) {
fdilog = pow(Pi,2)/6. + (1.-y)*(log(1-y)-1.)+pow((1.-y),2)*((1./2.)*log(1.-y)-1./4.)
fdilog = pow(pi,2)/6. + (1.-y)*(log(1-y)-1.)+pow((1.-y),2)*((1./2.)*log(1.-y)-1./4.)
+pow((1.-y),3)*((1./3.)*log(1.-y)-1./9.)+pow((1.-y),4)*((1./4.)*log(1.-y)-1./16.);
}
if (0.5 < y && y < 2.) {
@@ -590,7 +567,7 @@ G4double G4LivermoreGammaConversionModelRC::Dilog(G4double y)
pow((1.-y),5)/25.+pow((1.-y),6)/36.+pow((1.-y),7)/49.;
}
if (y >= 2.) {
fdilog = -pow(log(y),2)/2. - pow(Pi,2)/6. + (log(y)+1.)/y +
fdilog = -pow(log(y),2)/2. - pow(pi,2)/6. + (log(y)+1.)/y +
(log(y)/2.+1./4.)/pow(y,2) + (log(y)/3.+1./9.)/pow(y,3);
}
return fdilog;
@@ -598,16 +575,11 @@ G4double G4LivermoreGammaConversionModelRC::Dilog(G4double y)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "G4AutoLock.hh"
namespace { G4Mutex LivermoreGammaConversionModelRCMutex = G4MUTEX_INITIALIZER; }
void G4LivermoreGammaConversionModelRC::InitialiseForElement(
const G4ParticleDefinition*,
G4int Z)
{
G4AutoLock l(&LivermoreGammaConversionModelRCMutex);
// G4cout << "G4LivermoreGammaConversionModelRC::InitialiseForElement Z= "
// << Z << G4endl;
if(!data[Z]) { ReadData(Z); }
l.unlock();
}