Import Geant4 11.3.1 source tree

This commit is contained in:
Gabriele Cosmo
2025-03-24 16:45:22 +01:00
parent 32390e802b
commit df176550b3
388 changed files with 29491 additions and 29435 deletions
@@ -64,10 +64,16 @@ G4AugerTransition::~G4AugerTransition()
const std::vector<G4int>* G4AugerTransition::AugerOriginatingShellIds(G4int startShellId) const
{
auto shellId = augerOriginatingShellIdsMap.find(startShellId);
if (shellId == augerOriginatingShellIdsMap.end())
{
G4Exception("G4AugerTransition::AugerOriginatingShellIds()",
"em2199",JustWarning,"Error: no Auger ID found");
return nullptr;
}
const std::vector<G4int>* dataSet = &(*shellId).second;
if (dataSet->empty())
G4cout << "Error: no auger Id found"<< G4endl;
G4Exception("G4AugerTransition::AugerOriginatingShellIds()",
"em2198",JustWarning,"Error: no Auger ID found");
return dataSet;
}
@@ -157,13 +157,15 @@ G4double G4FluoData::StartShellEnergy(G4int initIndex, G4int vacancyIndex) const
else
{
auto pos = energyMap.find(vacancyIndex);
G4DataVector dataSet = *((*pos).second);
G4int nData = (G4int)dataSet.size();
if (initIndex >= 0 && initIndex < nData)
if (pos != energyMap.end())
{
n = dataSet[initIndex];
G4DataVector dataSet = *((*pos).second);
G4int nData = (G4int)dataSet.size();
if (initIndex >= 0 && initIndex < nData)
{
n = dataSet[initIndex];
}
}
}
return n;
@@ -184,13 +186,15 @@ G4double G4FluoData::StartShellProb(G4int initIndex, G4int vacancyIndex) const
else
{
auto pos = probabilityMap.find(vacancyIndex);
G4DataVector dataSet = *((*pos).second);
G4int nData = (G4int)dataSet.size();
if (initIndex >= 0 && initIndex < nData)
if (pos != probabilityMap.end())
{
n = dataSet[initIndex];
G4DataVector dataSet = *((*pos).second);
G4int nData = (G4int)dataSet.size();
if (initIndex >= 0 && initIndex < nData)
{
n = dataSet[initIndex];
}
}
}
return n;
@@ -497,7 +497,8 @@ G4double G4PenelopeBremsstrahlungAngular::CalculateEffectiveZ(const G4Material*
}
//Normalize
for (G4int i=0;i<nElements;++i)
(*StechiometricFactors)[i] /= MaxStechiometricFactor;
if (MaxStechiometricFactor > 0.)
(*StechiometricFactors)[i] /= MaxStechiometricFactor;
G4double sumz2 = 0;
G4double sums = 0;
@@ -509,7 +510,7 @@ G4double G4PenelopeBremsstrahlungAngular::CalculateEffectiveZ(const G4Material*
}
delete StechiometricFactors;
G4double ZBR = std::sqrt(sumz2/sums);
G4double ZBR = (sums > 0.) ? std::sqrt(sumz2/sums) : 0.;
fEffectiveZSq->insert(std::make_pair(material,ZBR));
return ZBR;
@@ -232,7 +232,8 @@ void G4PenelopeBremsstrahlungFS::BuildScaledXSTable(const G4Material* material,
}
//Normalize
for (std::size_t i=0;i<nElements;i++)
(*StechiometricFactors)[i] /= MaxStechiometricFactor;
if (MaxStechiometricFactor > 0.)
(*StechiometricFactors)[i] /= MaxStechiometricFactor;
G4double sumz2 = 0;
G4double sums = 0;
@@ -604,14 +605,14 @@ G4double G4PenelopeBremsstrahlungFS::SampleGammaEnergy(G4double energy,const G4M
const G4double cut) const
{
std::pair<const G4Material*,G4double> theKey = std::make_pair(mat,cut);
if (!(fSamplingTable->count(theKey)) || !(fPBcut->count(theKey)))
if (!(fSamplingTable->count(theKey)) || !(fPBcut->count(theKey)) ||
!(fReducedXSTable->count(theKey)))
{
G4ExceptionDescription ed;
ed << "Unable to retrieve the SamplingTable: " <<
fSamplingTable->count(theKey) << " " <<
fPBcut->count(theKey) << G4endl;
ed << "Unable to retrieve the SamplingTable for " << mat->GetName() << G4endl;
G4Exception("G4PenelopeBremsstrahlungFS::SampleGammaEnergy()",
"em2014",FatalException,ed);
return 0.;
}
const G4PhysicsTable* theTableInte = fSamplingTable->find(theKey)->second;
const G4PhysicsTable* theTableRed = fReducedXSTable->find(theKey)->second;
@@ -257,7 +257,8 @@ G4double G4PenelopeBremsstrahlungModel::CrossSectionPerVolume(const G4Material*
{
G4cout << "G4PenelopeBremsstrahlungModel " << G4endl;
G4cout << "Mean free path for gamma emission > " << cutEnergy/keV << " keV at " <<
energy/keV << " keV = " << (1./crossPerVolume)/mm << " mm" << G4endl;
energy/keV << " keV = " <<
(crossPerVolume? (1./crossPerVolume)/mm : DBL_MAX) << " mm" << G4endl;
}
return crossPerVolume;
@@ -236,7 +236,8 @@ G4double G4PenelopeComptonModel::CrossSectionPerVolume(const G4Material* materia
if (fVerboseLevel > 2)
G4cout << "Compton mean free path at " << energy/keV << " keV for material " <<
material->GetName() << " = " << (1./csvolume)/mm << " mm" << G4endl;
material->GetName() << " = " <<
(csvolume ? (1./csvolume)/mm : DBL_MAX) << " mm" << G4endl;
return csvolume;
}
@@ -323,11 +323,13 @@ G4double G4PenelopeIonisationModel::CrossSectionPerVolume(const G4Material* mate
{
G4cout << "G4PenelopeIonisationModel " << G4endl;
G4cout << "Mean free path for delta emission > " << cutEnergy/keV << " keV at " <<
energy/keV << " keV = " << (1./crossPerVolume)/mm << " mm" << G4endl;
energy/keV << " keV = " <<
(crossPerVolume ? (1./crossPerVolume)/mm : DBL_MAX) << " mm" << G4endl;
if (theXS)
totalCross = (theXS->GetTotalCrossSection(energy))*moleculeDensity;
G4cout << "Total free path for ionisation (no threshold) at " <<
energy/keV << " keV = " << (1./totalCross)/mm << " mm" << G4endl;
energy/keV << " keV = " <<
(totalCross ? (1./totalCross)/mm : DBL_MAX) << " mm" << G4endl;
}
return crossPerVolume;
}
@@ -493,7 +493,8 @@ G4double G4PenelopeRayleighModelMI::CrossSectionPerVolume(const G4Material* mate
MaxStoichiometricFactor = (*StoichiometricFactors)[i];
}
for (std::size_t i=0;i<nElements;++i) {
(*StoichiometricFactors)[i] /= MaxStoichiometricFactor;
if (MaxStoichiometricFactor > 0.)
(*StoichiometricFactors)[i] /= MaxStoichiometricFactor;
}
//Equivalent atoms per molecule
@@ -192,31 +192,38 @@ void G4ShellData::PrintData() const
auto posId = idMap.find(Z);
std::vector<G4double>* ids = (*posId).second;
auto posE = bindingMap.find(Z);
G4DataVector* energies = (*posE).second;
for (G4int i=0; i<nSh; ++i)
if (posE != bindingMap.end())
{
G4int id = (G4int) (*ids)[i];
G4double e = (*energies)[i] / keV;
G4cout << i << ") ";
G4DataVector* energies = (*posE).second;
for (G4int i=0; i<nSh; ++i)
{
G4int id = (G4int) (*ids)[i];
G4double e = (*energies)[i] / keV;
G4cout << i << ") ";
if (occupancyData)
{
G4cout << " Occupancy: ";
if (occupancyData)
{
G4cout << " Occupancy: ";
}
else
{
G4cout << " Shell id: ";
}
G4cout << id << " - Binding energy = "
<< e << " keV ";
if (occupancyData)
{
auto posOcc = occupancyPdfMap.find(Z);
G4double prob = 0.;
if (posOcc != occupancyPdfMap.end())
{
std::vector<G4double> probs = *((*posOcc).second);
prob = probs[i];
}
G4cout << "- Probability = " << prob;
}
G4cout << G4endl;
}
else
{
G4cout << " Shell id: ";
}
G4cout << id << " - Binding energy = "
<< e << " keV ";
if (occupancyData)
{
auto posOcc = occupancyPdfMap.find(Z);
std::vector<G4double> probs = *((*posOcc).second);
G4double prob = probs[i];
G4cout << "- Probability = " << prob;
}
G4cout << G4endl;
}
G4cout << "-------------------------------------------------"
<< G4endl;