64 nDataSetList(0), verboseLevel(0),fastPathFlags(),fastPathParams(),
65 counters(),fastPathCache()
138 requiresSlowPath=
true;
178 requiresSlowPath =
true;
190 if ( !requiresSlowPath ) {
202 if ( entry !=
nullptr && ! requiresSlowPath ) {
211 assert(requiresSlowPath==
false);
212 requiresSlowPath =
true;
216 if ( !requiresSlowPath && fast_entry !=
nullptr ) {
232 for(
G4int i=0; i<nElements; ++i) {
241 if ( entry !=
nullptr ) {
256 if ( entry !=
nullptr ) {
260 os<<
"#Cache entry for {"<<(pd!=
nullptr?pd->
GetParticleName():
"UNDEFINED")<<
",";
261 os<<(mat!=
nullptr?mat->
GetName():
"UNDEFINED")<<
"} found, but no fast path defined";
264 os<<
"#Cache entry for {"<<(pd!=
nullptr?pd->
GetParticleName():
"UNDEFINED")<<
",";
265 os<<(mat!=
nullptr?mat->
GetName():
"UNDEFINED")<<
"} not found.";
290 dataSetList[i]->IsElementApplicable(part, Z, mat)) {
310 for (
G4int j = 0; j<nIso; ++j) {
311 if(abundVector[j] > 0.0) {
312 iso = (*isoVector)[j];
341 if(
dataSetList[idx]->IsIsoApplicable(part, Z, A, elm, mat) ) {
342 return dataSetList[idx]->GetIsoCrossSection(part, Z, A, iso, elm, mat);
347 if (
dataSetList[j]->IsElementApplicable(part, Z, mat)) {
348 return dataSetList[j]->GetElementCrossSection(part, Z, mat);
349 }
else if (
dataSetList[j]->IsIsoApplicable(part, Z, A, elm, mat)) {
350 return dataSetList[j]->GetIsoCrossSection(part, Z, A, iso, elm, mat);
354 G4cout <<
"G4CrossSectionDataStore::GetCrossSection ERROR: " 355 <<
" no isotope cross section found" 358 <<
" off Element " << elm->
GetName()
360 <<
" Z= " << Z <<
" A= " << A
363 " no applicable data set found for the isotope");
378 if (
dataSetList[i]->IsIsoApplicable(part, Z, A, elm, mat) ) {
379 return dataSetList[i]->GetIsoCrossSection(part, Z, A, iso, elm, mat);
382 G4cout <<
"G4CrossSectionDataStore::GetCrossSection ERROR: " 383 <<
" no isotope cross section found" 386 <<
" off Element " << elm->
GetName()
388 <<
" Z= " << Z <<
" A= " << A
391 " no applicable data set found for the isotope");
406 G4Element* anElement = (*theElementVector)[0];
412 for(
G4int i=0; i<nElements; ++i) {
414 anElement = (*theElementVector)[i];
424 if (
dataSetList[i]->IsElementApplicable(part, Z, mat)) {
433 <<
" has no isotopes " <<
G4endl;
435 " Isotope vector is not defined");
440 iso = (*isoVector)[0];
458 <<
" has no isotopes " <<
G4endl;
460 " Isotope vector is not defined");
466 iso = (*isoVector)[0];
473 for (
G4int j = 0; j<nIso; ++j) {
475 if(abundVector[j] > 0.0) {
476 iso = (*isoVector)[j];
477 xsec = abundVector[j]*
484 for (
G4int j = 0; j<nIso; ++j) {
486 iso = (*isoVector)[j];
504 "G4CrossSectionDataStore: no data sets registered");
514 using my_value_type=G4FastPathHadronicCrossSection::G4CrossSectionDataStore_Requests::value_type;
517 [&aParticleType,
this](
const my_value_type& req) {
518 if ( aParticleType == *req.part_mat.first ) {
536 assert(pdef!=
nullptr&&mat!=
nullptr);
538 if (
requests.insert( { key , min_cutoff } ).second ) {
539 std::ostringstream msg;
540 msg<<
"Attempting to request FastPath for couple: "<<pdef->
GetParticleName()<<
","<<mat->GetName();
541 msg<<
" but combination already exists";
555 G4cout <<
"WARNING - G4CrossSectionDataStore::DumpPhysicsTable: " 556 <<
" no data sets registered" <<
G4endl;
564 <<
" Cr_sctns: " << std::setw(25) <<
dataSetList[i]->GetName() <<
": " 568 if (
dataSetList[i]->GetName() ==
"G4CrossSectionPairGG") {
577 std::ofstream& outFile)
const 584 G4String physListName(getenv(
"G4PhysListName"));
588 outFile <<
" <li><b><a href=\"" << physListName <<
"_" 591 << elo <<
" GeV to " << ehi <<
" GeV </b></li>\n";
598 if (ehi < defaultHi) {
599 outFile <<
" <li><b><a href=\"" <<
dataSetList[0]->GetName() <<
".html\"> " 601 << ehi <<
" GeV to " << defaultHi <<
" GeV </b></li>\n";
610 G4String dirName(getenv(
"G4PhysListDocDir"));
611 G4String physListName(getenv(
"G4PhysListName"));
615 outCS.open(pathName);
618 outCS <<
"<title>Description of " << cs->
GetName()
620 outCS <<
"</head>\n";
625 outCS <<
"</body>\n";
626 outCS <<
"</html>\n";
636 std::transform(str.begin(), str.end(), str.begin(), [](
char ch) {
637 return ch ==
' ' ?
'_' : ch;
641 for(std::string::iterator it = str.begin(); it != str.end(); ++it) {
642 if(*it ==
' ') *it =
'_';
G4bool GetNaturalAbundanceFlag() const
G4FastPathHadronicCrossSection::controlFlag fastPathFlags
void SetIsotope(const G4Isotope *iso)
G4double GetCrossSection(G4double ene) const
void Initialize(G4CrossSectionDataStore *)
void DumpHtml(const G4ParticleDefinition &, std::ofstream &) const
std::vector< G4Isotope * > G4IsotopeVector
std::vector< G4Element * > G4ElementVector
G4String HtmlFileName(const G4String &in) const
static void logTiming(cycleCountEntry *, fastPathEntry *, timing &)
const G4ParticleDefinition * matParticle
G4FastPathHadronicCrossSection::G4CrossSectionDataStore_Cache fastPathCache
G4bool prevCalcUsedFastPath
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
const G4Material * elmMaterial
const G4double min_cutoff
G4FastPathHadronicCrossSection::getCrossSectionCount counters
static G4NistManager * Instance()
size_t GetNumberOfIsotopes() const
G4double * GetRelativeAbundanceVector() const
void ActivateFastPath(const G4ParticleDefinition *, const G4Material *, G4double)
void logStartCountCycles(timing &)
std::pair< const G4ParticleDefinition *, const G4Material * > G4CrossSectionDataStore_Key
G4double GetKineticEnergy() const
const G4String & GetParticleName() const
G4bool useFastPathIfAvailable
G4GLOB_DLL std::ostream G4cout
double A(double temperature)
std::vector< G4double > xseciso
static void logInvocationOneLine(cycleCountEntry *)
static void logHit(cycleCountEntry *)
const G4ParticleDefinition * elmParticle
virtual void CrossSectionDescription(std::ostream &) const
const G4Material * currentMaterial
~G4CrossSectionDataStore()
const G4double * GetVecNbOfAtomsPerVolume() const
std::vector< G4VCrossSectionDataSet * > dataSetList
G4IsotopeVector * GetIsotopeVector() const
G4double GetCrossSection(const G4DynamicParticle *, const G4Material *)
const G4Element * currentElement
void PrintCrossSectionHtml(const G4VCrossSectionDataSet *cs) const
G4double GetIsoCrossSection(const G4DynamicParticle *, G4int Z, G4int A, const G4Isotope *, const G4Element *, const G4Material *aMaterial, G4int index)
void DumpFastPath(const G4ParticleDefinition *, const G4Material *, std::ostream &os)
const G4String & GetName() const
void BuildPhysicsTable(const G4ParticleDefinition &)
void DumpPhysicsTable(const G4ParticleDefinition &)
std::vector< G4double > xsecelm
size_t GetNumberOfElements() const
cout<< "-> Edep in the target
G4CrossSectionDataStore()
G4ParticleDefinition * GetDefinition() const
static void logInvocationTriedOneLine(cycleCountEntry *)
const G4ElementVector * GetElementVector() const
const G4ParticleDefinition * GetParticleDefinition() const
G4FastPathHadronicCrossSection::G4CrossSectionDataStore_Requests requests
G4Element * SampleZandA(const G4DynamicParticle *, const G4Material *, G4Nucleus &target)
G4FastPathHadronicCrossSection::timing timing
const G4String & GetName() const
G4bool initializationPhase
const G4String & GetName() const
void logStopCountCycles(timing &)