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
@@ -18,6 +18,7 @@ CPPFLAGS += -I$(G4BASE)/global/management/include \
-I$(G4BASE)/track/include \
-I$(G4BASE)/geometry/volumes/include \
-I$(G4BASE)/geometry/management/include \
-I$(G4BASE)/processes/cuts/include \
-I$(G4BASE)/processes/management/include \
-I$(G4BASE)/processes/hadronic/management/include/ \
-I$(G4BASE)/processes/hadronic/util/include/ \
@@ -14,6 +14,41 @@ code and to keep track of all tags.
* Please list in reverse chronological order (last date on top)
---------------------------------------------------------------
26 November 2019 - V.Ivanchenko (hadr-cohe-V10-05-10)
---------------------------------------------------------------
- G4HadronElastic : Added limit on number of warning printouts
19 November 2019 - G. Folger (hadr-cohe-V10-05-09)
---------------------------------------------------------------
- remove using namespace std and using namespace CLHEP from header file
G4NeutronElectronElModel.hh
15 November 2019 - V.Ivanchenko (hadr-cohe-V10-05-08)
---------------------------------------------------------------
- G4HadronElastic : Change warning printout, in the case if sampled
t>tmax resample using simple algorithm, protect this warning
by G4VERBOSE, this is a partial fix of #2204
06 November 2019 - A.Ribon (hadr-cohe-V10-05-07)
---------------------------------------------------------------
- G4HadronElastic : Coverity fix in the unused method GetSlopeCof.
31 October 2019 - V.Ivanchenko (hadr-cohe-V10-05-06)
--------------------------------------------------------
- G4ElasticHadrNucleusHE - reduction of size of data structure and
time for initialisation ~2 times; general code clean-up; addition
of protections
07 October 2019 - V.Grichine (hadr-cohe-V10-05-05)
---------------------------------------------------------------
- G4hadronElstic - new method for s-,c-,b-particle
- ds/dt slope modifications in preparation
03 July 2019 - V.Ivanchenko (hadr-cohe-V10-05-04)
--------------------------------------------------------
- G4ElasticHadrNucleusHE - general clean-up of the code
- G4HadronElastic - added new parameterisation of A.Yeltokov
14 May 2019 - A.Ribon (hadr-cohe-V10-05-03)
--------------------------------------------------------
- G4HadronElastic : numerically safer treatment of the very rare cases
@@ -23,15 +23,12 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
// G4ElasticHadrNucleusHe.hh
// The generator of high energy hadron-nucleus elastic scattering
// The hadron kinetic energy T > 1 GeV
// N. Starkov 2003.
// N.Starkov 2003.
//
// 19.05.04 Variant for G4 6.1: The 'ApplyYourself' was changed
// 19.11.05 The HE elastic scattering on proton is added (N.Starkov)
// 16.11.06 General redesign (N.Starkov)
// 23.11.06 General cleanup, ONQ0=3 (V.Ivanchenko)
@@ -55,43 +52,39 @@
class G4NistManager;
static const G4int NHADRONS = 26; // Number of hadrons
static const G4int ONQ0 = 5; // The initial number of steps on Q2
static const G4int ONQ2 = 100; // The total number of steps on Q2
static const G4int NENERGY = 30;
static const G4int ZMAX = 93;
static const G4int NQTABLE = NENERGY*ONQ2;
static const G4int NHADRONS = 26; // Number of allowed hadrons
static const G4int ONQ2 = 102; // Number of points on Q2
static const G4int NENERGY = 24;
static const G4int ZMAX = 93;
///////////////////////////////////////////////////////////////////////
class G4ElasticData
{
friend class G4ElasticHadrNucleusHE;
public:
G4ElasticData(const G4ParticleDefinition* h, G4int Z, G4int A, G4double* e);
G4ElasticData(const G4ParticleDefinition* h, G4int Z, G4int A,
const G4double* e);
~G4ElasticData(){}
const G4ParticleDefinition* Hadron() {return hadr;}
~G4ElasticData() {}
private:
void DefineNucleusParameters(G4int A);
const G4ParticleDefinition* hadr;
// hide assignment operator
G4ElasticData & operator=(const G4ElasticData &right);
G4ElasticData(const G4ElasticData&);
public:
G4double R1, R2, Pnucl, Aeff;
G4double limitQ2;
G4double dQ2;
G4double massA;
G4double massA2;
G4int dnkE[NENERGY];
G4double maxQ2[NENERGY];
G4double TableQ2[ONQ2];
G4double TableCrossSec[NQTABLE];
std::vector<G4double> fCumProb[NENERGY];
};
/////////////////////////////////////////////////////////////////////
@@ -113,97 +106,81 @@ public:
private:
G4double HadronNucleusQ2_2(G4ElasticData * pElD, G4int Z,
G4double plabGeV, G4double tmax);
G4double HadronNucleusQ2_2(const G4ElasticData *pElD, G4double plabGeV,
G4double tmax);
void DefineHadronValues(G4int Z);
G4int FillFq2(G4int A);
G4double GetLightFq2(G4int Z, G4int A, G4double Q);
G4double GetHeavyFq2(G4int Z, G4int Nucleus, G4double *LineFq2);
G4double GetQ2_2(G4int N, G4double* Q, G4double* F, G4double R);
G4double GetQ2_2(G4int N, G4int Nmax,
const std::vector<G4double>& F, G4double rand);
G4double LineInterpol(G4double p0, G4double p2,
G4double c1, G4double c2,
G4double p);
G4double HadrNucDifferCrSec(G4int Z, G4int Nucleus, G4double Q2);
G4double HadrNucDifferCrSec(G4int A, G4double Q2);
void InterpolateHN(G4int n, const G4double EnP[],
const G4double C0P[], const G4double C1P[],
const G4double B0P[], const G4double B1P[]);
// hide assignment operator
G4ElasticHadrNucleusHE & operator=(const G4ElasticHadrNucleusHE &right);
G4ElasticHadrNucleusHE(const G4ElasticHadrNucleusHE&);
G4double GetBinomCof( G4int n, G4int m );
G4double GetFt(G4double Q2);
G4double GetDistrFun(G4double Q2);
G4double GetQ2(G4double Ran);
G4double HadronProtonQ2(const G4ParticleDefinition * aHadron,
G4double inLabMom);
void GetKinematics(const G4ParticleDefinition * aHadron,
G4double MomentumH);
G4double HadronProtonQ2(G4double plab, G4double tmax);
void Binom();
void FillData(const G4ParticleDefinition* p, G4int idx, G4int Z);
inline G4double LineInterpol(G4double p0, G4double p2,
G4double c1, G4double c2, G4double p);
inline G4double GetBinomCof( G4int n, G4int m );
// hide assignment operator
G4ElasticHadrNucleusHE & operator=(const G4ElasticHadrNucleusHE &right);
G4ElasticHadrNucleusHE(const G4ElasticHadrNucleusHE&);
// fields
G4int iHadrCode;
G4int iHadron;
static const G4int HadronCode[NHADRONS];
static const G4int HadronType[NHADRONS];
static const G4int HadronType1[NHADRONS];
G4int iHadron1;
static const G4int fHadronCode[NHADRONS];
static const G4int fHadronType[NHADRONS];
static const G4int fHadronType1[NHADRONS];
// momemtum limits
G4double plabLowLimit;
G4double dQ2;
// transition between internal and CLHEP units
G4double MbToGeV2;
G4double sqMbToGeV;
G4double Fm2ToGeV2;
G4double GeV2;
G4double protonM; // GeV
G4double protonM2; // GeV^2
// projectile kinematics in GeV
G4double hMass;
G4double hMass2;
G4double hLabMomentum;
G4double hLabMomentum2;
G4double MomentumCM;
G4double HadrEnergy;
// elastic parameters
G4double HadrTot, HadrSlope, HadrReIm, TotP,
DDSect2, DDSect3, ConstU, FmaxT;
G4double HadrTot, HadrSlope, HadrReIm, TotP;
G4double DDSect2, DDSect3, ConstU;
// momentum limits for different models of hadron/nucleon scatetring
G4double BoundaryP[7], BoundaryTL[7], BoundaryTG[7];
// parameterisation of scattering
G4double Slope1, Slope2, Coeff1, Coeff2, MaxTR;
G4double Slope1, Slope2, Coeff1, Coeff2;
G4double Slope0, Coeff0;
G4double aAIm, aDIm, Dtot11;
// nucleaus parameters
G4double R1, R2, Pnucl, Aeff;
G4int NumbN;
G4double R1, R2, Pnucl, Aeff, Q2max;
static G4double Energy[NENERGY];
static G4double LowEdgeEnergy[NENERGY];
static G4double ABinom[240][240];
static G4double fLineF[ONQ2];
static G4double fEnergy[NENERGY];
static G4double fLowEdgeEnergy[NENERGY];
static G4double fBinom[240][240];
static G4ElasticData* SetOfElasticData[NHADRONS][ZMAX];
static G4ElasticData* fElasticData[NHADRONS][ZMAX];
G4NistManager* nistManager;
G4bool isMaster;
@@ -228,15 +205,7 @@ G4double G4ElasticHadrNucleusHE::LineInterpol(G4double p1, G4double p2,
inline
G4double G4ElasticHadrNucleusHE::GetBinomCof(G4int numN, G4int numM)
{
return (numN >= numM && numN < 240) ? ABinom[numN][numM] : 0.0;
}
////////////////////////////////////////////////////////////////
inline
G4double G4ElasticHadrNucleusHE::GetDistrFun(G4double Q2)
{
return GetFt(Q2)/FmaxT;
return (numN >= numM && numN < 240) ? fBinom[numN][numM] : 0.0;
}
////////////////////////////////////////////////////////////////
@@ -60,6 +60,8 @@ public:
// sample momentum transfer using Lab. momentum
G4double SampleInvariantT(const G4ParticleDefinition* p, G4double plab,
G4int Z, G4int A) override;
G4double GetSlopeCof( const G4int pdg );
inline void SetLowestEnergyLimit(G4double value);
@@ -82,6 +84,7 @@ private:
G4ParticleDefinition* theAlpha;
G4double lowestEnergyLimit;
G4int nwarn;
};
inline void G4HadronElastic::SetLowestEnergyLimit(G4double value)
@@ -44,9 +44,6 @@
#include "G4Nucleus.hh"
#include "G4NucleiProperties.hh"
using namespace std;
using namespace CLHEP;
class G4ParticleDefinition;
class G4PhysicsLogVector;
class G4PhysicsTable;
@@ -106,7 +103,7 @@ inline G4double G4NeutronElectronElModel::CalculateAm( G4double Tkin)
fee = (Tkin+fM)*fme/fM;
// G4cout<<"fee = "<<fee<<" MeV"<<G4endl;
fee2 = fee*fee;
G4double momentum = sqrt( fee2 - fme2 );
G4double momentum = std::sqrt( fee2 - fme2 );
G4double k = momentum/CLHEP::hbarc;
G4double ch = 1.13;
G4double zn = 1.77*k*CLHEP::Bohr_radius;
@@ -31,6 +31,7 @@ include_directories(${CMAKE_SOURCE_DIR}/source/particles/hadrons/ions/include)
include_directories(${CMAKE_SOURCE_DIR}/source/particles/hadrons/mesons/include)
include_directories(${CMAKE_SOURCE_DIR}/source/particles/leptons/include)
include_directories(${CMAKE_SOURCE_DIR}/source/particles/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/cuts/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/cross_sections/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/models/management/include)
@@ -84,6 +85,7 @@ GEANT4_DEFINE_MODULE(NAME G4hadronic_coherent_elastic
GRANULAR_DEPENDENCIES
G4baryons
G4bosons
G4cuts
G4geometrymng
G4globman
G4had_mod_man
File diff suppressed because it is too large Load Diff
@@ -50,7 +50,9 @@ G4HadronElastic::G4HadronElastic(const G4String& name)
{
SetMinEnergy( 0.0*GeV );
SetMaxEnergy( G4HadronicParameters::Instance()->GetMaxEnergy() );
lowestEnergyLimit= 1.e-6*eV;
lowestEnergyLimit= 1.e-6*eV;
pLocalTmax = 0.0;
nwarn = 0;
theProton = G4Proton::Proton();
theNeutron = G4Neutron::Neutron();
@@ -115,38 +117,31 @@ G4HadFinalState* G4HadronElastic::ApplyYourself(
pLocalTmax = 4.0*momentumCMS*momentumCMS;
// Sampling in CM system
G4double t = SampleInvariantT(theParticle, plab, Z, A);
G4double t = SampleInvariantT(theParticle, plab, Z, A);
if(t < 0.0 || t > pLocalTmax) {
// For the very rare cases where cos(theta) is greater than 1 or smaller than -1,
// print some debugging information via a "JustWarning" exception, and resample
// using the default algorithm
#ifdef G4VERBOSE
if(nwarn < 2) {
G4ExceptionDescription ed;
ed << GetModelName() << " wrong sampling t= " << t << " tmax= " << pLocalTmax
<< " for " << aParticle->GetDefinition()->GetParticleName()
<< " ekin=" << ekin << " MeV"
<< " off (Z,A)=(" << Z << "," << A << ") - will be resampled" << G4endl;
G4Exception( "G4HadronElastic::ApplyYourself", "hadEla001", JustWarning, ed);
++nwarn;
}
#endif
t = G4HadronElastic::SampleInvariantT(theParticle, plab, Z, A);
}
G4double phi = G4UniformRand()*CLHEP::twopi;
G4double cost = 1. - 2.0*t/pLocalTmax;
// For the very rare cases where cos(theta) is greater than 1 or smaller than -1,
// print some debugging information via a "JustWarning" exception, and safely
// return (simply setting "cost=1.0" or "cost=-1.0" can sometimes cause a crash,
// due to numerical imprecisions, e.g. 3-momentum = (0.0, 0.0, 0.0) but
// Ekin very small but not 0.0).
if ( std::abs( cost ) > 1.0 ) {
G4ExceptionDescription ed;
ed << " LARGE cost ! cost=" << cost << " for " << aParticle->GetDefinition()->GetParticleName()
<< " ekin=" << ekin << " MeV" << " on (Z,A)=(" << Z << "," << A << ")" << G4endl;
if ( cost > 1.0 ) {
// We assume here no interaction and let the projectile keep going unchanged.
theParticleChange.SetEnergyChange( ekin );
theParticleChange.SetMomentumChange( aParticle->Get4Momentum().vect().unit() );
ed << "\t No interaction: the projectile keeps going unchanged!" << G4endl;
G4Exception( "G4HadronElastic::ApplyYourself", "hadEla001", JustWarning, ed );
return &theParticleChange;
} else { // cost < -1.0 ) {
// We assume here that the projectile stops and its energy is deposited locally
// (for simplicity, given that this condition should happen rarely, we neglect
// the recoil of the target nucleus).
theParticleChange.SetEnergyChange( 0.0 );
theParticleChange.SetLocalEnergyDeposit( ekin );
ed << "\t Projectile stops and its energy is deposited locally:" << G4endl
<< "\t neglected recoil of the target nucleus!" << G4endl;
G4Exception( "G4HadronElastic::ApplyYourself", "hadEla002", JustWarning, ed );
return &theParticleChange;
}
}
if (cost > 1.0) { cost = 1.0; }
else if(cost < -1.0) { cost = -1.0; }
G4double sint = std::sqrt((1.0-cost)*(1.0+cost));
@@ -207,22 +202,58 @@ G4HadFinalState* G4HadronElastic::ApplyYourself(
// sample momentum transfer in the CMS system
G4double
G4HadronElastic::SampleInvariantT(const G4ParticleDefinition*,
G4double, G4int, G4int A)
G4HadronElastic::SampleInvariantT(const G4ParticleDefinition* part,
G4double mom, G4int, G4int A)
{
static const G4double GeV2 = GeV*GeV;
const G4double plabLowLimit = 400.0*CLHEP::MeV;
const G4double GeV2 = GeV*GeV;
const G4double z07in13 = std::pow(0.7, 0.3333333333);
G4int pdg = std::abs(part->GetPDGEncoding());
G4double tmax = pLocalTmax/GeV2;
G4double aa, bb, cc;
static const G4double dd = 10.;
G4double aa, bb, cc, dd;
G4Pow* g4pow = G4Pow::GetInstance();
if (A <= 62) {
bb = 14.5*g4pow->Z23(A);
aa = g4pow->powZ(A, 1.63)/bb;
cc = 1.4*g4pow->Z13(A)/dd;
} else {
bb = 60.*g4pow->Z13(A);
aa = g4pow->powZ(A, 1.33)/bb;
cc = 0.4*g4pow->powZ(A, 0.4)/dd;
if (pdg == 211){ //Pions
if(mom >= plabLowLimit){ //High energy
bb = 14.5*g4pow->Z23(A);/*14.5*/
dd = 10.;
cc = 0.075*g4pow->Z13(A)/dd;//1.4
//aa = g4pow->powZ(A, 1.93)/bb;//1.63
aa = (A*A)/bb;//1.63
} else { //Low energy
bb = 29.*z07in13*z07in13*g4pow->Z23(A);
dd = 15.;
cc = 0.04*g4pow->Z13(A)/dd;//1.4
aa = g4pow->powZ(A, 1.63)/bb;//1.63
}
} else { //Other particles
bb = 14.5*g4pow->Z23(A);
dd = 20.;
aa = (A*A)/bb;//1.63
cc = 1.4*g4pow->Z13(A)/dd;
}
//===========================
} else { //(A>62)
if (pdg == 211) {
if(mom >= plabLowLimit){ //high
bb = 60.*z07in13*g4pow->Z13(A);//60
dd = 30.;
aa = 0.5*(A*A)/bb;//1.33
cc = 4.*g4pow->powZ(A,0.4)/dd;//1:0.4 --- 2: 0.4
} else { //low
bb = 120.*z07in13*g4pow->Z13(A);//60
dd = 30.;
aa = 2.*g4pow->powZ(A,1.33)/bb;
cc = 4.*g4pow->powZ(A,0.4)/dd;//1:0.4 --- 2: 0.4
}
} else {
bb = 60.*g4pow->Z13(A);
dd = 25.;
aa = g4pow->powZ(A,1.33)/bb;//1.33
cc = 0.2*g4pow->powZ(A,0.4)/dd;//1:0.4 --- 2: 0.4
}
}
G4double q1 = 1.0 - G4Exp(-bb*tmax);
G4double q2 = 1.0 - G4Exp(-dd*tmax);
@@ -234,3 +265,119 @@ G4HadronElastic::SampleInvariantT(const G4ParticleDefinition*,
}
return -GeV2*G4Log(1.0 - G4UniformRand()*q1)/bb;
}
//////////////////////////////////////////////
//
// Cofs for s-,c-,b-particles ds/dt slopes
G4double G4HadronElastic::GetSlopeCof(const G4int pdg )
{
// The input parameter "pdg" should be the absolute value of the PDG code
// (i.e. the same value for a particle and its antiparticle).
G4double coeff = 1.0;
// heavy barions
static const G4double lBarCof1S = 0.88;
static const G4double lBarCof2S = 0.76;
static const G4double lBarCof3S = 0.64;
static const G4double lBarCof1C = 0.784378;
static const G4double lBarCofSC = 0.664378;
static const G4double lBarCof2SC = 0.544378;
static const G4double lBarCof1B = 0.740659;
static const G4double lBarCofSB = 0.620659;
static const G4double lBarCof2SB = 0.500659;
if( pdg == 3122 || pdg == 3222 || pdg == 3112 || pdg == 3212 )
{
coeff = lBarCof1S; // Lambda, Sigma+, Sigma-, Sigma0
} else if( pdg == 3322 || pdg == 3312 )
{
coeff = lBarCof2S; // Xi-, Xi0
}
else if( pdg == 3324)
{
coeff = lBarCof3S; // Omega
}
else if( pdg == 4122 || pdg == 4212 || pdg == 4222 || pdg == 4112 )
{
coeff = lBarCof1C; // LambdaC+, SigmaC+, SigmaC++, SigmaC0
}
else if( pdg == 4332 )
{
coeff = lBarCof2SC; // OmegaC
}
else if( pdg == 4232 || pdg == 4132 )
{
coeff = lBarCofSC; // XiC+, XiC0
}
else if( pdg == 5122 || pdg == 5222 || pdg == 5112 || pdg == 5212 )
{
coeff = lBarCof1B; // LambdaB, SigmaB+, SigmaB-, SigmaB0
}
else if( pdg == 5332 )
{
coeff = lBarCof2SB; // OmegaB-
}
else if( pdg == 5132 || pdg == 5232 ) // XiB-, XiB0
{
coeff = lBarCofSB;
}
// heavy mesons Kaons?
static const G4double lMesCof1S = 0.82; // Kp/piP kaons?
static const G4double llMesCof1C = 0.676568;
static const G4double llMesCof1B = 0.610989;
static const G4double llMesCof2C = 0.353135;
static const G4double llMesCof2B = 0.221978;
static const G4double llMesCofSC = 0.496568;
static const G4double llMesCofSB = 0.430989;
static const G4double llMesCofCB = 0.287557;
static const G4double llMesCofEtaP = 0.88;
static const G4double llMesCofEta = 0.76;
if( pdg == 321 || pdg == 311 || pdg == 310 )
{
coeff = lMesCof1S; //K+-0
}
else if( pdg == 511 || pdg == 521 )
{
coeff = llMesCof1B; // BMeson0, BMeson+
}
else if(pdg == 421 || pdg == 411 )
{
coeff = llMesCof1C; // DMeson+, DMeson0
}
else if( pdg == 531 )
{
coeff = llMesCofSB; // BSMeson0
}
else if( pdg == 541 )
{
coeff = llMesCofCB; // BCMeson+-
}
else if(pdg == 431 )
{
coeff = llMesCofSC; // DSMeson+-
}
else if(pdg == 441 || pdg == 443 )
{
coeff = llMesCof2C; // Etac, JPsi
}
else if(pdg == 553 )
{
coeff = llMesCof2B; // Upsilon
}
else if(pdg == 221 )
{
coeff = llMesCofEta; // Eta
}
else if(pdg == 331 )
{
coeff = llMesCofEtaP; // Eta'
}
return coeff;
}