53G4double G4NeutronInelasticXS::coeff[] = {1.0};
55G4String G4NeutronInelasticXS::gDataDirectory =
"";
69 G4cout <<
"G4NeutronInelasticXS::G4NeutronInelasticXS Initialise for Z < "
79 if(isMaster) {
delete data; data =
nullptr; }
84 outFile <<
"G4NeutronInelasticXS calculates the neutron inelastic scattering\n"
85 <<
"cross section on nuclei using data from the high precision\n"
86 <<
"neutron database. These data are simplified and smoothed over\n"
87 <<
"the resonance region in order to reduce CPU time.\n"
88 <<
"For high energy Glauber-Gribov cross section model is used\n";
124 G4int Z = (ZZ >= MAXZINEL) ? MAXZINEL - 1 : ZZ;
125 auto pv = GetPhysicsVector(
Z);
127 G4double xs = (ekin <= pv->GetMaxEnergy()) ? pv->LogVectorValue(ekin, loge)
133 G4cout <<
"Z= " <<
Z <<
" Ekin(MeV)= " << ekin/CLHEP::MeV
134 <<
", ElmXSinel(b)= " << xs/CLHEP::barn
166 G4int Z = (ZZ >= MAXZINEL) ? MAXZINEL - 1 : ZZ;
173 auto pv = GetPhysicsVector(
Z);
176 if(ekin <= elimit && amin[
Z] < amax[
Z] &&
A >= amin[
Z] &&
A <= amax[
Z]) {
178 if(
nullptr != pviso) {
182 G4cout <<
"G4NeutronInelasticXS::IsoXS: Ekin(MeV)= "
184 <<
" xs(b)= " << xs/CLHEP::barn
185 <<
" Z= " <<
Z <<
" A= " <<
A <<
G4endl;
193 xs = (ekin <= pv->GetMaxEnergy()) ? pv->LogVectorValue(ekin, logekin)
199 G4cout <<
"G4NeutronInelasticXS::IsoXS: Z= " <<
Z <<
" A= " <<
A
200 <<
" Ekin(MeV)= " << ekin/CLHEP::MeV
201 <<
", ElmXS(b)= " << xs/CLHEP::barn <<
G4endl;
214 if(1 == nIso) {
return iso; }
226 if(amax[
Z] == amin[
Z] ||
Z >= MAXZINEL) {
227 for (j=0; j<nIso; ++j) {
228 sum += abundVector[j];
239 if(nn < nIso) { temp.resize(nIso, 0.); }
241 for (j=0; j<nIso; ++j) {
249 for (j = 0; j<nIso; ++j) {
262 G4cout <<
"G4NeutronInelasticXS::BuildPhysicsTable for "
268 <<
" only neutron is allowed";
269 G4Exception(
"G4NeutronInelasticXS::BuildPhysicsTable(..)",
"had012",
274 if(
nullptr == data) {
276 if(
nullptr == data) {
279 data->
SetName(
"NeutronInelastic");
289 for (
auto & elm : *table ) {
290 G4int Z = std::max( 1, std::min( elm->GetZasInt(), MAXZINEL-1) );
295 std::size_t nIso = temp.size();
296 for (
auto & elm : *table ) {
297 std::size_t n = elm->GetNumberOfIsotopes();
298 if(n > nIso) { nIso = n; }
300 temp.resize(nIso, 0.0);
303const G4String& G4NeutronInelasticXS::FindDirectoryPath()
307 if(gDataDirectory.empty()) {
309 if (
nullptr != path) {
310 std::ostringstream ost;
311 ost << path <<
"/neutron/inel";
312 gDataDirectory = ost.str();
314 G4Exception(
"G4NeutronInelasticXS::Initialise(..)",
"had013",
316 "Environment variable G4PARTICLEXSDATA is not defined");
319 return gDataDirectory;
322void G4NeutronInelasticXS::InitialiseOnFly(
G4int Z)
331void G4NeutronInelasticXS::Initialise(
G4int Z)
336 std::ostringstream ost;
337 ost << FindDirectoryPath() <<
Z;
341 G4cout <<
"G4NeutronInelasticXS::Initialise for Z= " <<
Z
342 <<
" A= " << aeff[
Z] <<
" Amin= " << amin[
Z]
343 <<
" Amax= " << amax[
Z] <<
G4endl;
346 if(amin[
Z] < amax[
Z]) {
347 G4int nmax = amax[
Z] - amin[
Z] + 1;
351 std::ostringstream ost1;
352 ost1 << gDataDirectory <<
Z <<
"_" <<
A;
363 coeff[
Z] = (sig2 > 0.) ? sig1/sig2 : 1.0;
367G4NeutronInelasticXS::RetrieveVector(std::ostringstream& ost,
G4bool warn)
370 std::ifstream filein(ost.str().c_str());
371 if (!filein.is_open()) {
374 ed <<
"Data file <" << ost.str().c_str()
375 <<
"> is not opened!";
376 G4Exception(
"G4NeutronInelasticXS::RetrieveVector(..)",
"had014",
381 G4cout <<
"File " << ost.str()
382 <<
" is opened by G4NeutronInelasticXS" <<
G4endl;
388 ed <<
"Data file <" << ost.str().c_str()
389 <<
"> is not retrieved!";
390 G4Exception(
"G4NeutronInelasticXS::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)
G4PhysicsVector * GetElementData(G4int Z)
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
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
~G4NeutronInelasticXS() 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
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 SetForAllAtomsAndEnergies(G4bool val)