Import Geant4 11.3.0 source tree

This commit is contained in:
Gabriele Cosmo
2024-12-06 11:11:40 +01:00
parent e58e650b32
commit 32390e802b
1984 changed files with 98713 additions and 83996 deletions
@@ -285,7 +285,7 @@ void G4AtomicTransitionManager::Initialise()
// Selection of fluorescence files
G4String defaultDirectory = "/fluor";
const G4String& defaultDirectory = "/fluor";
G4String fluoDirectory = defaultDirectory;
G4String bindingDirectory = defaultDirectory;
G4EmFluoDirectory fdir = G4EmParameters::Instance()->FluoDirectory();
@@ -325,12 +325,12 @@ void G4AtomicTransitionManager::Initialise()
G4AtomicShell * shell = new G4AtomicShell(shellId,bindingEnergy);
vectorOfShells.push_back(shell);
}
shellTable[Z] = vectorOfShells;
shellTable[Z] = std::move(vectorOfShells);
}
// Fills transitionTable with the data on identities, transition
// energies and transition probabilities
G4String dir = fluoDirectory;
G4String dir = std::move(fluoDirectory);
for (G4int Znum= infTableLimit; Znum<=supTableLimit; ++Znum)
{
if (Znum == zLim) { dir = defaultDirectory; }
@@ -368,7 +368,7 @@ void G4AtomicTransitionManager::Initialise()
vectorOfEnergies,vectorOfProbabilities);
vectorOfTransitions.push_back(transition);
}
transitionTable[Znum] = vectorOfTransitions;
transitionTable[Znum] = std::move(vectorOfTransitions);
delete fluoManager;
}
delete shellManager;
@@ -294,7 +294,7 @@ std::vector<G4AugerTransition> G4AugerData::LoadData(G4int Z)
(*newEnergyMap)[augerShellId] = *transEnergies;
(*newProbabilityMap)[augerShellId] = *transProbabilities;
augerTransitionVector.push_back(G4AugerTransition(vacId, identifiers,
augerTransitionVector.push_back(G4AugerTransition(vacId, std::move(identifiers),
newIdMap, newEnergyMap, newProbabilityMap));
// Now deleting all the variables I used, and creating new ones for the next shell
delete newIdMap;
@@ -50,7 +50,7 @@ G4AugerTransition::G4AugerTransition(G4int finalShell, std::vector<G4int> transI
augerOriginatingShellIdsMap = *idMap;
augerTransitionEnergiesMap = *energyMap;
augerTransitionProbabilitiesMap = *probabilityMap;
transitionOriginatingShellIds = transIds;
transitionOriginatingShellIds = std::move(transIds);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -125,25 +125,22 @@ G4int G4FluoData::StartShellId(G4int initIndex, G4int vacancyIndex) const
{
G4int n = -1;
if (vacancyIndex<0 || vacancyIndex>=numberOfVacancies)
{
G4Exception("G4FluoData::StartShellId()","de0002",FatalErrorInArgument,
"vacancyIndex outside boundaries");
}
else
{
auto pos = idMap.find(vacancyIndex);
G4DataVector dataSet = *((*pos).second);
if (vacancyIndex<0 || vacancyIndex>=numberOfVacancies) {
G4Exception("G4FluoData::StartShellId()","de0002",FatalErrorInArgument,
"vacancyIndex outside boundaries");
} else {
auto pos = idMap.find(vacancyIndex);
if (pos != idMap.end()) {
G4DataVector* dataSet = (*pos).second;
G4int nData = (G4int)dataSet.size();
G4int nData = (G4int)dataSet->size();
// The first Element of idMap's dataSets is the original shell of
// the vacancy, so we must start from the first element of dataSet
if (initIndex >= 0 && initIndex < nData)
{
n = dataSet[initIndex+1];
}
if (initIndex >= 0 && initIndex < nData) {
n = (*dataSet)[initIndex+1];
}
}
}
return n;
}
@@ -256,8 +256,10 @@ G4double G4MicroElecCapture::GetMeanFreePath(const G4Track& aTrack, G4double,
{
G4String material = aTrack.GetMaterial()->GetName();
// test particle type in order to applied the capture to both electrons, protons and heavy ions
if ((aTrack.GetParticleDefinition()->GetParticleName()) == "e-")
G4double mfp = DBL_MAX;
G4double ekin = aTrack.GetKineticEnergy();
if (ekin < 500*eV && aTrack.GetParticleDefinition()->GetParticleName() == "e-")
{
if (material != "G4_ALUMINUM_OXIDE" && material != "G4_SILICON_DIOXIDE"
&& material != "G4_BORON_NITRIDE")
@@ -282,12 +284,11 @@ G4double G4MicroElecCapture::GetMeanFreePath(const G4Track& aTrack, G4double,
y = 1 * (1 / eV);
}
G4double P = S * G4Exp(-y * aTrack.GetKineticEnergy());
if (P <= 0) { return DBL_MAX; }
else { return 1 / P; }
// VI: added numerical protection against extrime value of G4Exp argument
y *= ekin;
if (S > 0.0 && y < 100.0) { mfp = G4Exp(y) / S; }
}
else return DBL_MAX;
return mfp;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -1308,6 +1308,11 @@ G4int G4MicroElecInelasticModel_new::RandomSelect(G4double k, const G4String& pa
TCSMap::iterator tablepos;
tablepos = tableTCS.find(currentMaterial);
if (tablepos == tableTCS.end()) {
G4Exception("G4MicroElecInelasticModel_new::RandomSelect","em0002",FatalException,"Model not applicable to material");
return level;
}
MapData* tableData = tablepos->second;
std::map< G4String,G4MicroElecCrossSectionDataSet_new*,std::less<G4String> >::iterator pos;
@@ -338,21 +338,27 @@ G4ThreeVector& G4PenelopeBremsstrahlungAngular::SampleDirection(const G4DynamicP
//Retrieve the effective Z
G4double Zmat = 0;
if (!fEffectiveZSq)
//The model might be initialized incorrectly, if the angular generator is not used with the
//G4PenelopeBremsstrahungModel: make sure it works also with other models.
if (!fEffectiveZSq)
{
G4Exception("G4PenelopeBremsstrahlungAngular::SampleDirection()",
"em2040",FatalException,"EffectiveZ table not available");
return fLocalDirection;
}
"em2040",JustWarning,"EffectiveZSq table does not exist: create it");
PrepareTables(material,false);
//return fLocalDirection;
}
//found in the table: return it
if (fEffectiveZSq->count(material))
Zmat = fEffectiveZSq->find(material)->second;
else
{
else //this can happen in unit tests or when the AngModel is coupled with bremsstrahlunh
//models other than G4PenelopeBremsstrahungModel
{
G4Exception("G4PenelopeBremsstrahlungAngular::SampleDirection()",
"em2040",FatalException,"Material not found in the effectiveZ table");
return fLocalDirection;
"em2040",JustWarning,"Material not found in the effectiveZ table");
PrepareTables(material,false);
Zmat = fEffectiveZSq->find(material)->second;
// return fLocalDirection;
}
if (fVerbosityLevel > 0)
@@ -497,11 +497,11 @@ G4double G4PenelopeRayleighModelMI::CrossSectionPerVolume(const G4Material* mate
}
//Equivalent atoms per molecule
G4double atPerMol = 0;
G4double atPerMol = 0.;
for (std::size_t i=0;i<nElements;++i)
atPerMol += (*StoichiometricFactors)[i];
G4double moleculeDensity = 0.;
if (atPerMol) moleculeDensity = atomDensity/atPerMol;
if (atPerMol != 0.) moleculeDensity = atomDensity/atPerMol;
if (fVerboseLevel > 2)
G4cout << "Material " << material->GetName() << " has " << atPerMol << " atoms "
@@ -194,7 +194,8 @@ void G4UAtomicDeexcitation::GenerateParticles(
G4int givenShellId = atomicShell->ShellId();
minGammaEnergy = gammaCut;
minElectronEnergy = eCut;
vacancyArray.clear();
// generation secondaries
G4DynamicParticle* aParticle=0;
G4int provShellId = 0;
@@ -217,8 +217,10 @@ G4double G4hIonEffChargeSquare::IonEffChargeSquare(
else if(iz > 91) iz =91 ;
vF += vFermi[iz] * weight ;
}
z /= norm ;
vF /= norm ;
if (norm > 0.0) {
z /= norm ;
vF /= norm ;
}
}
// Helium ion case
@@ -239,7 +241,11 @@ G4double G4hIonEffChargeSquare::IonEffChargeSquare(
} else {
// v1 is ion velocity in vF unit
G4double v1 = std::sqrt( reducedEnergy / (25.0 * keV) )/ vF ;
G4double v1{0.0}, v2{0.0};
if (vF > 0.0) {
v1 = std::sqrt( reducedEnergy / (25.0 * keV) )/ vF;
v2 = 1.0/ (vF*vF);
}
G4double y ;
G4double z13 = std::pow(ionCharge, 0.3333) ;
@@ -266,7 +272,7 @@ G4double G4hIonEffChargeSquare::IonEffChargeSquare(
G4double lambda = 10.0 * vF * std::pow(1.0-q, 0.6667) / (z13 * (6.0 + q)) ;
G4double qeff = ionCharge * sLocal *
( q + 0.5*(1.0-q) * std::log(1.0 + lambda*lambda) / (vF*vF) ) ;
( q + 0.5*(1.0-q) * std::log(1.0 + lambda*lambda) * v2) ;
if( 0.1 > qeff ) qeff = 0.1 ;
return qeff*qeff ;
}
@@ -86,10 +86,10 @@ void G4hParametrisedLossModel::InitializeMe()
theZieglerFactor = eV*cm2*1.0e-15 ;
// Registration of parametrisation models
G4String blank = G4String(" ") ;
G4String ir49p = G4String("ICRU_R49p") ;
G4String ir49He = G4String("ICRU_R49He") ;
G4String zi85p = G4String("Ziegler1985p") ;
const G4String& blank(" ");
const G4String& ir49p("ICRU_R49p");
const G4String& ir49He("ICRU_R49He");
const G4String& zi85p("Ziegler1985p");
if(zi85p == modelName) {
eStopingPowerTable = new G4hZiegler1985p();
highEnergyLimit = 100.0*MeV;
@@ -266,7 +266,9 @@ G4double G4hParametrisedLossModel::StoppingPower(const G4Material* material,
}
// Chemical factor is taken into account
eloss *= ChemicalFactor(kineticEnergy, eloss125) ;
if (eloss125 > 0.0) {
eloss *= ChemicalFactor(kineticEnergy, eloss125);
}
// Brugg's rule calculation
} else {