58 nDataSetList(0), verboseLevel(0)
61 currentMaterial = elmMaterial = 0;
63 matParticle = elmParticle = 0;
64 matKinEnergy = elmKinEnergy = matCrossSection = elmCrossSection = 0.0;
74 if(mat == currentMaterial && part->
GetDefinition() == matParticle
76 {
return matCrossSection; }
78 currentMaterial = mat;
86 if(
G4int(xsecelm.size()) < nElements) { xsecelm.resize(nElements); }
88 for(
G4int i=0; i<nElements; ++i) {
89 matCrossSection += nAtomsPerVolume[i] *
91 xsecelm[i] = matCrossSection;
93 return matCrossSection;
101 if(mat == elmMaterial && elm == currentElement &&
104 {
return elmCrossSection; }
107 currentElement = elm;
110 elmCrossSection = 0.0;
112 G4int i = nDataSetList-1;
114 if (dataSetList[i]->IsElementApplicable(part, Z, mat)) {
117 elmCrossSection = dataSetList[i]->GetElementCrossSection(part, Z, mat);
126 <<
" has no isotopes " <<
G4endl;
128 " Isotope vector is not defined");
135 for (
G4int j = 0; j<nIso; ++j) {
136 if(abundVector[j] > 0.0) {
137 iso = (*isoVector)[j];
138 elmCrossSection += abundVector[j]*
139 GetIsoCrossSection(part, Z, iso->
GetN(), iso, elm, mat, i);
144 return elmCrossSection;
159 if(dataSetList[idx]->IsIsoApplicable(part, Z, A, elm, mat) ) {
160 return dataSetList[idx]->GetIsoCrossSection(part, Z, A, iso, elm, mat);
164 for (
G4int j = idx-1; j >= 0; --j) {
165 if (dataSetList[j]->IsElementApplicable(part, Z, mat)) {
166 return dataSetList[j]->GetElementCrossSection(part, Z, mat);
167 }
else if (dataSetList[j]->IsIsoApplicable(part, Z, A, elm, mat)) {
168 return dataSetList[j]->GetIsoCrossSection(part, Z, A, iso, elm, mat);
172 G4cout <<
"G4CrossSectionDataStore::GetCrossSection ERROR: "
173 <<
" no isotope cross section found"
176 <<
" off Element " << elm->
GetName()
178 <<
" Z= " << Z <<
" A= " << A
181 " no applicable data set found for the isotope");
193 for (
G4int i = nDataSetList-1; i >= 0; --i) {
194 if (dataSetList[i]->IsIsoApplicable(part, Z, A, elm, mat) ) {
195 return dataSetList[i]->GetIsoCrossSection(part, Z, A, iso, elm, mat);
198 G4cout <<
"G4CrossSectionDataStore::GetCrossSection ERROR: "
199 <<
" no isotope cross section found"
202 <<
" off Element " << elm->
GetName()
204 <<
" Z= " << Z <<
" A= " << A
207 " no applicable data set found for the isotope");
218 G4Element* anElement = (*theElementVector)[0];
223 if(0.0 >= cross) {
return anElement; }
228 for(
G4int i=0; i<nElements; ++i) {
229 if(cross <= xsecelm[i]) {
230 anElement = (*theElementVector)[i];
239 G4int i = nDataSetList-1;
240 if (dataSetList[i]->IsElementApplicable(part, Z, mat)) {
249 <<
" has no isotopes " <<
G4endl;
251 " Isotope vector is not defined");
256 iso = (*isoVector)[0];
274 <<
" has no isotopes " <<
G4endl;
276 " Isotope vector is not defined");
282 iso = (*isoVector)[0];
287 if(
G4int(xseciso.size()) < nIso) { xseciso.resize(nIso); }
289 for (
G4int j = 0; j<nIso; ++j) {
291 if(abundVector[j] > 0.0) {
292 iso = (*isoVector)[j];
293 xsec = abundVector[j]*
294 GetIsoCrossSection(part, Z, iso->
GetN(), iso, anElement, mat, i);
300 for (
G4int j = 0; j<nIso; ++j) {
301 if(cross <= xseciso[j]) {
302 iso = (*isoVector)[j];
315 if (nDataSetList == 0)
318 "G4CrossSectionDataStore: no data sets registered");
321 for (
G4int i=0; i<nDataSetList; ++i) {
322 dataSetList[i]->BuildPhysicsTable(aParticleType);
332 if (nDataSetList == 0) {
333 G4cout <<
"WARNING - G4CrossSectionDataStore::DumpPhysicsTable: "
334 <<
" no data sets registered" <<
G4endl;
338 for (
G4int i = nDataSetList-1; i >= 0; --i) {
339 G4double e1 = dataSetList[i]->GetMinKinEnergy();
340 G4double e2 = dataSetList[i]->GetMaxKinEnergy();
341 if (i < nDataSetList-1) {
G4cout <<
" "; }
342 G4cout << std::setw(25) << dataSetList[i]->GetName() <<
": Emin(GeV)= "
343 << std::setw(4) << e1/GeV <<
" Emax(GeV)= "
345 if (dataSetList[i]->GetName() ==
"G4CrossSectionPairGG") {
346 dataSetList[i]->DumpPhysicsTable(aParticleType);
354 std::ofstream& outFile)
361 for (
G4int i = nDataSetList-1; i > 0; i--) {
362 elo = dataSetList[i]->GetMinKinEnergy()/GeV;
363 ehi = dataSetList[i]->GetMaxKinEnergy()/GeV;
364 outFile <<
" <li><b><a href=\"" << dataSetList[i]->GetName() <<
".html\"> "
365 << dataSetList[i]->GetName() <<
"</a> from "
366 << elo <<
" GeV to " << ehi <<
" GeV </b></li>\n";
369 G4double defaultHi = dataSetList[0]->GetMaxKinEnergy()/GeV;
370 if (ehi < defaultHi) {
371 outFile <<
" <li><b><a href=\"" << dataSetList[0]->GetName() <<
".html\"> "
372 << dataSetList[0]->GetName() <<
"</a> from "
373 << ehi <<
" GeV to " << defaultHi <<
" GeV </b></li>\n";
std::vector< G4Element * > G4ElementVector
std::vector< G4Isotope * > G4IsotopeVector
G4DLLIMPORT std::ostream G4cout
void BuildPhysicsTable(const G4ParticleDefinition &)
void DumpPhysicsTable(const G4ParticleDefinition &)
~G4CrossSectionDataStore()
G4Element * SampleZandA(const G4DynamicParticle *, const G4Material *, G4Nucleus &target)
G4double GetCrossSection(const G4DynamicParticle *, const G4Material *)
G4CrossSectionDataStore()
void DumpHtml(const G4ParticleDefinition &, std::ofstream &)
G4ParticleDefinition * GetDefinition() const
G4double GetKineticEnergy() const
G4double * GetRelativeAbundanceVector() const
size_t GetNumberOfIsotopes() const
const G4String & GetName() const
G4IsotopeVector * GetIsotopeVector() const
const G4ElementVector * GetElementVector() const
size_t GetNumberOfElements() const
const G4double * GetVecNbOfAtomsPerVolume() const
const G4String & GetName() const
static G4NistManager * Instance()
void SetIsotope(const G4Isotope *iso)
const G4String & GetParticleName() const