71 currentMaterial = mat;
74 matCrossSection = 0.0;
79 if(xsecelm.size() < nElements) { xsecelm.resize(nElements); }
84 matCrossSection += std::max(xs, 0.0);
85 xsecelm[i] = matCrossSection;
87 return matCrossSection;
97 G4int i = nDataSetList-1;
101 dataSetList[i]->IsElementApplicable(dp,
Z, mat))
104 return dataSetList[i]->GetElementCrossSection(dp,
Z, mat);
116 for(
G4int j = 0; j < nIso; ++j)
119 sigma += abundVector[j] *
120 GetIsoCrossSection(dp,
Z, iso->
GetN(), iso, elm, mat, i);
137 if(dataSetList[idx]->IsIsoApplicable(dp,
Z,
A, elm, mat) ) {
138 return dataSetList[idx]->GetIsoCrossSection(dp,
Z,
A, iso, elm, mat);
142 for (
G4int j = nDataSetList-1; j >= 0; --j) {
143 if(dataSetList[j]->IsElementApplicable(dp,
Z, mat)) {
144 return dataSetList[j]->GetElementCrossSection(dp,
Z, mat);
145 }
else if (dataSetList[j]->IsIsoApplicable(dp,
Z,
A, elm, mat)) {
146 return dataSetList[j]->GetIsoCrossSection(dp,
Z,
A, iso, elm, mat);
150 ed <<
"No isotope cross section found for "
152 <<
" off target Element " << elm->
GetName()
153 <<
" Z= " <<
Z <<
" A= " <<
A;
154 if(
nullptr != mat) ed <<
" from " << mat->
GetName();
156 G4Exception(
"G4CrossSectionDataStore::GetIsoCrossSection",
"had001",
170 for (
G4int i = nDataSetList-1; i >= 0; --i) {
171 if (dataSetList[i]->IsIsoApplicable(dp,
Z,
A, elm, mat) ) {
172 return dataSetList[i]->GetIsoCrossSection(dp,
Z,
A, iso, elm, mat);
173 }
else if(dataSetList[i]->IsElementApplicable(dp,
Z, mat)) {
174 return dataSetList[i]->GetElementCrossSection(dp,
Z, mat);
178 ed <<
"No isotope cross section found for "
180 <<
" off target Element " << elm->
GetName()
181 <<
" Z= " <<
Z <<
" A= " <<
A;
182 if(
nullptr != mat) ed <<
" from " << mat->
GetName();
184 G4Exception(
"G4CrossSectionDataStore::GetCrossSection",
"had001",
196 if(
nullptr != forcedElement) {
return forcedElement; }
204 if(cross <= xsecelm[i]) {
214 G4int i = nDataSetList-1;
215 if (dataSetList[i]->IsElementApplicable(dp,
Z, mat)) {
226 iso = dataSetList[i]->SelectIsotope(anElement,
242 if(xseciso.size() < nIso) { xseciso.resize(nIso); }
246 for (j = 0; j<(
G4int)nIso; ++j) {
248 if(abundVector[j] > 0.0) {
250 xsec = abundVector[j]*
251 GetIsoCrossSection(dp,
Z, iso->
GetN(), iso, anElement, mat, i);
257 for (j = 0; j<(
G4int)nIso; ++j) {
258 if(cross <= xseciso[j]) {
274 if (nDataSetList == 0) {
276 ed <<
"No cross section is registered for "
278 G4Exception(
"G4CrossSectionDataStore::BuildPhysicsTable",
"had001",
283 for (
G4int i=0; i<nDataSetList; ++i) {
284 dataSetList[i]->BuildPhysicsTable(part);
287 std::size_t nelm = 0;
288 std::size_t niso = 0;
289 for(
auto mat : *theMatTable) {
291 nelm = std::max(nelm, nElements);
297 xsecelm.resize(nelm, 0.0);
298 xseciso.resize(niso, 0.0);
309 if (nDataSetList == 0) {
310 G4cout <<
"WARNING - G4CrossSectionDataStore::DumpPhysicsTable: "
311 <<
" no data sets registered" <<
G4endl;
315 for (
G4int i = nDataSetList-1; i >= 0; --i) {
316 G4double e1 = dataSetList[i]->GetMinKinEnergy();
317 G4double e2 = dataSetList[i]->GetMaxKinEnergy();
319 <<
" Cr_sctns: " << std::setw(25) << dataSetList[i]->GetName() <<
": "
322 if (dataSetList[i]->GetName() ==
"G4CrossSectionPairGG") {
323 dataSetList[i]->DumpPhysicsTable(part);
332 std::ofstream& outFile)
const
339 G4String physListName(std::getenv(
"G4PhysListName"));
340 for (
G4int i = nDataSetList-1; i > 0; i--) {
341 elo = dataSetList[i]->GetMinKinEnergy()/GeV;
342 ehi = dataSetList[i]->GetMaxKinEnergy()/GeV;
343 outFile <<
" <li><b><a href=\"" << physListName <<
"_"
344 << dataSetList[i]->GetName() <<
".html\"> "
345 << dataSetList[i]->GetName() <<
"</a> from "
346 << elo <<
" GeV to " << ehi <<
" GeV </b></li>\n";
350 G4double defaultHi = dataSetList[0]->GetMaxKinEnergy()/GeV;
351 if (ehi < defaultHi) {
352 outFile <<
" <li><b><a href=\"" << dataSetList[0]->GetName()
354 << dataSetList[0]->GetName() <<
"</a> from "
355 << ehi <<
" GeV to " << defaultHi <<
" GeV </b></li>\n";
364 G4String dirName(std::getenv(
"G4PhysListDocDir"));
365 G4String physListName(std::getenv(
"G4PhysListName"));
367 G4String pathName = dirName +
"/" + physListName +
"_" + HtmlFileName(cs->
GetName());
369 outCS.open(pathName);
372 outCS <<
"<title>Description of " << cs->
GetName()
374 outCS <<
"</head>\n";
379 outCS <<
"</body>\n";
380 outCS <<
"</html>\n";
389 std::transform(str.begin(), str.end(), str.begin(), [](
char ch) {
390 return ch ==
' ' ?
'_' : ch;
404 dataSetList.push_back(p);
414 dataSetList.push_back(p);
416 }
else if ( i >= dataSetList.size() ) {
417 dataSetList.push_back(p);
420 std::vector< G4VCrossSectionDataSet* >::iterator it = dataSetList.end() - i;
421 dataSetList.insert(it , p);
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
std::vector< G4Material * > G4MaterialTable
G4GLOB_DLL std::ostream G4cout
void DumpHtml(const G4ParticleDefinition &, std::ofstream &) const
void BuildPhysicsTable(const G4ParticleDefinition &)
void AddDataSet(G4VCrossSectionDataSet *)
void PrintCrossSectionHtml(const G4VCrossSectionDataSet *cs) const
void DumpPhysicsTable(const G4ParticleDefinition &)
G4double ComputeCrossSection(const G4DynamicParticle *, const G4Material *)
G4double GetCrossSection(const G4DynamicParticle *, const G4Material *)
G4CrossSectionDataStore()
const G4Element * SampleZandA(const G4DynamicParticle *, const G4Material *, G4Nucleus &target)
G4double GetLogKineticEnergy() const
G4ParticleDefinition * GetDefinition() const
G4double GetKineticEnergy() const
G4double * GetRelativeAbundanceVector() const
G4bool GetNaturalAbundanceFlag() const
const G4Isotope * GetIsotope(G4int iso) const
size_t GetNumberOfIsotopes() const
const G4String & GetName() const
const G4Element * GetElement(G4int iel) const
size_t GetNumberOfElements() const
const G4double * GetVecNbOfAtomsPerVolume() const
static G4MaterialTable * GetMaterialTable()
const G4String & GetName() const
void SetIsotope(const G4Isotope *iso)
const G4String & GetParticleName() const
bool ForAllAtomsAndEnergies() const
const G4String & GetName() const
virtual void CrossSectionDescription(std::ostream &) const