Import Geant4 10.6.0 source tree

This commit is contained in:
Gabriele Cosmo
2019-12-06 15:12:28 +01:00
parent b2a62ae692
commit 5baee230e9
2997 changed files with 141580 additions and 98673 deletions
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// -------------------------------------------------------------------
//
// GEANT4 Class file
@@ -54,6 +53,7 @@
#include "G4Isotope.hh"
#include "G4Log.hh"
#include "G4Exp.hh"
#include "G4NuclearRadii.hh"
#include "G4CrossSectionDataSetRegistry.hh"
@@ -61,8 +61,10 @@
const G4double llog10 = G4Log(10.);
G4double G4BGGNucleonInelasticXS::theGlauberFac[93] = {0.0};
G4double G4BGGNucleonInelasticXS::theCoulombFac[93] = {0.0};
G4double G4BGGNucleonInelasticXS::theGlauberFacP[93] = {0.0};
G4double G4BGGNucleonInelasticXS::theCoulombFacP[93] = {0.0};
G4double G4BGGNucleonInelasticXS::theGlauberFacN[93] = {0.0};
G4double G4BGGNucleonInelasticXS::theCoulombFacN[93] = {0.0};
G4int G4BGGNucleonInelasticXS::theA[93] = {0};
#ifdef G4MULTITHREADED
@@ -75,15 +77,13 @@ G4BGGNucleonInelasticXS::G4BGGNucleonInelasticXS(const G4ParticleDefinition* p)
verboseLevel = 0;
fGlauberEnergy = 91.*GeV;
fLowEnergy = 14.*MeV;
fHighEnergy = 5.*GeV;
fNucleon = nullptr;
fGlauber = nullptr;
fHadron = nullptr;
particle = p;
theProton= G4Proton::Proton();
isProton = (theProton == p) ? true : false;
isProton = (theProton == p);
isMaster = false;
SetForAllAtomsAndEnergies(true);
}
@@ -98,7 +98,7 @@ G4BGGNucleonInelasticXS::~G4BGGNucleonInelasticXS()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool G4BGGNucleonInelasticXS::IsElementApplicable(const G4DynamicParticle*,
G4int, const G4Material*)
G4int, const G4Material*)
{
return true;
}
@@ -106,9 +106,9 @@ G4bool G4BGGNucleonInelasticXS::IsElementApplicable(const G4DynamicParticle*,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool G4BGGNucleonInelasticXS::IsIsoApplicable(const G4DynamicParticle*,
G4int Z, G4int,
const G4Element*,
const G4Material*)
G4int Z, G4int,
const G4Element*,
const G4Material*)
{
return (1 == Z);
}
@@ -117,24 +117,20 @@ G4bool G4BGGNucleonInelasticXS::IsIsoApplicable(const G4DynamicParticle*,
G4double
G4BGGNucleonInelasticXS::GetElementCrossSection(const G4DynamicParticle* dp,
G4int ZZ, const G4Material*)
G4int ZZ, const G4Material*)
{
G4double cross = 0.0;
G4double ekin = dp->GetKineticEnergy();
G4int Z = std::min(ZZ, 92);
if(1 == Z) {
cross = 1.0115*GetIsoCrossSection(dp,1,1);
} else if(2 == Z) {
if(ekin > fGlauberEnergy) {
cross = theGlauberFac[Z]*fGlauber->GetInelasticGlauberGribov(dp, Z, theA[Z]);
} else {
cross = fNucleon->GetElementCrossSection(dp, Z);
}
} else {
if(ekin <= fLowEnergy) {
cross = theCoulombFac[Z]*CoulombFactor(ekin, Z);
cross = (isProton) ? theCoulombFacP[Z] : theCoulombFacN[Z];
cross *= CoulombFactor(ekin, Z);
} else if(ekin > fGlauberEnergy) {
cross = theGlauberFac[Z]*fGlauber->GetInelasticGlauberGribov(dp, Z, theA[Z]);
cross = (isProton) ? theGlauberFacP[Z] : theGlauberFacN[Z];
cross *= fGlauber->GetInelasticGlauberGribov(dp, Z, theA[Z]);
} else {
cross = fNucleon->GetElementCrossSection(dp, Z);
}
@@ -142,11 +138,11 @@ G4BGGNucleonInelasticXS::GetElementCrossSection(const G4DynamicParticle* dp,
if(verboseLevel > 1) {
G4cout << "G4BGGNucleonInelasticXS::GetCrossSection for "
<< dp->GetDefinition()->GetParticleName()
<< " Ekin(GeV)= " << dp->GetKineticEnergy()/CLHEP::GeV
<< " in nucleus Z= " << Z << " A= " << theA[Z]
<< " XS(b)= " << cross/barn
<< G4endl;
<< dp->GetDefinition()->GetParticleName()
<< " Ekin(GeV)= " << dp->GetKineticEnergy()/CLHEP::GeV
<< " in nucleus Z= " << Z << " A= " << theA[Z]
<< " XS(b)= " << cross/barn
<< G4endl;
}
return cross;
}
@@ -155,23 +151,23 @@ G4BGGNucleonInelasticXS::GetElementCrossSection(const G4DynamicParticle* dp,
G4double
G4BGGNucleonInelasticXS::GetIsoCrossSection(const G4DynamicParticle* dp,
G4int Z, G4int A,
const G4Isotope*,
const G4Element*,
const G4Material*)
G4int Z, G4int A,
const G4Isotope*,
const G4Element*,
const G4Material*)
{
// this method should be called only for Z = 1
fHadron->HadronNucleonXscNS(dp->GetDefinition(), theProton,
dp->GetKineticEnergy());
dp->GetKineticEnergy());
G4double cross = A*fHadron->GetInelasticHadronNucleonXsc();
if(verboseLevel > 1) {
G4cout << "G4BGGNucleonInelasticXS::GetIsoCrossSection for "
<< dp->GetDefinition()->GetParticleName()
<< " Ekin(GeV)= " << dp->GetKineticEnergy()/CLHEP::GeV
<< " in nucleus Z= " << Z << " A= " << theA[Z]
<< " XS(b)= " << cross/barn
<< G4endl;
<< dp->GetDefinition()->GetParticleName()
<< " Ekin(GeV)= " << dp->GetKineticEnergy()/CLHEP::GeV
<< " in nucleus Z= " << Z << " A= " << theA[Z]
<< " XS(b)= " << cross/barn
<< G4endl;
}
return cross;
}
@@ -180,26 +176,23 @@ G4BGGNucleonInelasticXS::GetIsoCrossSection(const G4DynamicParticle* dp,
void G4BGGNucleonInelasticXS::BuildPhysicsTable(const G4ParticleDefinition& p)
{
if(fNucleon) { return; }
if(&p == theProton || &p == G4Neutron::Neutron()) {
particle = &p;
isProton = (theProton == particle) ? true : false;
isProton = (theProton == &p);
} else {
G4ExceptionDescription ed;
ed << "This BGG cross section is applicable only to nucleons and not to "
<< p.GetParticleName() << G4endl;
G4Exception("G4BGGNucleonInelasticXS::BuildPhysicsTable", "had001",
FatalException, ed);
FatalException, ed);
return;
}
if(!fNucleon) {
fNucleon = (G4NucleonNuclearCrossSection*)G4CrossSectionDataSetRegistry::Instance()->GetCrossSectionDataSet(G4NucleonNuclearCrossSection::Default_Name());
fGlauber = new G4ComponentGGHadronNucleusXsc();
fHadron = new G4HadronNucleonXsc();
}
fNucleon = new G4NucleonNuclearCrossSection();
fGlauber = new G4ComponentGGHadronNucleusXsc();
fHadron = new G4HadronNucleonXsc();
fNucleon->BuildPhysicsTable(*particle);
fGlauber->BuildPhysicsTable(*particle);
fNucleon->BuildPhysicsTable(p);
if(0 == theA[0]) {
#ifdef G4MULTITHREADED
@@ -211,44 +204,61 @@ void G4BGGNucleonInelasticXS::BuildPhysicsTable(const G4ParticleDefinition& p)
}
G4MUTEXUNLOCK(&nucleonInelasticXSMutex);
#endif
} else {
return;
}
if(isMaster && 0 == theA[0]) {
theA[0] = 1;
theA[0] = theA[1] = 1;
G4ThreeVector mom(0.0,0.0,1.0);
G4DynamicParticle dp(particle, mom, fGlauberEnergy);
G4DynamicParticle dp(theProton, mom, fGlauberEnergy);
G4NistManager* nist = G4NistManager::Instance();
G4double csup, csdn;
if(verboseLevel > 0) {
G4cout << "### G4BGGNucleonInelasticXS::Initialise for "
<< particle->GetParticleName() << G4endl;
<< p.GetParticleName() << G4endl;
}
for(G4int iz=2; iz<93; iz++) {
for(G4int iz=2; iz<93; ++iz) {
G4int A = G4lrint(nist->GetAtomicMassAmu(iz));
theA[iz] = A;
csup = fGlauber->GetInelasticGlauberGribov(&dp, iz, A);
csdn = fNucleon->GetElementCrossSection(&dp, iz);
theGlauberFacP[iz] = csdn/csup;
}
dp.SetDefinition(G4Neutron::Neutron());
for(G4int iz=2; iz<93; ++iz) {
csup = fGlauber->GetInelasticGlauberGribov(&dp, iz, theA[iz]);
csdn = fNucleon->GetElementCrossSection(&dp, iz);
theGlauberFacN[iz] = csdn/csup;
theGlauberFac[iz] = csdn/csup;
if(verboseLevel > 0) {
G4cout << "Z= " << iz << " A= " << A
<< " GlauberFactor= " << theGlauberFac[iz] << G4endl;
G4cout << "Z= " << iz << " A= " << theA[iz]
<< " GFactorP= " << theGlauberFacP[iz]
<< " GFactorN= " << theGlauberFacN[iz] << G4endl;
}
}
theCoulombFac[1] = 1.0;
theCoulombFacP[1] = theCoulombFacN[1] = 1.0;
dp.SetDefinition(theProton);
dp.SetKineticEnergy(fLowEnergy);
for(G4int iz=2; iz<93; ++iz) {
theCoulombFac[iz] =
fNucleon->GetElementCrossSection(&dp, iz)/CoulombFactor(fLowEnergy, iz);
theCoulombFacP[iz] = fNucleon->GetElementCrossSection(&dp, iz)
/CoulombFactor(fLowEnergy, iz);
}
dp.SetDefinition(G4Neutron::Neutron());
for(G4int iz=2; iz<93; ++iz) {
theCoulombFacN[iz] = fNucleon->GetElementCrossSection(&dp, iz)
/CoulombFactor(fLowEnergy, iz);
if(verboseLevel > 0) {
G4cout << "Z= " << iz << " A= " << theA[iz]
<< " CoulombFactor= " << theCoulombFac[iz] << G4endl;
G4cout << "Z= " << iz << " A= " << theA[iz]
<< " CFactorP= " << theCoulombFacP[iz]
<< " CFactorN= " << theCoulombFacN[iz] << G4endl;
}
}
}
@@ -258,27 +268,28 @@ void G4BGGNucleonInelasticXS::BuildPhysicsTable(const G4ParticleDefinition& p)
G4double G4BGGNucleonInelasticXS::CoulombFactor(G4double kinEnergy, G4int Z)
{
G4double res= 0.0;
G4double res = 0.0;
if(kinEnergy <= 0.0) { return res; }
else if (Z <= 1) { return kinEnergy*kinEnergy; }
G4double elog = G4Log(kinEnergy/GeV)/llog10;
G4double aa = theA[Z];
if(isProton) {
// from G4ProtonInelasticCrossSection
if(isProton) {
G4double ff1 = 5.6 - 0.016*aa; // slope of the drop at medium energies.
G4double ff2 = 1.37 + 1.37/aa; // start of the slope.
G4double ff3 = 0.8 + 18./aa - 0.002*aa; // stephight
res = 1.0 + ff3*(1.0 - (1.0/(1+G4Exp(-ff1*(elog + ff2)))));
ff1 = 8. - 8./aa - 0.008*aa; // slope of the rise
ff2 = 2.34 - 5.4/aa - 0.0028*aa; // start of the rise
res /= (1.0 + G4Exp(-ff1*(elog + ff2)));
res = G4NuclearRadii::CoulombFactor(Z, theA[Z], theProton, kinEnergy);
// from G4ProtonInelasticCrossSection
if(res > 0.0) {
G4double ff1 = 5.6 - 0.016*aa; // slope of the drop at medium energies.
G4double ff2 = 1.37 + 1.37/aa; // start of the slope.
G4double ff3 = 0.8 + 18./aa - 0.002*aa; // stephight
res *= (1.0 + ff3*(1.0 - (1.0/(1+G4Exp(-ff1*(elog + ff2))))));
ff1 = 8. - 8./aa - 0.008*aa; // slope of the rise
ff2 = 2.34 - 5.4/aa - 0.0028*aa; // start of the rise
res /= (1.0 + G4Exp(-ff1*(elog + ff2)));
}
} else {
// from G4NeutronInelasticCrossSection
G4double p3 = 0.6 + 13./aa - 0.0005*aa;
G4double p4 = 7.2449 - 0.018242*aa;
@@ -290,7 +301,6 @@ G4double G4BGGNucleonInelasticXS::CoulombFactor(G4double kinEnergy, G4int Z)
G4double secondexp = G4Exp(-p6*(elog + p7));
res = (1.+p3*firstexp/(1. + firstexp))/(1. + secondexp);
}
return res;
}