57G4double G4NeutronElasticXS::coeff[] = {0.0};
58G4String G4NeutronElasticXS::gDataDirectory =
"";
59G4bool G4NeutronElasticXS::fLock =
true;
72 G4cout <<
"G4NeutronElasticXS::G4NeutronElasticXS Initialise for Z < "
77 if (ggXsection ==
nullptr)
85 for(
G4int i=0; i<MAXZEL; ++i) {
94 outFile <<
"G4NeutronElasticXS calculates the neutron elastic scattering\n"
95 <<
"cross section on nuclei using data from the high precision\n"
96 <<
"neutron database. These data are simplified and smoothed over\n"
97 <<
"the resonance region in order to reduce CPU time.\n"
98 <<
"For high energies Glauber-Gribiv cross section is used.\n";
134 G4int Z = (ZZ >= MAXZEL) ? MAXZEL - 1 : ZZ;
135 auto pv = GetPhysicsVector(Z);
137 G4double xs = (ekin <= pv->GetMaxEnergy()) ? pv->LogVectorValue(ekin, loge)
143 G4cout <<
"Z= " << Z <<
" Ekin(MeV)= " << ekin/CLHEP::MeV
144 <<
", nElmXSel(b)= " << xs/CLHEP::barn
179 if(1 == nIso) {
return iso; }
186 for (
G4int j=0; j<nIso; ++j) {
187 sum += abundVector[j];
200 G4cout <<
"G4NeutronElasticXS::BuildPhysicsTable for "
206 <<
" only neutron is allowed";
207 G4Exception(
"G4NeutronElasticXS::BuildPhysicsTable(..)",
"had012",
211 if (fLock || isFirst) {
221 for (
auto & elm : *table ) {
222 G4int Z = std::max( 1, std::min( elm->GetZasInt(), MAXZEL-1) );
223 if (
nullptr == data[Z] ) { Initialise(Z); }
229const G4String& G4NeutronElasticXS::FindDirectoryPath()
232 if (gDataDirectory.empty()) {
233 std::ostringstream ost;
235 gDataDirectory = ost.str();
237 return gDataDirectory;
240void G4NeutronElasticXS::InitialiseOnFly(
G4int Z)
247void G4NeutronElasticXS::Initialise(
G4int Z)
249 if(data[Z] !=
nullptr) {
return; }
254 std::ostringstream ost;
255 ost << FindDirectoryPath() << Z ;
256 std::ifstream filein(ost.str().c_str());
257 if (!filein.is_open()) {
259 ed <<
"Data file <" << ost.str().c_str()
260 <<
"> is not opened!";
261 G4Exception(
"G4NeutronElasticXS::Initialise(..)",
"had014",
266 G4cout <<
"file " << ost.str()
267 <<
" is opened by G4NeutronElasticXS" <<
G4endl;
271 if(!data[Z]->Retrieve(filein,
true)) {
273 ed <<
"Data file <" << ost.str().c_str()
274 <<
"> is not retrieved!";
275 G4Exception(
"G4NeutronElasticXS::Initialise(..)",
"had015",
280 G4double sig1 = (*(data[Z]))[data[Z]->GetVectorLength()-1];
284 coeff[Z] = (sig2 > 0.) ? sig1/sig2 : 1.0;
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
static G4ElementTable * GetElementTable()
G4double * GetRelativeAbundanceVector() const
const G4Isotope * GetIsotope(G4int iso) const
size_t GetNumberOfIsotopes() const
static G4HadronicParameters * Instance()
const G4String & GetDirPARTICLEXS() const
G4bool IsElementApplicable(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
void BuildPhysicsTable(const G4ParticleDefinition &) final
G4double ComputeIsoCrossSection(G4double kinEnergy, G4double loge, const G4ParticleDefinition *, G4int Z, G4int A, const G4Isotope *iso, const G4Element *elm, const G4Material *mat) final
~G4NeutronElasticXS() final
G4double ElementCrossSection(G4double kinEnergy, G4double loge, G4int Z)
G4bool IsIsoApplicable(const G4DynamicParticle *, G4int Z, G4int A, const G4Element *, const G4Material *) final
G4double ComputeCrossSectionPerElement(G4double kinEnergy, G4double loge, const G4ParticleDefinition *, const G4Element *, const G4Material *) final
const G4Isotope * SelectIsotope(const G4Element *, G4double kinEnergy, G4double logE) final
void CrossSectionDescription(std::ostream &) const final
G4double GetElementCrossSection(const G4DynamicParticle *, G4int Z, const G4Material *) final
const G4String & GetParticleName() const
G4double GetMaxEnergy() const
G4double GetElasticElementCrossSection(const G4ParticleDefinition *, G4double kinEnergy, const G4Element *)
void SetForAllAtomsAndEnergies(G4bool val)