57G4double G4NeutronInelasticXS::coeff[] = {1.0};
59G4String G4NeutronInelasticXS::gDataDirectory =
"";
71 G4cout <<
"G4NeutronInelasticXS::G4NeutronInelasticXS Initialise for Z < "
83 if(isMaster) {
delete data; data =
nullptr; }
88 outFile <<
"G4NeutronInelasticXS calculates the neutron inelastic scattering\n"
89 <<
"cross section on nuclei using data from the high precision\n"
90 <<
"neutron database. These data are simplified and smoothed over\n"
91 <<
"the resonance region in order to reduce CPU time.\n"
92 <<
"For high energy Glauber-Gribov cross section model is used\n";
119 auto pv = GetPhysicsVector(Z);
120 if(pv ==
nullptr) {
return xs; }
124 if(ekin <= pv->GetMaxEnergy()) {
133 G4cout <<
"Z= " << Z <<
" Ekin(MeV)= " << ekin/CLHEP::MeV
134 <<
", ElmXSinel(b)= " << xs/CLHEP::barn
163 auto pv = GetPhysicsVector(Z);
164 if(pv ==
nullptr) {
return xs; }
167 const G4double emax = pv->GetMaxEnergy();
168 if(ekin <= emax && amin[Z] > 0 &&
A >= amin[Z] &&
A <= amax[Z]) {
174 G4cout <<
"G4NeutronInelasticXS::IsoXS: Ekin(MeV)= "
176 <<
" xs(b)= " << xs/CLHEP::barn
177 <<
" Z= " << Z <<
" A= " <<
A <<
G4endl;
186 xs = pv->LogVectorValue(ekin, logekin);
194 G4cout <<
"G4NeutronInelasticXS::IsoXS: Z= " << Z <<
" A= " <<
A
195 <<
" Ekin(MeV)= " << ekin/CLHEP::MeV
196 <<
", ElmXS(b)= " << xs/CLHEP::barn <<
G4endl;
209 if(1 == nIso) {
return iso; }
222 for (j=0; j<nIso; ++j) {
223 sum += abundVector[j];
233 size_t nn = temp.size();
234 if(nn < nIso) { temp.resize(nIso, 0.); }
236 for (j=0; j<nIso; ++j) {
244 for (j = 0; j<nIso; ++j) {
257 G4cout <<
"G4NeutronInelasticXS::BuildPhysicsTable for "
263 <<
" only neutron is allowed";
264 G4Exception(
"G4NeutronInelasticXS::BuildPhysicsTable(..)",
"had012",
269 if(
nullptr == data) {
270#ifdef G4MULTITHREADED
272 if(
nullptr == data) {
276 data->
SetName(
"NeutronInelastic");
278#ifdef G4MULTITHREADED
289 size_t numOfCouples = theCoupleTable->GetTableSize();
290 for(
size_t j=0; j<numOfCouples; ++j) {
291 auto mat = theCoupleTable->GetMaterialCutsCouple(j)->GetMaterial();
292 auto elmVec = mat->GetElementVector();
293 size_t numOfElem = mat->GetNumberOfElements();
294 for (
size_t ie = 0; ie < numOfElem; ++ie) {
295 G4int Z = std::max(1,std::min(((*elmVec)[ie])->GetZasInt(),
MAXZINEL-1));
302const G4String& G4NeutronInelasticXS::FindDirectoryPath()
306 if(gDataDirectory.empty()) {
307 char* path = std::getenv(
"G4PARTICLEXSDATA");
309 std::ostringstream ost;
310 ost << path <<
"/neutron/inel";
311 gDataDirectory = ost.str();
313 G4Exception(
"G4NeutronInelasticXS::Initialise(..)",
"had013",
315 "Environment variable G4PARTICLEXSDATA is not defined");
318 return gDataDirectory;
321void G4NeutronInelasticXS::InitialiseOnFly(
G4int Z)
323#ifdef G4MULTITHREADED
328#ifdef G4MULTITHREADED
334void G4NeutronInelasticXS::Initialise(
G4int Z)
339 std::ostringstream ost;
340 ost << FindDirectoryPath() << Z;
350 size_t nmax = (size_t)(amax[Z]-amin[Z]+1);
353 for(
G4int A=amin[Z];
A<=amax[Z]; ++
A) {
354 std::ostringstream ost1;
355 ost1 << gDataDirectory << Z <<
"_" <<
A;
366 coeff[Z] = (sig2 > 0.) ? sig1/sig2 : 1.0;
370G4NeutronInelasticXS::RetrieveVector(std::ostringstream& ost,
G4bool warn)
373 std::ifstream filein(ost.str().c_str());
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",
#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
void InitialiseForComponent(G4int Z, G4int nComponents=0)
void InitialiseForElement(G4int Z, G4PhysicsVector *v)
G4PhysicsVector * GetElementData(G4int Z)
G4PhysicsVector * GetComponentDataByIndex(G4int Z, size_t idx)
void AddComponent(G4int Z, G4int id, G4PhysicsVector *v)
void SetName(const G4String &nam)
G4double * GetRelativeAbundanceVector() const
const G4Isotope * GetIsotope(G4int iso) const
size_t GetNumberOfIsotopes() const
G4double IsoCrossSection(G4double ekin, G4double logekin, G4int Z, G4int A)
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
virtual G4bool Retrieve(std::ifstream &fIn, G4bool ascii) final
G4double GetMaxEnergy() const
std::size_t GetVectorLength() const
G4double LogVectorValue(const G4double theEnergy, const G4double theLogEnergy) const
static G4ProductionCutsTable * GetProductionCutsTable()
G4double GetInelasticElementCrossSection(const G4ParticleDefinition *, G4double kinEnergy, const G4Element *)
void SetForAllAtomsAndEnergies(G4bool val)