56G4double G4NeutronElasticXS::coeff[] = {0.0};
57G4String G4NeutronElasticXS::gDataDirectory =
"";
70 G4cout <<
"G4NeutronElasticXS::G4NeutronElasticXS Initialise for Z < "
81 for(
G4int i=0; i<MAXZEL; ++i) {
90 outFile <<
"G4NeutronElasticXS calculates the neutron elastic scattering\n"
91 <<
"cross section on nuclei using data from the high precision\n"
92 <<
"neutron database. These data are simplified and smoothed over\n"
93 <<
"the resonance region in order to reduce CPU time.\n"
94 <<
"For high energies Glauber-Gribiv cross section is used.\n";
129 G4int Z = (ZZ >= MAXZEL) ? MAXZEL - 1 : ZZ;
130 auto pv = GetPhysicsVector(
Z);
132 G4double xs = (ekin <= pv->GetMaxEnergy()) ? pv->LogVectorValue(ekin, loge)
138 G4cout <<
"Z= " <<
Z <<
" Ekin(MeV)= " << ekin/CLHEP::MeV
139 <<
", nElmXSel(b)= " << xs/CLHEP::barn
174 if(1 == nIso) {
return iso; }
181 for (
G4int j=0; j<nIso; ++j) {
182 sum += abundVector[j];
195 G4cout <<
"G4NeutronElasticXS::BuildPhysicsTable for "
201 <<
" only neutron is allowed";
202 G4Exception(
"G4NeutronElasticXS::BuildPhysicsTable(..)",
"had012",
221 for (
auto & elm : *table ) {
222 G4int Z = std::max( 1, std::min( elm->GetZasInt(), MAXZEL-1) );
223 if (
nullptr == data[
Z] ) { Initialise(
Z); }
228const G4String& G4NeutronElasticXS::FindDirectoryPath()
232 if(gDataDirectory.empty()) {
234 if (
nullptr != path) {
235 std::ostringstream ost;
236 ost << path <<
"/neutron/el";
237 gDataDirectory = ost.str();
239 G4Exception(
"G4NeutronElasticXS::Initialise(..)",
"had013",
241 "Environment variable G4PARTICLEXSDATA is not defined");
244 return gDataDirectory;
247void G4NeutronElasticXS::InitialiseOnFly(
G4int Z)
249 if(
nullptr == data[
Z]) {
251 if(
nullptr == data[
Z]) { Initialise(
Z); }
256void G4NeutronElasticXS::Initialise(
G4int Z)
258 if(data[
Z] !=
nullptr) {
return; }
263 std::ostringstream ost;
264 ost << FindDirectoryPath() <<
Z ;
265 std::ifstream filein(ost.str().c_str());
266 if (!filein.is_open()) {
268 ed <<
"Data file <" << ost.str().c_str()
269 <<
"> is not opened!";
270 G4Exception(
"G4NeutronElasticXS::Initialise(..)",
"had014",
275 G4cout <<
"file " << ost.str()
276 <<
" is opened by G4NeutronElasticXS" <<
G4endl;
280 if(!data[
Z]->Retrieve(filein,
true)) {
282 ed <<
"Data file <" << ost.str().c_str()
283 <<
"> is not retrieved!";
284 G4Exception(
"G4NeutronElasticXS::Initialise(..)",
"had015",
293 coeff[
Z] = (sig2 > 0.) ? sig1/sig2 : 1.0;
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
static G4ElementTable * GetElementTable()
G4double * GetRelativeAbundanceVector() const
const G4Isotope * GetIsotope(G4int iso) const
size_t GetNumberOfIsotopes() 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
std::size_t GetVectorLength() const
G4double GetElasticElementCrossSection(const G4ParticleDefinition *, G4double kinEnergy, const G4Element *)
void SetForAllAtomsAndEnergies(G4bool val)