64 nDataSetList(0), verboseLevel(0),fastPathFlags(),fastPathParams(),
65 counters(),fastPathCache()
137 requiresSlowPath=
true;
177 requiresSlowPath =
true;
189 if ( !requiresSlowPath ) {
201 if ( entry !=
nullptr && ! requiresSlowPath ) {
210 assert(requiresSlowPath==
false);
211 requiresSlowPath =
true;
215 if ( !requiresSlowPath && fast_entry !=
nullptr ) {
231 for(
G4int i=0; i<nElements; ++i) {
240 if ( entry !=
nullptr ) {
255 if ( entry !=
nullptr ) {
259 os<<
"#Cache entry for {"<<(pd!=
nullptr?pd->
GetParticleName():
"UNDEFINED")<<
",";
260 os<<(mat!=
nullptr?mat->
GetName():
"UNDEFINED")<<
"} found, but no fast path defined";
263 os<<
"#Cache entry for {"<<(pd!=
nullptr?pd->
GetParticleName():
"UNDEFINED")<<
",";
264 os<<(mat!=
nullptr?mat->
GetName():
"UNDEFINED")<<
"} not found.";
288 for(
size_t i=0; i<nElements; ++i) {
317 dataSetList[i]->IsElementApplicable(part, Z, mat)) {
335 for (
size_t j=0; j<
nIso; ++j) {
336 if(abundVector[j] > 0.0) {
366 if(
dataSetList[idx]->IsIsoApplicable(part, Z, A, elm, mat) ) {
367 return dataSetList[idx]->GetIsoCrossSection(part, Z, A, iso, elm, mat);
372 if (
dataSetList[j]->IsElementApplicable(part, Z, mat)) {
373 return dataSetList[j]->GetElementCrossSection(part, Z, mat);
374 }
else if (
dataSetList[j]->IsIsoApplicable(part, Z, A, elm, mat)) {
375 return dataSetList[j]->GetIsoCrossSection(part, Z, A, iso, elm, mat);
379 G4cout <<
"G4CrossSectionDataStore::GetCrossSection ERROR: "
380 <<
" no isotope cross section found"
383 <<
" off Element " << elm->
GetName()
385 <<
" Z= " << Z <<
" A= " << A
388 " no applicable data set found for the isotope");
401 if (
dataSetList[i]->IsIsoApplicable(part, Z, A, elm, mat) ) {
402 return dataSetList[i]->GetIsoCrossSection(part, Z, A, iso, elm, mat);
405 G4cout <<
"G4CrossSectionDataStore::GetCrossSection ERROR: "
406 <<
" no isotope cross section found"
409 <<
" off Element " << elm->
GetName()
411 <<
" Z= " << Z <<
" A= " << A
414 " no applicable data set found for the isotope");
430 for(
size_t i=0; i<nElements; ++i) {
442 if (
dataSetList[i]->IsElementApplicable(part, Z, mat)) {
472 for (j = 0; j<
nIso; ++j) {
474 if(abundVector[j] > 0.0) {
476 xsec = abundVector[j]*
483 for (j = 0; j<
nIso; ++j) {
503 "G4CrossSectionDataStore: no data sets registered");
513 using my_value_type=G4FastPathHadronicCrossSection::G4CrossSectionDataStore_Requests::value_type;
516 [&aParticleType,
this](
const my_value_type& req) {
517 if ( aParticleType == *req.part_mat.first ) {
535 assert(pdef!=
nullptr&&mat!=
nullptr);
538 std::ostringstream msg;
539 msg<<
"Attempting to request FastPath for couple: "<<pdef->GetParticleName()<<
","<<
mat->GetName();
540 msg<<
" but combination already exists";
554 G4cout <<
"WARNING - G4CrossSectionDataStore::DumpPhysicsTable: "
555 <<
" no data sets registered" <<
G4endl;
563 <<
" Cr_sctns: " << std::setw(25) <<
dataSetList[i]->GetName() <<
": "
567 if (
dataSetList[i]->GetName() ==
"G4CrossSectionPairGG") {
576 std::ofstream& outFile)
const
583 G4String physListName(getenv(
"G4PhysListName"));
587 outFile <<
" <li><b><a href=\"" << physListName <<
"_"
590 << elo <<
" GeV to " << ehi <<
" GeV </b></li>\n";
597 if (ehi < defaultHi) {
598 outFile <<
" <li><b><a href=\"" <<
dataSetList[0]->GetName() <<
".html\"> "
600 << ehi <<
" GeV to " << defaultHi <<
" GeV </b></li>\n";
609 G4String dirName(getenv(
"G4PhysListDocDir"));
610 G4String physListName(getenv(
"G4PhysListName"));
614 outCS.open(pathName);
617 outCS <<
"<title>Description of " << cs->
GetName()
619 outCS <<
"</head>\n";
624 outCS <<
"</body>\n";
625 outCS <<
"</html>\n";
634 std::transform(str.begin(), str.end(), str.begin(), [](
char ch) {
635 return ch ==
' ' ?
'_' : ch;
665 std::vector< G4VCrossSectionDataSet* >::iterator it =
dataSetList.end() - i;
const G4ParticleDefinition * elmParticle
G4double * GetRelativeAbundanceVector() const
G4double GetIsoCrossSection(const G4DynamicParticle *, G4int Z, G4int A, const G4Isotope *, const G4Element *, const G4Material *aMaterial, G4int index)
static constexpr double MeV
const G4String & GetName() const
G4FastPathHadronicCrossSection::controlFlag fastPathFlags
void SetIsotope(const G4Isotope *iso)
void logStopCountCycles(timing &)
void DumpPhysicsTable(const G4ParticleDefinition &)
G4double ComputeCrossSection(const G4DynamicParticle *, const G4Material *)
const G4Material * currentMaterial
const G4ElementVector * GetElementVector() const
const G4String & GetParticleName() const
G4bool initializationPhase
const G4double * GetVecNbOfAtomsPerVolume() const
const G4String & GetName() const
static constexpr double second
const G4ParticleDefinition * matParticle
void Initialize(G4CrossSectionDataStore *)
std::vector< G4double > xsecelm
G4bool GetNaturalAbundanceFlag() const
void PrintCrossSectionHtml(const G4VCrossSectionDataSet *cs) const
G4bool prevCalcUsedFastPath
void DumpHtml(const G4ParticleDefinition &, std::ofstream &) const
const G4String & GetName() const
static void logInvocationOneLine(cycleCountEntry *)
G4FastPathHadronicCrossSection::getCrossSectionCount counters
G4ParticleDefinition * GetDefinition() const
std::vector< G4double > xseciso
const G4double min_cutoff
void ActivateFastPath(const G4ParticleDefinition *, const G4Material *, G4double)
G4CrossSectionDataStore()
bool ForAllAtomsAndEnergies() const
G4FastPathHadronicCrossSection::G4CrossSectionDataStore_Cache fastPathCache
double A(double temperature)
G4bool useFastPathIfAvailable
void DumpFastPath(const G4ParticleDefinition *, const G4Material *, std::ostream &os)
void BuildPhysicsTable(const G4ParticleDefinition &)
void AddDataSet(G4VCrossSectionDataSet *)
const G4Element * currentElement
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
G4FastPathHadronicCrossSection::timing timing
std::vector< G4VCrossSectionDataSet * > dataSetList
~G4CrossSectionDataStore()
G4FastPathHadronicCrossSection::G4CrossSectionDataStore_Requests requests
static void logInvocationTriedOneLine(cycleCountEntry *)
std::pair< const G4ParticleDefinition *, const G4Material * > G4CrossSectionDataStore_Key
G4String HtmlFileName(const G4String &in) const
static void logHit(cycleCountEntry *)
G4double GetKineticEnergy() const
G4GLOB_DLL std::ostream G4cout
virtual void CrossSectionDescription(std::ostream &) const
G4double GetCrossSection(G4double ene) const
const G4Isotope * GetIsotope(G4int iso) const
G4double GetCrossSection(const G4DynamicParticle *, const G4Material *)
static void logTiming(cycleCountEntry *, fastPathEntry *, timing &)
const G4ParticleDefinition * GetParticleDefinition() const
const G4Material * elmMaterial
const G4Element * GetElement(G4int iel) const
static constexpr double GeV
const G4Element * SampleZandA(const G4DynamicParticle *, const G4Material *, G4Nucleus &target)
void logStartCountCycles(timing &)
size_t GetNumberOfElements() const
static G4NistManager * Instance()
size_t GetNumberOfIsotopes() const