59G4double G4ParticleInelasticXS::coeff[MAXZINELP][5] = {{1.0}, {1.0}, {1.0}, {1.0}, {1.0}};
60G4String G4ParticleInelasticXS::gDataDirectory[] = {
""};
73 G4Exception(
"G4ParticleInelasticXS::G4ParticleInelasticXS(..)",
"had015",
79 G4cout <<
"G4ParticleInelasticXS::G4ParticleInelasticXS for "
80 << particleName <<
" on atoms with Z < " << MAXZINELP <<
G4endl;
82 if(particleName ==
"proton") {
84 if(highEnergyXsection ==
nullptr) {
89 if(highEnergyXsection ==
nullptr) {
92 if(particleName ==
"deuteron") index = 1;
93 else if(particleName ==
"triton") index = 2;
94 else if(particleName ==
"He3") index = 3;
95 else if(particleName ==
"alpha") index = 4;
98 ed << particleName <<
" is a wrong particle type";
99 G4Exception(
"G4ParticleInelasticXS::BuildPhysicsTable(..)",
"had012",
111 data[index] =
nullptr;
117 outFile <<
"G4ParticleInelasticXS calculates n, p, d, t, he3, he4 inelastic\n"
118 <<
"cross section on nuclei using data from the high precision\n"
119 <<
"neutron database. These data are simplified and smoothed over\n"
120 <<
"the resonance region in order to reduce CPU time.\n"
121 <<
"For high energy Glauber-Gribov cross section model is used\n";
157 G4int Z = (ZZ >= MAXZINELP) ? MAXZINELP - 1 : ZZ;
158 auto pv = GetPhysicsVector(
Z);
160 G4double xs = (ekin <= pv->GetMaxEnergy()) ? pv->LogVectorValue(ekin, loge)
166 G4cout <<
"ElmXS: Z= " <<
Z <<
" Ekin(MeV)= " << ekin/CLHEP::MeV
167 <<
" xs(bn)= " << xs/CLHEP::barn <<
" element data for "
169 <<
" idx= " << index <<
G4endl;
198 G4int Z = (ZZ >= MAXZINELP) ? MAXZINELP - 1 : ZZ;
199 auto pv = GetPhysicsVector(
Z);
202 if(ekin <= elimit && amin[
Z] < amax[
Z] &&
A >= amin[
Z] &&
A <= amax[
Z]) {
204 if(pviso !=
nullptr) {
208 G4cout <<
"G4ParticleInelasticXS::IsoXS: for "
210 << ekin/CLHEP::MeV <<
" xs(b)= " << xs/CLHEP::barn
211 <<
" Z= " <<
Z <<
" A= " <<
A
212 <<
" idx= " << index <<
G4endl;
219 xs = (ekin <= pv->GetMaxEnergy()) ? pv->LogVectorValue(ekin, logE)
227 <<
" Target Z= " <<
Z <<
" A= " <<
A
228 <<
" Ekin(MeV)= " << ekin/CLHEP::MeV
229 <<
" xs(bn)= " << xs/CLHEP::barn
230 <<
" idx= " << index <<
G4endl;
242 if(1 == nIso) {
return iso; }
253 if(amax[
Z] == amin[
Z] ||
Z >= MAXZINELP) {
254 for (j=0; j<nIso; ++j) {
255 sum += abundVector[j];
265 if(nn < nIso) { temp.resize(nIso, 0.); }
267 for (j=0; j<nIso; ++j) {
273 for (j=0; j<nIso; ++j) {
286 G4cout <<
"G4ParticleInelasticXS::BuildPhysicsTable for "
293 G4Exception(
"G4ParticleInelasticXS::BuildPhysicsTable(..)",
"had012",
301 if(data[index] ==
nullptr) {
303 if(data[index] ==
nullptr) {
317 for (
auto & elm : *table ) {
318 G4int Z = std::max( 1, std::min( elm->GetZasInt(), MAXZINELP-1) );
319 if (
nullptr == (data[index])->GetElementData(
Z) ) { Initialise(
Z); }
323 std::size_t nIso = temp.size();
324 for (
auto & elm : *table ) {
325 std::size_t n = elm->GetNumberOfIsotopes();
326 if(n > nIso) { nIso = n; }
328 temp.resize(nIso, 0.0);
331const G4String& G4ParticleInelasticXS::FindDirectoryPath()
335 if(gDataDirectory[index].empty()) {
337 if (
nullptr != path) {
338 std::ostringstream ost;
340 gDataDirectory[index] = ost.str();
342 G4Exception(
"G4NeutronInelasticXS::Initialise(..)",
"had013",
344 "Environment variable G4PARTICLEXSDATA is not defined");
347 return gDataDirectory[index];
350void G4ParticleInelasticXS::InitialiseOnFly(
G4int Z)
352 if(
nullptr == data[index]->GetElementData(
Z)) {
354 if(
nullptr == data[index]->GetElementData(
Z)) {
361void G4ParticleInelasticXS::Initialise(
G4int Z)
363 if(
nullptr != data[index]->GetElementData(
Z)) {
return; }
366 std::ostringstream ost;
367 ost << FindDirectoryPath() <<
Z ;
372 if(amin[
Z] < amax[
Z]) {
373 G4int nmax = amax[
Z] - amin[
Z] + 1;
377 std::ostringstream ost1;
378 ost1 << FindDirectoryPath() <<
Z <<
"_" <<
A;
387 particle, ehigh,
Z, aeff[
Z]);
388 coeff[
Z][index] = (sig2 > 0.) ? sig1/sig2 : 1.0;
392G4ParticleInelasticXS::RetrieveVector(std::ostringstream& ost,
G4bool warn)
395 std::ifstream filein(ost.str().c_str());
396 if (!filein.is_open()) {
399 ed <<
"Data file <" << ost.str().c_str()
400 <<
"> is not opened!";
401 G4Exception(
"G4ParticleInelasticXS::RetrieveVector(..)",
"had014",
406 G4cout <<
"File " << ost.str()
407 <<
" is opened by G4ParticleInelasticXS" <<
G4endl;
413 ed <<
"Data file <" << ost.str().c_str()
414 <<
"> is not retrieved!";
415 G4Exception(
"G4ParticleInelasticXS::RetrieveVector(..)",
"had015",
std::vector< G4Element * > G4ElementTable
const char * G4FindDataDir(const char *)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
#define G4MUTEX_INITIALIZER
G4GLOB_DLL std::ostream G4cout
G4VComponentCrossSection * GetComponentCrossSection(const G4String &name)
static G4CrossSectionDataSetRegistry * Instance()
G4double GetLogKineticEnergy() const
G4double GetKineticEnergy() const
G4PhysicsVector * GetComponentDataByIndex(G4int Z, G4int idx)
void InitialiseForComponent(G4int Z, G4int nComponents=0)
void InitialiseForElement(G4int Z, G4PhysicsVector *v)
void AddComponent(G4int Z, G4int id, G4PhysicsVector *v)
void SetName(const G4String &nam)
static G4ElementTable * GetElementTable()
G4double * GetRelativeAbundanceVector() const
const G4Isotope * GetIsotope(G4int iso) const
size_t GetNumberOfIsotopes() const
static G4HadronicParameters * Instance()
const G4String & GetParticleName() const
~G4ParticleInelasticXS() final
G4double GetElementCrossSection(const G4DynamicParticle *, G4int Z, const G4Material *mat=nullptr) final
void BuildPhysicsTable(const G4ParticleDefinition &) final
G4bool IsIsoApplicable(const G4DynamicParticle *, G4int Z, G4int A, const G4Element *elm=nullptr, const G4Material *mat=nullptr) final
G4double ComputeCrossSectionPerElement(G4double kinEnergy, G4double loge, const G4ParticleDefinition *, const G4Element *, const G4Material *) final
G4ParticleInelasticXS(const G4ParticleDefinition *)
G4bool IsElementApplicable(const G4DynamicParticle *, G4int Z, const G4Material *mat=nullptr) final
G4double GetIsoCrossSection(const G4DynamicParticle *, G4int Z, G4int A, const G4Isotope *iso=nullptr, const G4Element *elm=nullptr, const G4Material *mat=nullptr) final
G4double IsoCrossSection(G4double ekin, G4double logE, G4int Z, G4int A)
G4double ComputeIsoCrossSection(G4double kinEnergy, G4double loge, const G4ParticleDefinition *, G4int Z, G4int A, const G4Isotope *iso, const G4Element *elm, const G4Material *mat) final
const G4Isotope * SelectIsotope(const G4Element *, G4double kinEnergy, G4double logE) final
G4double ElementCrossSection(G4double kinEnergy, G4double loge, G4int Z)
void CrossSectionDescription(std::ostream &) const final
G4double GetMaxEnergy() const
G4double LogVectorValue(const G4double energy, const G4double theLogEnergy) const
G4bool Retrieve(std::ifstream &fIn, G4bool ascii=false)
std::size_t GetVectorLength() const
G4double GetInelasticElementCrossSection(const G4ParticleDefinition *, G4double kinEnergy, const G4Element *)
void SetMaxKinEnergy(G4double value)
void SetForAllAtomsAndEnergies(G4bool val)