Import Geant4 11.0.1 source tree

This commit is contained in:
Gabriele Cosmo
2022-03-23 08:25:50 +01:00
parent 84f33a068c
commit de4f28d823
234 changed files with 61815 additions and 61766 deletions
@@ -120,7 +120,9 @@ G4MicroElecInelasticModel_new::G4MicroElecInelasticModel_new(
// default generator
SetAngularDistribution(new G4DeltaAngle());
// Selection of computation method
fasterCode = true;
SEFromFermiLevel = false;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -687,23 +689,26 @@ void G4MicroElecInelasticModel_new::SampleSecondaries(std::vector<G4DynamicParti
G4int shellEnum = currentMaterialStructure->GetEADL_Enumerator(Shell);
if (currentMaterialStructure->IsShellWeaklyBound(Shell)) { shellEnum = -1; }
if(fAtomDeexcitation && shellEnum >=0) {
// G4cout << "enter if deex and shell 0" << G4endl;
G4AtomicShellEnumerator as = G4AtomicShellEnumerator(shellEnum);
const G4AtomicShell* shell = fAtomDeexcitation->GetAtomicShell(Z, as);
secNumberInit = fvect->size();
fAtomDeexcitation->GenerateParticles(fvect, shell, Z, 0, 0);
secNumberFinal = fvect->size();
}
if(fAtomDeexcitation && shellEnum >=0)
{
// G4cout << "enter if deex and shell 0" << G4endl;
G4AtomicShellEnumerator as = G4AtomicShellEnumerator(shellEnum);
const G4AtomicShell* shell = fAtomDeexcitation->GetAtomicShell(Z, as);
secNumberInit = fvect->size();
fAtomDeexcitation->GenerateParticles(fvect, shell, Z, 0, 0);
secNumberFinal = fvect->size();
}
G4double secondaryKinetic=-1000*eV;
SEFromFermiLevel = false;
if (!fasterCode)
{
secondaryKinetic = RandomizeEjectedElectronEnergy(PartDef, k, Shell, originalMass, originalZ);
}
else {
secondaryKinetic = RandomizeEjectedElectronEnergyFromCumulatedDcs(PartDef, k, Shell) ;
}
else
{
secondaryKinetic = RandomizeEjectedElectronEnergyFromCumulatedDcs(PartDef, k, Shell) ;
}
if (verboseLevel > 3)
{
@@ -731,17 +736,18 @@ void G4MicroElecInelasticModel_new::SampleSecondaries(std::vector<G4DynamicParti
G4ThreeVector direction;
direction.set(finalPx,finalPy,finalPz);
fParticleChangeForGamma->ProposeMomentumDirection(direction.unit()) ;
fParticleChangeForGamma->ProposeMomentumDirection(direction.unit());
}
else fParticleChangeForGamma->ProposeMomentumDirection(primaryDirection) ;
else fParticleChangeForGamma->ProposeMomentumDirection(primaryDirection);
// note that secondaryKinetic is the energy of the delta ray, not of all secondaries.
G4double deexSecEnergy = 0;
for (G4int j=secNumberInit; j < secNumberFinal; j++) {
deexSecEnergy = deexSecEnergy + (*fvect)[j]->GetKineticEnergy();}
fParticleChangeForGamma->SetProposedKineticEnergy(ekin - secondaryKinetic-limitEnergy); //Ef = Ei-(Q-El)-El = Ei-Q
fParticleChangeForGamma->ProposeLocalEnergyDeposit(limitEnergy-deexSecEnergy);
for (G4int j=secNumberInit; j < secNumberFinal; ++j) {
deexSecEnergy = deexSecEnergy + (*fvect)[j]->GetKineticEnergy();
}
if (SEFromFermiLevel) limitEnergy = currentMaterialStructure->GetEnergyGap();
fParticleChangeForGamma->SetProposedKineticEnergy(ekin - secondaryKinetic - limitEnergy); //Ef = Ei-(Q-El)-El = Ei-Q
fParticleChangeForGamma->ProposeLocalEnergyDeposit(limitEnergy - deexSecEnergy);
if (secondaryKinetic>0)
{
@@ -837,8 +843,11 @@ G4double G4MicroElecInelasticModel_new::RandomizeEjectedElectronEnergyFromCumula
secondaryElectronKineticEnergy = TransferedEnergy(particleDefinition, k, shell, random)
- currentMaterialStructure->GetLimitEnergy(shell) ;
if (isnan(secondaryElectronKineticEnergy)) { secondaryElectronKineticEnergy = k - currentMaterialStructure->GetLimitEnergy(shell); }
if (secondaryElectronKineticEnergy < 0.) {
secondaryElectronKineticEnergy = 0.;
secondaryElectronKineticEnergy = k - currentMaterialStructure->GetEnergyGap();
SEFromFermiLevel = true;
}
return secondaryElectronKineticEnergy;
}
@@ -1252,12 +1261,35 @@ G4double G4MicroElecInelasticModel_new::Interpolate(G4double e1,
G4double xs1,
G4double xs2)
{
G4double a = (std::log10(xs2)-std::log10(xs1)) / (std::log10(e2)-std::log10(e1));
G4double b = std::log10(xs2) - a*std::log10(e2);
G4double sigma = a*std::log10(e) + b;
G4double value = (std::pow(10.,sigma));
G4double value = 0.;
// Log-log interpolation by default
if (e1 != 0 && e2 != 0 && (e2-e1) != 0 && !fasterCode)
{
G4double a = std::log(xs2/xs1)/ std::log(e2/e1);
G4double b = std::log(xs2) - a * std::log(e2);
G4double sigma = a * std::log(e) + b;
value = (std::exp(sigma));
}
// Switch to log-lin interpolation for faster code
if ((e2 - e1) != 0 && xs1 != 0 && xs2 != 0 && fasterCode)
{
G4double d1 = std::log(xs1);
G4double d2 = std::log(xs2);
value = std::exp((d1 + (d2 - d1) * (e - e1) / (e2 - e1)));
}
// Switch to lin-lin interpolation for faster code
// in case one of xs1 or xs2 (=cum proba) value is zero
if ((e2 - e1) != 0 && (xs1 == 0 || xs2 == 0) && fasterCode)
{
G4double d1 = xs1;
G4double d2 = xs2;
value = (d1 + (d2 - d1) * (e - e1) / (e2 - e1));
}
return value;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -352,11 +352,6 @@ void G4PenelopeRayleighModel::BuildFormFactorTable(const G4Material* material)
for (G4int i=0;i<nElements;i++)
(*StechiometricFactors)[i] /= MaxStechiometricFactor;
// Equivalent atoms per molecule
G4double atomsPerMolecule = 0;
for (G4int i=0;i<nElements;i++)
atomsPerMolecule += (*StechiometricFactors)[i];
/*
CREATE THE FORM FACTOR TABLE
*/
@@ -574,11 +574,6 @@ void G4PenelopeRayleighModelMI::BuildFormFactorTable(const G4Material* material)
for (G4int i=0;i<nElements;i++)
(*StoichiometricFactors)[i] /= MaxStoichiometricFactor;
//Equivalent atoms per molecule
G4double atomsPerMolecule = 0;
for (G4int i=0;i<nElements;i++)
atomsPerMolecule += (*StoichiometricFactors)[i];
//Equivalent molecular weight (dimensionless)
G4double MolWeight = 0.;
for (G4int i=0;i<nElements;i++)
@@ -184,18 +184,6 @@ G4double G4hIonEffChargeSquare::IonEffChargeSquare(
0.66401, 0.84912, 0.88433, 0.80746, 0.43357, 0.41923, 0.43638, 0.51464, 0.73087, 0.81065,
1.9578, 1.0257} ;
static const G4double lFactor[92] = {
1.0, 1.0, 1.1, 1.06, 1.01, 1.03, 1.04, 0.99, 0.95, 0.9,
0.82, 0.81, 0.83, 0.88, 1.0, 0.95, 0.97, 0.99, 0.98, 0.97,
0.98, 0.97, 0.96, 0.93, 0.91, 0.9, 0.88, 0.9, 0.9, 0.9,
0.9, 0.85, 0.9, 0.9, 0.91, 0.92, 0.9, 0.9, 0.9, 0.9,
0.9, 0.88, 0.9, 0.88, 0.88, 0.9, 0.9, 0.88, 0.9, 0.9,
0.9, 0.9, 0.96, 1.2, 0.9, 0.88, 0.88, 0.85, 0.9, 0.9,
0.92, 0.95, 0.99, 1.03, 1.05, 1.07, 1.08, 1.1, 1.08, 1.08,
1.08, 1.08, 1.09, 1.09, 1.1, 1.11, 1.12, 1.13, 1.14, 1.15,
1.17, 1.2, 1.18, 1.17, 1.17, 1.16, 1.16, 1.16, 1.16, 1.16,
1.16, 1.16} ;
static const G4double c[6] = {0.2865, 0.1266, -0.001429,
0.02402,-0.01135, 0.001475} ;
@@ -207,7 +195,7 @@ G4double G4hIonEffChargeSquare::IonEffChargeSquare(
// loop for the elements in the material
// to find out average values Z, vF, lF
G4double z = 0.0, vF = 0.0, lF = 0.0, norm = 0.0 ;
G4double z = 0.0, vF = 0.0, norm = 0.0 ;
if( 1 == NumberOfElements ) {
z = material->GetZ() ;
@@ -215,7 +203,6 @@ G4double G4hIonEffChargeSquare::IonEffChargeSquare(
if(iz < 0) iz = 0 ;
else if(iz > 91) iz = 91 ;
vF = vFermi[iz] ;
lF = lFactor[iz] ;
} else {
for (G4int iel=0; iel<NumberOfElements; iel++)
@@ -229,11 +216,9 @@ G4double G4hIonEffChargeSquare::IonEffChargeSquare(
if(iz < 0) iz = 0 ;
else if(iz > 91) iz =91 ;
vF += vFermi[iz] * weight ;
lF += lFactor[iz] * weight ;
}
z /= norm ;
vF /= norm ;
lF /= norm ;
}
// Helium ion case