60G4double G4NeutronElasticXS::coeff[] = {0.0};
61G4String G4NeutronElasticXS::gDataDirectory =
"";
75 G4cout <<
"G4NeutronElasticXS::G4NeutronElasticXS Initialise for Z < "
95 outFile <<
"G4NeutronElasticXS calculates the neutron elastic scattering\n"
96 <<
"cross section on nuclei using data from the high precision\n"
97 <<
"neutron database. These data are simplified and smoothed over\n"
98 <<
"the resonance region in order to reduce CPU time.\n"
99 <<
"For high energies Glauber-Gribiv cross section is used.\n";
125 auto pv = GetPhysicsVector(Z);
126 if(pv ==
nullptr) {
return xs; }
130 if(ekin <= pv->Energy(1)) {
132 }
else if(ekin <= pv->GetMaxEnergy()) {
141 G4cout <<
"Z= " << Z <<
" Ekin(MeV)= " << ekin/CLHEP::MeV
142 <<
", nElmXSel(b)= " << xs/CLHEP::barn
165 if(1 == nIso) {
return iso; }
173 for (j=0; j<nIso; ++j) {
174 sum += abundVector[j];
187 G4cout <<
"G4NeutronElasticXS::BuildPhysicsTable for "
193 <<
" only neutron is allowed";
194 G4Exception(
"G4NeutronElasticXS::BuildPhysicsTable(..)",
"had012",
199#ifdef G4MULTITHREADED
206#ifdef G4MULTITHREADED
217 size_t numOfCouples = theCoupleTable->GetTableSize();
218 for(
size_t j=0; j<numOfCouples; ++j) {
219 auto mat = theCoupleTable->GetMaterialCutsCouple(j)->GetMaterial();
220 auto elmVec = mat->GetElementVector();
221 size_t numOfElem = mat->GetNumberOfElements();
222 for (
size_t ie = 0; ie < numOfElem; ++ie) {
223 G4int Z = std::max(1,std::min(((*elmVec)[ie])->GetZasInt(),
MAXZEL-1));
224 if(data[Z] ==
nullptr) { Initialise(Z); }
230const G4String& G4NeutronElasticXS::FindDirectoryPath()
234 if(gDataDirectory.empty()) {
235 char* path = std::getenv(
"G4PARTICLEXSDATA");
237 std::ostringstream ost;
238 ost << path <<
"/neutron/el";
239 gDataDirectory = ost.str();
241 G4Exception(
"G4NeutronElasticXS::Initialise(..)",
"had013",
243 "Environment variable G4PARTICLEXSDATA is not defined");
246 return gDataDirectory;
249void G4NeutronElasticXS::InitialiseOnFly(
G4int Z)
251#ifdef G4MULTITHREADED
253 if(data[Z] ==
nullptr) {
256#ifdef G4MULTITHREADED
262void G4NeutronElasticXS::Initialise(
G4int Z)
264 if(data[Z] !=
nullptr) {
return; }
269 std::ostringstream ost;
270 ost << FindDirectoryPath() << Z ;
271 std::ifstream filein(ost.str().c_str());
274 ed <<
"Data file <" << ost.str().c_str()
275 <<
"> is not opened!";
276 G4Exception(
"G4NeutronElasticXS::Initialise(..)",
"had014",
281 G4cout <<
"file " << ost.str()
282 <<
" is opened by G4NeutronElasticXS" <<
G4endl;
286 if(!data[Z]->Retrieve(filein,
true)) {
288 ed <<
"Data file <" << ost.str().c_str()
289 <<
"> is not retrieved!";
290 G4Exception(
"G4NeutronElasticXS::Initialise(..)",
"had015",
299 coeff[Z] = (sig2 > 0.) ? sig1/sig2 : 1.0;
#define G4_DECLARE_XS_FACTORY(cross_section)
double A(double temperature)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
#define G4MUTEX_INITIALIZER
#define G4MUTEXLOCK(mutex)
#define G4MUTEXUNLOCK(mutex)
G4GLOB_DLL std::ostream G4cout
G4VComponentCrossSection * GetComponentCrossSection(const G4String &name)
static G4CrossSectionDataSetRegistry * Instance()
G4double GetLogKineticEnergy() const
G4double GetKineticEnergy() const
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
~G4NeutronElasticXS() final
G4bool IsIsoApplicable(const G4DynamicParticle *, G4int Z, G4int A, 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
static G4ProductionCutsTable * GetProductionCutsTable()
G4double GetElasticElementCrossSection(const G4ParticleDefinition *, G4double kinEnergy, const G4Element *)
void SetForAllAtomsAndEnergies(G4bool val)