56G4double G4NeutronInelasticXS::coeff[] = {1.0};
58G4String G4NeutronInelasticXS::gDataDirectory =
"";
60static std::once_flag applyOnce;
74 G4cout <<
"G4NeutronInelasticXS::G4NeutronInelasticXS Initialise for Z < "
77 if (
nullptr == data) {
84 if(ggXsection ==
nullptr)
91 outFile <<
"G4NeutronInelasticXS calculates the neutron inelastic scattering\n"
92 <<
"cross section on nuclei using data from the high precision\n"
93 <<
"neutron database. These data are simplified and smoothed over\n"
94 <<
"the resonance region in order to reduce CPU time.\n"
95 <<
"For high energy Glauber-Gribov cross section model is used\n";
133 G4int Z = (ZZ >= MAXZINEL) ? MAXZINEL - 1 : ZZ;
134 auto pv = GetPhysicsVector(Z);
136 G4double xs = (ekin <= pv->GetMaxEnergy()) ? pv->LogVectorValue(ekin, loge)
142 G4cout <<
"G4NeutronInelasticXS::ElementCrossSection Z= " << Z
143 <<
" Ekin(MeV)= " << ekin/CLHEP::MeV
144 <<
", ElmXSinel(b)= " << xs/CLHEP::barn
176 G4int Z = (ZZ >= MAXZINEL) ? MAXZINEL - 1 : ZZ;
178 auto pv = GetPhysicsVector(Z);
188 if (ekin <= elimit && data->GetNumberOfComponents(Z) > 0) {
190 if (
nullptr != pviso) {
191 xs = pviso->LogVectorValue(ekin, logekin);
194 G4cout <<
"G4NeutronInelasticXS::IsoXS: Ekin(MeV)= "
196 <<
" xs(b)= " << xs/CLHEP::barn
197 <<
" Z= " << Z <<
" A= " <<
A <<
G4endl;
205 xs = (ekin <= pv->GetMaxEnergy()) ? pv->LogVectorValue(ekin, logekin)
211 G4cout <<
"G4NeutronInelasticXS::IsoXS: Z= " << Z <<
" A= " <<
A
212 <<
" Ekin(MeV)= " << ekin/CLHEP::MeV
213 <<
", ElmXS(b)= " << xs/CLHEP::barn <<
G4endl;
224 if(1 == nIso) {
return iso; }
237 for (j=0; j<nIso; ++j) {
238 sum += abundVector[j];
249 if(nn < nIso) { temp.resize(nIso, 0.); }
251 for (j=0; j<nIso; ++j) {
259 for (j = 0; j<nIso; ++j) {
260 if (temp[j] >= sum) {
272 G4cout <<
"G4NeutronInelasticXS::BuildPhysicsTable for "
278 <<
" only neutron is allowed";
279 G4Exception(
"G4NeutronInelasticXS::BuildPhysicsTable(..)",
"had012",
287 std::call_once(applyOnce, [
this]() { isInitializer =
true; });
293 for (
auto const & elm : *table ) {
294 G4int Z = std::max( 1, std::min( elm->GetZasInt(), MAXZINEL-1) );
300 std::size_t nIso = temp.size();
301 for (
auto const & elm : *table ) {
302 std::size_t n = elm->GetNumberOfIsotopes();
303 if (n > nIso) { nIso = n; }
305 temp.resize(nIso, 0.0);
308const G4String& G4NeutronInelasticXS::FindDirectoryPath()
311 if (gDataDirectory.empty()) {
312 std::ostringstream ost;
314 gDataDirectory = ost.str();
316 return gDataDirectory;
319void G4NeutronInelasticXS::InitialiseOnFly(
G4int Z)
326void G4NeutronInelasticXS::Initialise(
G4int Z)
331 std::ostringstream ost;
332 ost << FindDirectoryPath() << Z;
336 G4cout <<
"G4NeutronInelasticXS::Initialise for Z= " << Z
337 <<
" A= " << aeff[Z] <<
" Amin= " << amin[Z]
338 <<
" Amax= " << amax[Z] <<
G4endl;
342 if (amin[Z] < amax[Z]) {
344 for (
G4int A=amin[Z];
A<=amax[Z]; ++
A) {
345 std::ostringstream ost1;
346 ost1 << gDataDirectory << Z <<
"_" <<
A;
350 G4int nmax = amax[Z] -
A + 1;
366 coeff[Z] = (sig2 > 0.) ? sig1/sig2 : 1.0;
370G4NeutronInelasticXS::RetrieveVector(std::ostringstream& ost,
G4bool warn)
373 std::ifstream filein(ost.str().c_str());
374 if (!filein.is_open()) {
377 ed <<
"Data file <" << ost.str().c_str()
378 <<
"> is not opened!";
379 G4Exception(
"G4NeutronInelasticXS::RetrieveVector(..)",
"had014",
384 G4cout <<
"File " << ost.str()
385 <<
" is opened by G4NeutronInelasticXS" <<
G4endl;
391 ed <<
"Data file <" << ost.str().c_str()
392 <<
"> is not retrieved!";
393 G4Exception(
"G4NeutronInelasticXS::RetrieveVector(..)",
"had015",
std::vector< G4Element * > G4ElementTable
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 * GetElementData(G4int Z) const
void InitialiseForComponent(G4int Z, G4int nComponents=0)
void InitialiseForElement(G4int Z, G4PhysicsVector *v)
void AddComponent(G4int Z, G4int id, G4PhysicsVector *v)
G4PhysicsVector * GetComponentDataByID(G4int Z, G4int id) const
std::size_t GetNumberOfComponents(G4int Z) const
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 & GetDirPARTICLEXS() const
G4double ComputeCrossSectionPerElement(G4double kinEnergy, G4double loge, const G4ParticleDefinition *, const G4Element *, const G4Material *) final
G4double ComputeIsoCrossSection(G4double kinEnergy, G4double loge, const G4ParticleDefinition *, G4int Z, G4int A, const G4Isotope *iso, const G4Element *elm, const G4Material *mat) final
G4double IsoCrossSection(G4double ekin, G4double logekin, G4int Z, G4int A)
G4double ElementCrossSection(G4double kinEnergy, G4double loge, G4int Z)
G4bool IsElementApplicable(const G4DynamicParticle *, G4int Z, const G4Material *) final
void BuildPhysicsTable(const G4ParticleDefinition &) final
G4bool IsIsoApplicable(const G4DynamicParticle *, G4int Z, G4int A, const G4Element *, const G4Material *) final
void CrossSectionDescription(std::ostream &) const final
const G4Isotope * SelectIsotope(const G4Element *, G4double kinEnergy, G4double logE) final
G4double GetElementCrossSection(const G4DynamicParticle *, G4int Z, const G4Material *) final
G4double GetIsoCrossSection(const G4DynamicParticle *, G4int Z, G4int A, const G4Isotope *iso, const G4Element *elm, const G4Material *mat) final
const G4String & GetParticleName() const
G4double GetMaxEnergy() const
G4bool Retrieve(std::ifstream &fIn, G4bool ascii=false)
std::size_t GetVectorLength() const
G4double GetInelasticElementCrossSection(const G4ParticleDefinition *, G4double kinEnergy, const G4Element *)
void SetForAllAtomsAndEnergies(G4bool val)