Import Geant4 11.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2021-12-10 14:46:44 +01:00
committed by Ben Morgan
parent 6399a014b6
commit 80e2389dd8
3932 changed files with 202519 additions and 246221 deletions
@@ -113,10 +113,10 @@ G4Mutex G4EmCorrections::theCorrMutex = G4MUTEX_INITIALIZER;
G4EmCorrections::G4EmCorrections(G4int verb)
{
verbose = verb;
eth = 2.0*CLHEP::MeV;
eCorrMin = 25.*CLHEP::keV;
eCorrMax = 250.*CLHEP::MeV;
verbose = verb;
eth = 2.0*CLHEP::MeV;
eCorrMin = 25.*CLHEP::keV;
eCorrMax = 1.*CLHEP::GeV;
ionTable = G4ParticleTable::GetParticleTable()->GetIonTable();
g4calc = G4Pow::GetInstance();
@@ -776,7 +776,7 @@ G4EmCorrections::EffectiveChargeCorrection(const G4ParticleDefinition* p,
G4cout << "G4EmCorrections::EffectiveChargeCorrection: Zion= "
<< currentZ << " Aion= " << p->GetPDGMass()/amu_c2 << G4endl;
}
massFactor = proton_mass_c2/p->GetPDGMass();
massFactor = CLHEP::proton_mass_c2/p->GetPDGMass();
idx = -1;
for(G4int i=0; i<nIons; ++i) {
@@ -787,11 +787,13 @@ G4EmCorrections::EffectiveChargeCorrection(const G4ParticleDefinition* p,
}
//G4cout << " idx= " << idx << " dz= " << G4endl;
if(idx >= 0) {
if(!ionList[idx]) { BuildCorrectionVector(); }
if(ionList[idx]) { curVector = stopData[idx]; }
} else { return factor; }
if(nullptr == ionList[idx]) { BuildCorrectionVector(); }
curVector = stopData[idx];
} else {
return factor;
}
}
if(curVector) {
if(nullptr != curVector) {
factor = curVector->Value(ekin*massFactor);
if(verbose > 1) {
G4cout << "E= " << ekin << " factor= " << factor << " massfactor= "
@@ -830,71 +832,64 @@ void G4EmCorrections::AddStoppingData(G4int Z, G4int A,
void G4EmCorrections::BuildCorrectionVector()
{
if(!ionLEModel || !ionHEModel) {
if(nullptr == ionLEModel || nullptr == ionHEModel) {
return;
}
const G4ParticleDefinition* ion = curParticle;
const G4ParticleDefinition* gion = G4GenericIon::GenericIon();
G4int Z = Zion[idx];
if(currentZ != Z) {
ion = ionTable->GetIon(Z, Aion[idx], 0);
}
//G4cout << "BuildCorrectionVector: idx= " << idx << " Z= " << Z
// << " curZ= " << currentZ << G4endl;
G4double A = G4double(ion->GetBaryonNumber());
G4double A = Aion[idx];
G4PhysicsVector* v = stopData[idx];
const G4ParticleDefinition* p = G4GenericIon::GenericIon();
G4double massRatio = proton_mass_c2/ion->GetPDGMass();
if(verbose > 1) {
G4cout << "BuildCorrectionVector: Stopping for "
<< curParticle->GetParticleName() << " in "
<< materialName[idx] << " Ion Z= " << Z << " A= " << A
<< " massRatio= " << massRatio << G4endl;
<< " massFactor= " << massFactor << G4endl;
G4cout << " Nbins=" << nbinCorr << " Emin(MeV)=" << eCorrMin
<< " Emax(MeV)=" << eCorrMax << " ion: "
<< ion->GetParticleName() << G4endl;
}
G4PhysicsLogVector* vv =
new G4PhysicsLogVector(eCorrMin,eCorrMax,nbinCorr,true);
G4double e, eion, dedx, dedx1;
G4double eth0 = v->Energy(0);
G4double escal = eth/massRatio;
new G4PhysicsLogVector(eCorrMin,eCorrMax,nbinCorr,false);
const G4double eth0 = v->Energy(0);
const G4double escal = eth/massFactor;
G4double qe =
effCharge.EffectiveChargeSquareRatio(ion, curMaterial, escal);
G4double dedxt =
ionLEModel->ComputeDEDXPerVolume(curMaterial, p, eth, eth)*qe;
G4double dedx1t =
ionHEModel->ComputeDEDXPerVolume(curMaterial, p, eth, eth)*qe
effCharge.EffectiveChargeSquareRatio(curParticle, curMaterial, escal);
const G4double dedxt =
ionLEModel->ComputeDEDXPerVolume(curMaterial, gion, eth, eth)*qe;
const G4double dedx1t =
ionHEModel->ComputeDEDXPerVolume(curMaterial, gion, eth, eth)*qe
+ ComputeIonCorrections(curParticle, curMaterial, escal);
G4double rest = escal*(dedxt - dedx1t);
//G4cout << "Escal(MeV)= "<<escal<<" dedxt0= " <<dedxt
// << " dedxt1= " << dedx1t << G4endl;
const G4double rest = escal*(dedxt - dedx1t);
if(verbose > 1) {
G4cout << "Escal(MeV)= " << escal << " qe=" << qe
<< " dedxt= " << dedxt << " dedx1t= " << dedx1t << G4endl;
}
for(G4int i=0; i<=nbinCorr; ++i) {
e = vv->Energy(i);
escal = e/massRatio;
eion = escal/A;
if(eion <= eth0) {
dedx = v->Value(eth0)*std::sqrt(eion/eth0);
} else {
dedx = v->Value(eion);
}
qe = effCharge.EffectiveChargeSquareRatio(curParticle,curMaterial,escal);
if(e <= eth) {
dedx1 = ionLEModel->ComputeDEDXPerVolume(curMaterial, p, e, e)*qe;
} else {
dedx1 = ionHEModel->ComputeDEDXPerVolume(curMaterial, p, e, e)*qe +
ComputeIonCorrections(curParticle, curMaterial, escal) + rest/escal;
}
// energy in the local table (GenericIon)
G4double e = vv->Energy(i);
// energy of the real ion
G4double eion = e/massFactor;
// energy in the imput stopping data vector
G4double e1 = eion/A;
G4double dedx = (e1 < eth0)
? v->Value(eth0)*std::sqrt(e1/eth0) : v->Value(e1);
qe = effCharge.EffectiveChargeSquareRatio(curParticle, curMaterial, eion);
G4double dedx1 = (e <= eth)
? ionLEModel->ComputeDEDXPerVolume(curMaterial, gion, e, e)*qe
: ionHEModel->ComputeDEDXPerVolume(curMaterial, gion, e, e)*qe +
ComputeIonCorrections(curParticle, curMaterial, eion) + rest/eion;
vv->PutValue(i, dedx/dedx1);
if(verbose > 1) {
G4cout << " E(meV)= " << e/MeV << " Correction= " << dedx/dedx1
<< " " << dedx << " " << dedx1
<< " massF= " << massFactor << G4endl;
G4cout << "E(MeV)=" << e/CLHEP::MeV << " Eion=" << eion/CLHEP::MeV
<< " e1=" << e1 << " dedxRatio= " << dedx/dedx1
<< " dedx=" << dedx << " dedx1=" << dedx1
<< " qe=" << qe << " rest/eion=" << rest/eion << G4endl;
}
}
vv->FillSecondDerivatives();
delete v;
ionList[idx] = ion;
stopData[idx] = vv;
@@ -981,9 +976,8 @@ void G4EmCorrections::Initialise()
{ 9.0, 0.0032},
{ 10.0, 0.0025} };
sBarkasCorr = new G4PhysicsFreeVector(47, 0.02, 10., true);
sBarkasCorr = new G4PhysicsFreeVector(47, false);
for(i=0; i<47; ++i) { sBarkasCorr->PutValues(i, fTable[i][0], fTable[i][1]); }
sBarkasCorr->FillSecondDerivatives();
static const G4double SK[20] = {1.9477, 1.9232, 1.8996, 1.8550, 1.8137,
1.7754, 1.7396, 1.7223, 1.7063, 1.6752,
@@ -1327,12 +1321,10 @@ void G4EmCorrections::Initialise()
0.58191, 0.5869, 0.59189, 0.60062, 0.60686, 0.61435, 0.61809, 0.62183, 0.62931, 0.6343,
0.6368, 0.64054, 0.64304, 0.64428, 0.64678};
sThetaK = new G4PhysicsFreeVector(34, xzk[0], xzk[33], true);
sThetaL = new G4PhysicsFreeVector(36, xzl[0], xzl[35], true);
sThetaK = new G4PhysicsFreeVector(34, false);
for(i=0; i<34; ++i) { sThetaK->PutValues(i, xzk[i], yzk[i]); }
sThetaL = new G4PhysicsFreeVector(36, false);
for(i=0; i<36; ++i) { sThetaL->PutValues(i, xzl[i], yzl[i]); }
sThetaK->FillSecondDerivatives();
sThetaL->FillSecondDerivatives();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....