Import Geant4 10.5.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2018-06-29 10:58:11 +02:00
parent fe81a77428
commit 6aa23be517
1581 changed files with 124288 additions and 83758 deletions
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VCrossSectionDataSet.cc 98738 2016-08-09 12:53:25Z gcosmo $
// $Id: G4VCrossSectionDataSet.cc 110787 2018-06-14 06:43:31Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -52,7 +52,8 @@
#include "Randomize.hh"
G4VCrossSectionDataSet::G4VCrossSectionDataSet(const G4String& nam) :
verboseLevel(0),minKinEnergy(0.0),maxKinEnergy(100*TeV),name(nam)
verboseLevel(0),minKinEnergy(0.0),maxKinEnergy(100*TeV),
isForAllAtomsAndEnergies(false),name(nam)
{
registry = G4CrossSectionDataSetRegistry::Instance();
registry->Register(this);
@@ -85,7 +86,7 @@ G4VCrossSectionDataSet::ComputeCrossSection(const G4DynamicParticle* part,
const G4Element* elm,
const G4Material* mat)
{
G4int Z = G4lrint(elm->GetZ());
G4int Z = elm->GetZasInt();
if (IsElementApplicable(part, Z, mat)) {
return GetElementCrossSection(part, Z, mat);
@@ -97,35 +98,18 @@ G4VCrossSectionDataSet::ComputeCrossSection(const G4DynamicParticle* part,
G4int nIso = elm->GetNumberOfIsotopes();
G4double fact = 0.0;
G4double xsec = 0.0;
G4Isotope* iso = 0;
const G4Isotope* iso = nullptr;
if (0 < nIso) {
// user-defined isotope abundances
const G4IsotopeVector* isoVector = elm->GetIsotopeVector();
const G4double* abundVector = elm->GetRelativeAbundanceVector();
// user-defined isotope abundances
G4IsotopeVector* isoVector = elm->GetIsotopeVector();
G4double* abundVector = elm->GetRelativeAbundanceVector();
for (G4int j = 0; j<nIso; ++j) {
iso = (*isoVector)[j];
G4int A = iso->GetN();
if(abundVector[j] > 0.0 && IsIsoApplicable(part, Z, A, elm, mat)) {
fact += abundVector[j];
xsec += abundVector[j]*GetIsoCrossSection(part, Z, A, iso, elm, mat);
}
}
} else {
// natural isotope abundances
G4NistManager* nist = G4NistManager::Instance();
G4int n0 = nist->GetNistFirstIsotopeN(Z);
G4int nn = nist->GetNumberOfNistIsotopes(Z);
for (G4int A = n0; A < n0+nn; ++A) {
G4double abund = nist->GetIsotopeAbundance(Z, A);
if(abund > 0.0 && IsIsoApplicable(part, Z, A, elm, mat)) {
fact += abund;
xsec += abund*GetIsoCrossSection(part, Z, A, iso, elm, mat);
}
for (G4int j = 0; j<nIso; ++j) {
iso = (*isoVector)[j];
G4int A = iso->GetN();
if(abundVector[j] > 0.0 && IsIsoApplicable(part, Z, A, elm, mat)) {
fact += abundVector[j];
xsec += abundVector[j]*GetIsoCrossSection(part, Z, A, iso, elm, mat);
}
}
if(fact > 0.0) { xsec /= fact; }
@@ -165,22 +149,21 @@ G4VCrossSectionDataSet::GetIsoCrossSection(const G4DynamicParticle* dynPart,
"G4VCrossSectionDataSet::GetIsoCrossSection is absent");
}
G4Isotope*
const G4Isotope*
G4VCrossSectionDataSet::SelectIsotope(const G4Element* anElement, G4double)
{
G4int nIso = anElement->GetNumberOfIsotopes();
G4IsotopeVector* isoVector = anElement->GetIsotopeVector();
G4Isotope* iso = (*isoVector)[0];
const G4Isotope* iso = anElement->GetIsotope(0);
// more than 1 isotope
if(1 < nIso) {
G4double* abundVector = anElement->GetRelativeAbundanceVector();
const G4double* abundVector = anElement->GetRelativeAbundanceVector();
G4double sum = 0.0;
G4double q = G4UniformRand();
for (G4int j = 0; j<nIso; ++j) {
sum += abundVector[j];
if(q <= sum) {
iso = (*isoVector)[j];
iso = anElement->GetIsotope(j);
break;
}
}