Import Geant4 11.1.0.beta source tree
This commit is contained in:
@@ -23,7 +23,6 @@ CPPFLAGS += -I$(G4BASE)/global/management/include \
|
||||
-I$(G4BASE)/particles/hadrons/mesons/include \
|
||||
-I$(G4BASE)/particles/hadrons/barions/include \
|
||||
-I$(G4BASE)/particles/hadrons/ions/include \
|
||||
-I$(G4BASE)/processes/cuts/include \
|
||||
-I$(G4BASE)/processes/management/include \
|
||||
-I$(G4BASE)/processes/hadronic/management/include/ \
|
||||
-I$(G4BASE)/processes/hadronic/util/include \
|
||||
|
||||
@@ -1,23 +1,18 @@
|
||||
-------------------------------------------------------------------
|
||||
# Category hadr-cross History
|
||||
|
||||
==========================================================
|
||||
Geant4 - an Object-Oriented Toolkit for Physics Simulation
|
||||
==========================================================
|
||||
See `CONTRIBUTING.rst` for details of **required** info/format for each entry,
|
||||
which **must** added in reverse chronological order (newest at the top). It must **not**
|
||||
be used as a substitute for writing good git commit messages!
|
||||
|
||||
History file for hadronic/cross_sections directory
|
||||
--------------------------------------------------
|
||||
|
||||
This file should be used to summarize modifications introduced in the
|
||||
code and to keep track of all tags.
|
||||
## 2022-05-08 Vladimir Ivanchenko (hadr-cross-V11-00-03)
|
||||
- G4CrossSectionDataStore, G4VCrossSectionDataSet - preparation
|
||||
for integral method, removed unused methods
|
||||
|
||||
---------------------------------------------------------------
|
||||
* Please list in reverse chronological order (last date on top)
|
||||
---------------------------------------------------------------
|
||||
|
||||
04 February 2022 - Vladimir Ivanchenko (hadr-cross-V10-07-23)
|
||||
## 2022-01-03 Vladimir Ivanchenko (hadr-cross-V11-00-02)
|
||||
- G4HadronNucleonXsc - fixed compilation warning on unused variable
|
||||
|
||||
03 January 2022 - Alberto Ribon (hadr-cross-V10-07-22)
|
||||
## 2022-01-03 Alberto Ribon (hadr-cross-V11-00-01)
|
||||
- G4ComponentAntiNuclNuclearXS : extension, by Vladimir Uzhinsky, of
|
||||
the class to compute the cross sections of light anti-nuclei on
|
||||
hydrogen. This relies on the isospin symmetry assumption, according
|
||||
@@ -25,6 +20,13 @@ code and to keep track of all tags.
|
||||
light nuclei are equivalent to those between light anti-nuclei and
|
||||
hydrogen.
|
||||
|
||||
## 2021-12-10 Ben Morgan (hadr-cross-V11-00-00)
|
||||
- Change to new Markdown History format
|
||||
|
||||
---
|
||||
|
||||
# History entries prior to 11.0
|
||||
|
||||
21 October 2021 - Alberto Ribon (hadr-cross-V10-07-21)
|
||||
- G4IonsShenCrossSection : reintroduced this (old) ion-ion cross section
|
||||
(that was removed in 10.7.ref03), as required by Vladimir Uzhinsky
|
||||
|
||||
@@ -64,17 +64,17 @@ public:
|
||||
|
||||
G4CrossSectionDataStore();
|
||||
|
||||
~G4CrossSectionDataStore();
|
||||
~G4CrossSectionDataStore() = default;
|
||||
|
||||
// Cross section per unit volume is computed (inverse mean free path)
|
||||
G4double GetCrossSection(const G4DynamicParticle*, const G4Material*);
|
||||
// Run time cross section per unit volume
|
||||
inline G4double GetCrossSection(const G4DynamicParticle*, const G4Material*);
|
||||
G4double ComputeCrossSection(const G4DynamicParticle*, const G4Material*);
|
||||
|
||||
// Cross section per element is computed
|
||||
// Cross section per element
|
||||
G4double GetCrossSection(const G4DynamicParticle*,
|
||||
const G4Element*, const G4Material*);
|
||||
|
||||
// Cross section per isotope is computed
|
||||
// Cross section per isotope
|
||||
G4double GetCrossSection(const G4DynamicParticle*, G4int Z, G4int A,
|
||||
const G4Isotope*,
|
||||
const G4Element*, const G4Material*);
|
||||
@@ -94,35 +94,34 @@ public:
|
||||
void PrintCrossSectionHtml(const G4VCrossSectionDataSet *cs) const;
|
||||
|
||||
void AddDataSet(G4VCrossSectionDataSet*);
|
||||
void AddDataSet(G4VCrossSectionDataSet*,size_t);
|
||||
void AddDataSet(G4VCrossSectionDataSet*, size_t);
|
||||
|
||||
inline void SetVerboseLevel(G4int value);
|
||||
|
||||
G4CrossSectionDataStore & operator=
|
||||
(const G4CrossSectionDataStore &right) = delete;
|
||||
G4CrossSectionDataStore(const G4CrossSectionDataStore&) = delete;
|
||||
|
||||
private:
|
||||
|
||||
G4double GetIsoCrossSection(const G4DynamicParticle*, G4int Z, G4int A,
|
||||
const G4Isotope*,
|
||||
const G4Element*, const G4Material* aMaterial,
|
||||
G4int index);
|
||||
|
||||
G4CrossSectionDataStore & operator=(const G4CrossSectionDataStore &right);
|
||||
G4CrossSectionDataStore(const G4CrossSectionDataStore&);
|
||||
const G4Isotope*, const G4Element*,
|
||||
const G4Material*, const G4int index);
|
||||
|
||||
G4String HtmlFileName(const G4String & in) const;
|
||||
|
||||
G4NistManager* nist;
|
||||
const G4Material* currentMaterial = nullptr;
|
||||
const G4ParticleDefinition* matParticle = nullptr;
|
||||
G4double matKinEnergy = 0.0;
|
||||
G4double matCrossSection = 0.0;
|
||||
|
||||
G4int nDataSetList = 0;
|
||||
G4int verboseLevel = 1;
|
||||
|
||||
std::vector<G4VCrossSectionDataSet*> dataSetList;
|
||||
std::vector<G4double> xsecelm;
|
||||
std::vector<G4double> xseciso;
|
||||
|
||||
const G4Material* currentMaterial;
|
||||
const G4ParticleDefinition* matParticle;
|
||||
G4double matKinEnergy;
|
||||
G4double matCrossSection;
|
||||
|
||||
G4int nDataSetList;
|
||||
G4int verboseLevel;
|
||||
};
|
||||
|
||||
inline void G4CrossSectionDataStore::SetVerboseLevel(G4int value)
|
||||
@@ -130,4 +129,15 @@ inline void G4CrossSectionDataStore::SetVerboseLevel(G4int value)
|
||||
verboseLevel = value;
|
||||
}
|
||||
|
||||
inline G4double
|
||||
G4CrossSectionDataStore::GetCrossSection(const G4DynamicParticle* dp,
|
||||
const G4Material* mat)
|
||||
{
|
||||
if(dp->GetKineticEnergy() != matKinEnergy || mat != currentMaterial ||
|
||||
dp->GetDefinition() != matParticle) {
|
||||
ComputeCrossSection(dp, mat);
|
||||
}
|
||||
return matCrossSection;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -96,18 +96,14 @@ public: //with description
|
||||
// This is a generic method to access cross section per element
|
||||
// This method should not be overwritten in a derived class
|
||||
inline G4double GetCrossSection(const G4DynamicParticle*, const G4Element*,
|
||||
const G4Material* mat = nullptr);
|
||||
const G4Material* mat = nullptr);
|
||||
|
||||
// This is a generic method to compute cross section per element
|
||||
// If the DataSet is not applicable the method returns zero
|
||||
// This method should not be overwritten in a derived class
|
||||
G4double ComputeCrossSection(const G4DynamicParticle*,
|
||||
const G4Element*,
|
||||
const G4Material* mat = nullptr);
|
||||
|
||||
// The following two methods have default implementations which throw
|
||||
// G4Exception. Derived classes should implement only needed
|
||||
// methods, which are assumed to be called at run time.
|
||||
const G4Element*,
|
||||
const G4Material* mat = nullptr);
|
||||
|
||||
// Implement this method for element-wise cross section
|
||||
virtual
|
||||
@@ -143,8 +139,6 @@ public: //with description
|
||||
|
||||
virtual void CrossSectionDescription(std::ostream&) const;
|
||||
|
||||
virtual G4int GetVerboseLevel() const;
|
||||
|
||||
virtual void SetVerboseLevel(G4int value);
|
||||
|
||||
inline G4double GetMinKinEnergy() const;
|
||||
@@ -163,6 +157,10 @@ public: //with description
|
||||
|
||||
inline void SetName(const G4String& nam);
|
||||
|
||||
G4VCrossSectionDataSet & operator=
|
||||
(const G4VCrossSectionDataSet &right) = delete;
|
||||
G4VCrossSectionDataSet(const G4VCrossSectionDataSet&) = delete;
|
||||
|
||||
protected:
|
||||
|
||||
G4int verboseLevel;
|
||||
@@ -171,9 +169,6 @@ protected:
|
||||
|
||||
private:
|
||||
|
||||
G4VCrossSectionDataSet & operator=(const G4VCrossSectionDataSet &right);
|
||||
G4VCrossSectionDataSet(const G4VCrossSectionDataSet&);
|
||||
|
||||
G4CrossSectionDataSetRegistry* registry;
|
||||
|
||||
G4double minKinEnergy;
|
||||
@@ -185,18 +180,12 @@ private:
|
||||
|
||||
inline G4double
|
||||
G4VCrossSectionDataSet::GetCrossSection(const G4DynamicParticle* dp,
|
||||
const G4Element* elm,
|
||||
const G4Material* mat)
|
||||
const G4Element* elm,
|
||||
const G4Material* mat)
|
||||
{
|
||||
return ComputeCrossSection(dp, elm, mat);
|
||||
}
|
||||
|
||||
|
||||
inline G4int G4VCrossSectionDataSet::GetVerboseLevel() const
|
||||
{
|
||||
return verboseLevel;
|
||||
}
|
||||
|
||||
inline void G4VCrossSectionDataSet::SetVerboseLevel(G4int value)
|
||||
{
|
||||
verboseLevel = value;
|
||||
|
||||
@@ -132,14 +132,14 @@ geant4_add_module(G4hadronic_xsect
|
||||
|
||||
geant4_module_link_libraries(G4hadronic_xsect
|
||||
PUBLIC
|
||||
G4baryons
|
||||
G4globman
|
||||
G4hadronic_util
|
||||
G4heprandom
|
||||
G4ions
|
||||
G4leptons
|
||||
G4materials
|
||||
G4partman
|
||||
PRIVATE
|
||||
G4bosons
|
||||
G4mesons)
|
||||
G4baryons
|
||||
G4globman
|
||||
G4hadronic_util
|
||||
G4heprandom
|
||||
G4ions
|
||||
G4leptons
|
||||
G4materials
|
||||
G4partman
|
||||
PRIVATE
|
||||
G4bosons
|
||||
G4mesons)
|
||||
|
||||
@@ -221,7 +221,7 @@ void G4ComponentSAIDTotalXS::Initialise(G4SAIDCrossSectionType tp)
|
||||
#endif
|
||||
// check environment variable
|
||||
// Build the complete string identifying the file with the data set
|
||||
char* path = std::getenv("G4SAIDXSDATA");
|
||||
const char* path = G4FindDataDir("G4SAIDXSDATA");
|
||||
if (!path){
|
||||
G4Exception("G4ComponentSAIDTotalXS::Initialise(..)","had013",
|
||||
FatalException,
|
||||
|
||||
@@ -51,68 +51,26 @@
|
||||
#include "G4Isotope.hh"
|
||||
#include "G4Element.hh"
|
||||
#include "G4Material.hh"
|
||||
#include "G4MaterialTable.hh"
|
||||
#include "G4NistManager.hh"
|
||||
#include <algorithm>
|
||||
|
||||
#include <typeinfo>
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
G4CrossSectionDataStore::G4CrossSectionDataStore()
|
||||
: nist(G4NistManager::Instance())
|
||||
, currentMaterial(nullptr)
|
||||
, matParticle(nullptr)
|
||||
, matKinEnergy(0.0)
|
||||
, matCrossSection(0.0)
|
||||
, nDataSetList(0)
|
||||
, verboseLevel(0)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
G4CrossSectionDataStore::~G4CrossSectionDataStore()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
G4double
|
||||
G4CrossSectionDataStore::GetCrossSection(const G4DynamicParticle* part,
|
||||
const G4Material* mat)
|
||||
{
|
||||
if(mat == currentMaterial && part->GetDefinition() == matParticle
|
||||
&& part->GetKineticEnergy() == matKinEnergy)
|
||||
{ return matCrossSection; }
|
||||
|
||||
currentMaterial = mat;
|
||||
matParticle = part->GetDefinition();
|
||||
matKinEnergy = part->GetKineticEnergy();
|
||||
matCrossSection = 0;
|
||||
|
||||
G4int nElements = mat->GetNumberOfElements();
|
||||
const G4double* nAtomsPerVolume = mat->GetVecNbOfAtomsPerVolume();
|
||||
|
||||
if(G4int(xsecelm.size()) < nElements) { xsecelm.resize(nElements); }
|
||||
|
||||
for(G4int i=0; i<nElements; ++i) {
|
||||
matCrossSection += nAtomsPerVolume[i] *
|
||||
GetCrossSection(part, (*mat->GetElementVector())[i], mat);
|
||||
xsecelm[i] = matCrossSection;
|
||||
}
|
||||
return matCrossSection;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
G4double
|
||||
G4CrossSectionDataStore::ComputeCrossSection(const G4DynamicParticle* part,
|
||||
G4CrossSectionDataStore::ComputeCrossSection(const G4DynamicParticle* dp,
|
||||
const G4Material* mat)
|
||||
{
|
||||
if(part->GetKineticEnergy() == matKinEnergy && mat == currentMaterial &&
|
||||
part->GetDefinition() == matParticle)
|
||||
return matCrossSection;
|
||||
|
||||
currentMaterial = mat;
|
||||
matParticle = part->GetDefinition();
|
||||
matKinEnergy = part->GetKineticEnergy();
|
||||
matParticle = dp->GetDefinition();
|
||||
matKinEnergy = dp->GetKineticEnergy();
|
||||
matCrossSection = 0.0;
|
||||
|
||||
size_t nElements = mat->GetNumberOfElements();
|
||||
@@ -121,8 +79,9 @@ G4CrossSectionDataStore::ComputeCrossSection(const G4DynamicParticle* part,
|
||||
if(xsecelm.size() < nElements) { xsecelm.resize(nElements); }
|
||||
|
||||
for(size_t i=0; i<nElements; ++i) {
|
||||
matCrossSection += nAtomsPerVolume[i] *
|
||||
GetCrossSection(part, mat->GetElement(i), mat);
|
||||
G4double xs =
|
||||
nAtomsPerVolume[i]*GetCrossSection(dp, mat->GetElement(i), mat);
|
||||
matCrossSection += std::max(xs, 0.0);
|
||||
xsecelm[i] = matCrossSection;
|
||||
}
|
||||
return matCrossSection;
|
||||
@@ -130,18 +89,19 @@ G4CrossSectionDataStore::ComputeCrossSection(const G4DynamicParticle* part,
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
G4double G4CrossSectionDataStore::GetCrossSection(const G4DynamicParticle* part,
|
||||
G4double G4CrossSectionDataStore::GetCrossSection(const G4DynamicParticle* dp,
|
||||
const G4Element* elm,
|
||||
const G4Material* mat)
|
||||
{
|
||||
G4int i = nDataSetList - 1;
|
||||
// first check the most last cross section
|
||||
G4int i = nDataSetList-1;
|
||||
G4int Z = elm->GetZasInt();
|
||||
|
||||
if(elm->GetNaturalAbundanceFlag() &&
|
||||
dataSetList[i]->IsElementApplicable(part, Z, mat))
|
||||
dataSetList[i]->IsElementApplicable(dp, Z, mat))
|
||||
{
|
||||
// element wise cross section
|
||||
return dataSetList[i]->GetElementCrossSection(part, Z, mat);
|
||||
return dataSetList[i]->GetElementCrossSection(dp, Z, mat);
|
||||
}
|
||||
|
||||
// isotope wise cross section
|
||||
@@ -152,20 +112,20 @@ G4double G4CrossSectionDataStore::GetCrossSection(const G4DynamicParticle* part,
|
||||
|
||||
G4double sigma = 0.0;
|
||||
|
||||
for(size_t j = 0; j < nIso; ++j)
|
||||
// isotope and element wise cross sections
|
||||
for(size_t j = 0; j < nIso; ++j)
|
||||
{
|
||||
const G4Isotope* iso = elm->GetIsotope(j);
|
||||
sigma += abundVector[j] *
|
||||
GetIsoCrossSection(part, Z, iso->GetN(), iso, elm, mat, i);
|
||||
GetIsoCrossSection(dp, Z, iso->GetN(), iso, elm, mat, i);
|
||||
}
|
||||
|
||||
return sigma;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
G4double
|
||||
G4CrossSectionDataStore::GetIsoCrossSection(const G4DynamicParticle* part,
|
||||
G4CrossSectionDataStore::GetIsoCrossSection(const G4DynamicParticle* dp,
|
||||
G4int Z, G4int A,
|
||||
const G4Isotope* iso,
|
||||
const G4Element* elm,
|
||||
@@ -173,28 +133,26 @@ G4CrossSectionDataStore::GetIsoCrossSection(const G4DynamicParticle* part,
|
||||
G4int idx)
|
||||
{
|
||||
// this methods is called after the check that dataSetList[idx]
|
||||
// depend on isotopes, so for this DataSet only isotopes are checked
|
||||
// depend on isotopes, so first isotopes are checked
|
||||
if(dataSetList[idx]->IsIsoApplicable(dp, Z, A, elm, mat) ) {
|
||||
return dataSetList[idx]->GetIsoCrossSection(dp, Z, A, iso, elm, mat);
|
||||
}
|
||||
|
||||
// isotope-wise cross section does exist
|
||||
if(dataSetList[idx]->IsIsoApplicable(part, Z, A, elm, mat) ) {
|
||||
return dataSetList[idx]->GetIsoCrossSection(part, Z, A, iso, elm, mat);
|
||||
|
||||
} else {
|
||||
// seach for other dataSet
|
||||
for (G4int j = nDataSetList-1; j >= 0; --j) {
|
||||
if (dataSetList[j]->IsElementApplicable(part, Z, mat)) {
|
||||
return dataSetList[j]->GetElementCrossSection(part, Z, mat);
|
||||
} else if (dataSetList[j]->IsIsoApplicable(part, Z, A, elm, mat)) {
|
||||
return dataSetList[j]->GetIsoCrossSection(part, Z, A, iso, elm, mat);
|
||||
}
|
||||
// no isotope wise cross section - check other datasets
|
||||
for (G4int j = nDataSetList-1; j >= 0; --j) {
|
||||
if(dataSetList[j]->IsElementApplicable(dp, Z, mat)) {
|
||||
return dataSetList[j]->GetElementCrossSection(dp, Z, mat);
|
||||
} else if (dataSetList[j]->IsIsoApplicable(dp, Z, A, elm, mat)) {
|
||||
return dataSetList[j]->GetIsoCrossSection(dp, Z, A, iso, elm, mat);
|
||||
}
|
||||
}
|
||||
G4ExceptionDescription ed;
|
||||
ed << "No isotope cross section found for "
|
||||
<< part->GetDefinition()->GetParticleName()
|
||||
<< " off Element " << elm->GetName()
|
||||
<< " in " << mat->GetName() << " Z= " << Z << " A= " << A
|
||||
<< " E(MeV)= " << part->GetKineticEnergy()/MeV << G4endl;
|
||||
<< dp->GetDefinition()->GetParticleName()
|
||||
<< " off target Element " << elm->GetName()
|
||||
<< " Z= " << Z << " A= " << A;
|
||||
if(nullptr != mat) ed << " from " << mat->GetName();
|
||||
ed << " E(MeV)=" << dp->GetKineticEnergy()/MeV << G4endl;
|
||||
G4Exception("G4CrossSectionDataStore::GetIsoCrossSection", "had001",
|
||||
FatalException, ed);
|
||||
return 0.0;
|
||||
@@ -203,23 +161,26 @@ G4CrossSectionDataStore::GetIsoCrossSection(const G4DynamicParticle* part,
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
G4double
|
||||
G4CrossSectionDataStore::GetCrossSection(const G4DynamicParticle* part,
|
||||
G4CrossSectionDataStore::GetCrossSection(const G4DynamicParticle* dp,
|
||||
G4int Z, G4int A,
|
||||
const G4Isotope* iso,
|
||||
const G4Element* elm,
|
||||
const G4Material* mat)
|
||||
{
|
||||
for (G4int i = nDataSetList-1; i >= 0; --i) {
|
||||
if (dataSetList[i]->IsIsoApplicable(part, Z, A, elm, mat) ) {
|
||||
return dataSetList[i]->GetIsoCrossSection(part, Z, A, iso, elm, mat);
|
||||
if (dataSetList[i]->IsIsoApplicable(dp, Z, A, elm, mat) ) {
|
||||
return dataSetList[i]->GetIsoCrossSection(dp, Z, A, iso, elm, mat);
|
||||
} else if(dataSetList[i]->IsElementApplicable(dp, Z, mat)) {
|
||||
return dataSetList[i]->GetElementCrossSection(dp, Z, mat);
|
||||
}
|
||||
}
|
||||
G4ExceptionDescription ed;
|
||||
ed << "No isotope cross section found for "
|
||||
<< part->GetDefinition()->GetParticleName()
|
||||
<< " off Element " << elm->GetName()
|
||||
<< " in " << mat->GetName() << " Z= " << Z << " A= " << A
|
||||
<< " E(MeV)= " << part->GetKineticEnergy()/MeV << G4endl;
|
||||
<< dp->GetDefinition()->GetParticleName()
|
||||
<< " off target Element " << elm->GetName()
|
||||
<< " Z= " << Z << " A= " << A;
|
||||
if(nullptr != mat) ed << " from " << mat->GetName();
|
||||
ed << " E(MeV)=" << dp->GetKineticEnergy()/MeV << G4endl;
|
||||
G4Exception("G4CrossSectionDataStore::GetCrossSection", "had001",
|
||||
FatalException, ed);
|
||||
return 0.0;
|
||||
@@ -228,7 +189,7 @@ G4CrossSectionDataStore::GetCrossSection(const G4DynamicParticle* part,
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
const G4Element*
|
||||
G4CrossSectionDataStore::SampleZandA(const G4DynamicParticle* part,
|
||||
G4CrossSectionDataStore::SampleZandA(const G4DynamicParticle* dp,
|
||||
const G4Material* mat,
|
||||
G4Nucleus& target)
|
||||
{
|
||||
@@ -250,7 +211,7 @@ G4CrossSectionDataStore::SampleZandA(const G4DynamicParticle* part,
|
||||
const G4Isotope* iso = nullptr;
|
||||
|
||||
G4int i = nDataSetList-1;
|
||||
if (dataSetList[i]->IsElementApplicable(part, Z, mat)) {
|
||||
if (dataSetList[i]->IsElementApplicable(dp, Z, mat)) {
|
||||
|
||||
//----------------------------------------------------------------
|
||||
// element-wise cross section
|
||||
@@ -262,8 +223,8 @@ G4CrossSectionDataStore::SampleZandA(const G4DynamicParticle* part,
|
||||
// more than 1 isotope
|
||||
if(1 < nIso) {
|
||||
iso = dataSetList[i]->SelectIsotope(anElement,
|
||||
part->GetKineticEnergy(),
|
||||
part->GetLogKineticEnergy());
|
||||
dp->GetKineticEnergy(),
|
||||
dp->GetLogKineticEnergy());
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -286,7 +247,7 @@ G4CrossSectionDataStore::SampleZandA(const G4DynamicParticle* part,
|
||||
if(abundVector[j] > 0.0) {
|
||||
iso = anElement->GetIsotope(j);
|
||||
xsec = abundVector[j]*
|
||||
GetIsoCrossSection(part, Z, iso->GetN(), iso, anElement, mat, i);
|
||||
GetIsoCrossSection(dp, Z, iso->GetN(), iso, anElement, mat, i);
|
||||
}
|
||||
cross += xsec;
|
||||
xseciso[j] = cross;
|
||||
@@ -307,25 +268,39 @@ G4CrossSectionDataStore::SampleZandA(const G4DynamicParticle* part,
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
void
|
||||
G4CrossSectionDataStore::BuildPhysicsTable(const G4ParticleDefinition& aParticleType)
|
||||
G4CrossSectionDataStore::BuildPhysicsTable(const G4ParticleDefinition& part)
|
||||
{
|
||||
if (nDataSetList == 0) {
|
||||
G4ExceptionDescription ed;
|
||||
ed << "No cross section is registered for "
|
||||
<< aParticleType.GetParticleName() << G4endl;
|
||||
<< part.GetParticleName() << G4endl;
|
||||
G4Exception("G4CrossSectionDataStore::BuildPhysicsTable", "had001",
|
||||
FatalException, ed);
|
||||
return;
|
||||
}
|
||||
matParticle = ∂
|
||||
for (G4int i=0; i<nDataSetList; ++i) {
|
||||
dataSetList[i]->BuildPhysicsTable(aParticleType);
|
||||
}
|
||||
dataSetList[i]->BuildPhysicsTable(part);
|
||||
}
|
||||
const G4MaterialTable* theMatTable = G4Material::GetMaterialTable();
|
||||
size_t nelm = 0;
|
||||
size_t niso = 0;
|
||||
for(auto mat : *theMatTable) {
|
||||
size_t nElements = mat->GetNumberOfElements();
|
||||
nelm = std::max(nelm, nElements);
|
||||
for(size_t j=0; j<nElements; ++j) {
|
||||
niso = std::max(niso, mat->GetElement(j)->GetNumberOfIsotopes());
|
||||
}
|
||||
}
|
||||
// define vectors for a run
|
||||
xsecelm.resize(nelm, 0.0);
|
||||
xseciso.resize(niso, 0.0);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
void
|
||||
G4CrossSectionDataStore::DumpPhysicsTable(const G4ParticleDefinition& aParticleType)
|
||||
G4CrossSectionDataStore::DumpPhysicsTable(const G4ParticleDefinition& part)
|
||||
{
|
||||
// Print out all cross section data sets used and the energies at
|
||||
// which they apply
|
||||
@@ -339,19 +314,19 @@ G4CrossSectionDataStore::DumpPhysicsTable(const G4ParticleDefinition& aParticleT
|
||||
for (G4int i = nDataSetList-1; i >= 0; --i) {
|
||||
G4double e1 = dataSetList[i]->GetMinKinEnergy();
|
||||
G4double e2 = dataSetList[i]->GetMaxKinEnergy();
|
||||
G4cout
|
||||
G4cout
|
||||
<< " Cr_sctns: " << std::setw(25) << dataSetList[i]->GetName() << ": "
|
||||
<< G4BestUnit(e1, "Energy")
|
||||
<< " ---> "
|
||||
<< G4BestUnit(e1, "Energy") << " ---> "
|
||||
<< G4BestUnit(e2, "Energy") << "\n";
|
||||
if (dataSetList[i]->GetName() == "G4CrossSectionPairGG") {
|
||||
dataSetList[i]->DumpPhysicsTable(aParticleType);
|
||||
}
|
||||
if (dataSetList[i]->GetName() == "G4CrossSectionPairGG") {
|
||||
dataSetList[i]->DumpPhysicsTable(part);
|
||||
}
|
||||
G4cout << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
#include <typeinfo>
|
||||
|
||||
void G4CrossSectionDataStore::DumpHtml(const G4ParticleDefinition& /* pD */,
|
||||
std::ofstream& outFile) const
|
||||
{
|
||||
@@ -365,20 +340,19 @@ void G4CrossSectionDataStore::DumpHtml(const G4ParticleDefinition& /* pD */,
|
||||
elo = dataSetList[i]->GetMinKinEnergy()/GeV;
|
||||
ehi = dataSetList[i]->GetMaxKinEnergy()/GeV;
|
||||
outFile << " <li><b><a href=\"" << physListName << "_"
|
||||
<< dataSetList[i]->GetName() << ".html\"> "
|
||||
<< dataSetList[i]->GetName() << ".html\"> "
|
||||
<< dataSetList[i]->GetName() << "</a> from "
|
||||
<< elo << " GeV to " << ehi << " GeV </b></li>\n";
|
||||
//G4cerr << i << ": XS for " << pD.GetParticleName() << " : " << dataSetList[i]->GetName()
|
||||
// << " typeid : " << typeid(dataSetList[i]).name()<< G4endl;
|
||||
PrintCrossSectionHtml(dataSetList[i]);
|
||||
PrintCrossSectionHtml(dataSetList[i]);
|
||||
}
|
||||
|
||||
G4double defaultHi = dataSetList[0]->GetMaxKinEnergy()/GeV;
|
||||
if (ehi < defaultHi) {
|
||||
outFile << " <li><b><a href=\"" << dataSetList[0]->GetName() << ".html\"> "
|
||||
outFile << " <li><b><a href=\"" << dataSetList[0]->GetName()
|
||||
<< ".html\"> "
|
||||
<< dataSetList[0]->GetName() << "</a> from "
|
||||
<< ehi << " GeV to " << defaultHi << " GeV </b></li>\n";
|
||||
PrintCrossSectionHtml(dataSetList[0]);
|
||||
PrintCrossSectionHtml(dataSetList[0]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -389,22 +363,22 @@ void G4CrossSectionDataStore::PrintCrossSectionHtml(const G4VCrossSectionDataSet
|
||||
G4String dirName(std::getenv("G4PhysListDocDir"));
|
||||
G4String physListName(std::getenv("G4PhysListName"));
|
||||
|
||||
G4String pathName = dirName + "/" + physListName + "_" + HtmlFileName(cs->GetName());
|
||||
std::ofstream outCS;
|
||||
outCS.open(pathName);
|
||||
outCS << "<html>\n";
|
||||
outCS << "<head>\n";
|
||||
outCS << "<title>Description of " << cs->GetName()
|
||||
<< "</title>\n";
|
||||
outCS << "</head>\n";
|
||||
outCS << "<body>\n";
|
||||
|
||||
cs->CrossSectionDescription(outCS);
|
||||
|
||||
outCS << "</body>\n";
|
||||
outCS << "</html>\n";
|
||||
|
||||
G4String pathName = dirName + "/" + physListName + "_" + HtmlFileName(cs->GetName());
|
||||
std::ofstream outCS;
|
||||
outCS.open(pathName);
|
||||
outCS << "<html>\n";
|
||||
outCS << "<head>\n";
|
||||
outCS << "<title>Description of " << cs->GetName()
|
||||
<< "</title>\n";
|
||||
outCS << "</head>\n";
|
||||
outCS << "<body>\n";
|
||||
|
||||
cs->CrossSectionDescription(outCS);
|
||||
|
||||
outCS << "</body>\n";
|
||||
outCS << "</html>\n";
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
G4String G4CrossSectionDataStore::HtmlFileName(const G4String & in) const
|
||||
@@ -430,21 +404,22 @@ void G4CrossSectionDataStore::AddDataSet(G4VCrossSectionDataSet* p)
|
||||
++nDataSetList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
void G4CrossSectionDataStore::AddDataSet(G4VCrossSectionDataSet* p, size_t i )
|
||||
void G4CrossSectionDataStore::AddDataSet(G4VCrossSectionDataSet* p, size_t i)
|
||||
{
|
||||
if(p->ForAllAtomsAndEnergies()) {
|
||||
dataSetList.clear();
|
||||
dataSetList.push_back(p);
|
||||
nDataSetList = 1;
|
||||
} else if ( i >= dataSetList.size() ) {
|
||||
dataSetList.push_back(p);
|
||||
++nDataSetList;
|
||||
} else {
|
||||
if ( i > dataSetList.size() ) i = dataSetList.size();
|
||||
std::vector< G4VCrossSectionDataSet* >::iterator it = dataSetList.end() - i;
|
||||
dataSetList.insert(it , p);
|
||||
++nDataSetList;
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
@@ -334,7 +334,7 @@ const G4String& G4GammaNuclearXS::FindDirectoryPath()
|
||||
// check environment variable
|
||||
// build the complete string identifying the file with the data set
|
||||
if(gDataDirectory.empty()) {
|
||||
char* path = std::getenv("G4PARTICLEXSDATA");
|
||||
const char* path = G4FindDataDir("G4PARTICLEXSDATA");
|
||||
if (nullptr != path) {
|
||||
std::ostringstream ost;
|
||||
ost << path << "/gamma/inel";
|
||||
|
||||
@@ -285,7 +285,7 @@ const G4String& G4NeutronCaptureXS::FindDirectoryPath()
|
||||
// check environment variable
|
||||
// build the complete string identifying the file with the data set
|
||||
if(gDataDirectory.empty()) {
|
||||
char* path = std::getenv("G4PARTICLEXSDATA");
|
||||
const char* path = G4FindDataDir("G4PARTICLEXSDATA");
|
||||
if (nullptr != path) {
|
||||
std::ostringstream ost;
|
||||
ost << path << "/neutron/cap";
|
||||
|
||||
@@ -219,7 +219,7 @@ const G4String& G4NeutronElasticXS::FindDirectoryPath()
|
||||
// check environment variable
|
||||
// build the complete string identifying the file with the data set
|
||||
if(gDataDirectory.empty()) {
|
||||
char* path = std::getenv("G4PARTICLEXSDATA");
|
||||
const char* path = G4FindDataDir("G4PARTICLEXSDATA");
|
||||
if (nullptr != path) {
|
||||
std::ostringstream ost;
|
||||
ost << path << "/neutron/el";
|
||||
|
||||
@@ -297,7 +297,7 @@ const G4String& G4NeutronInelasticXS::FindDirectoryPath()
|
||||
// check environment variable
|
||||
// build the complete string identifying the file with the data set
|
||||
if(gDataDirectory.empty()) {
|
||||
char* path = std::getenv("G4PARTICLEXSDATA");
|
||||
const char* path = G4FindDataDir("G4PARTICLEXSDATA");
|
||||
if (nullptr != path) {
|
||||
std::ostringstream ost;
|
||||
ost << path << "/neutron/inel";
|
||||
|
||||
@@ -336,7 +336,7 @@ const G4String& G4ParticleInelasticXS::FindDirectoryPath()
|
||||
// check environment variable
|
||||
// build the complete string identifying the file with the data set
|
||||
if(gDataDirectory[index].empty()) {
|
||||
char* path = std::getenv("G4PARTICLEXSDATA");
|
||||
const char* path = G4FindDataDir("G4PARTICLEXSDATA");
|
||||
if (nullptr != path) {
|
||||
std::ostringstream ost;
|
||||
ost << path << "/" << particle->GetParticleName() << "/inel";
|
||||
|
||||
@@ -79,8 +79,8 @@ G4VCrossSectionDataSet::IsIsoApplicable(const G4DynamicParticle*,
|
||||
|
||||
G4double
|
||||
G4VCrossSectionDataSet::ComputeCrossSection(const G4DynamicParticle* part,
|
||||
const G4Element* elm,
|
||||
const G4Material* mat)
|
||||
const G4Element* elm,
|
||||
const G4Material* mat)
|
||||
{
|
||||
G4int Z = elm->GetZasInt();
|
||||
|
||||
@@ -98,7 +98,6 @@ G4VCrossSectionDataSet::ComputeCrossSection(const G4DynamicParticle* part,
|
||||
// user-defined isotope abundances
|
||||
const G4IsotopeVector* isoVector = elm->GetIsotopeVector();
|
||||
const G4double* abundVector = elm->GetRelativeAbundanceVector();
|
||||
|
||||
for (size_t j=0; j<nIso; ++j) {
|
||||
const G4Isotope* iso = (*isoVector)[j];
|
||||
G4int A = iso->GetN();
|
||||
|
||||
Reference in New Issue
Block a user