56G4String G4NeutronCaptureXS::gDataDirectory =
"";
58static std::once_flag applyOnce;
71 G4cout <<
"G4NeutronCaptureXS::G4NeutronCaptureXS: Initialise for Z < "
74 logElimit =
G4Log(elimit);
75 if (
nullptr == data) {
84 outFile <<
"G4NeutronCaptureXS calculates the neutron capture cross sections\n"
85 <<
"on nuclei using data from the high precision neutron database.\n"
86 <<
"These data are simplified and smoothed over the resonance region\n"
87 <<
"in order to reduce CPU time. G4NeutronCaptureXS is set to zero\n"
88 <<
"above 20 MeV for all targets. For Z > 92 the cross section of\n"
89 <<
"Uranium is used.\n";
135 G4int Z = std::min(ZZ, MAXZCAPTURE-1);
137 if (ekin < elimit) { ekin = elimit; logEkin = logElimit; }
139 auto pv = GetPhysicsVector(Z);
141 G4double xs = (ekin >= e1) ? pv->LogVectorValue(ekin, logEkin)
142 : (*pv)[1]*std::sqrt(e1/ekin);
146 G4cout <<
"Ekin= " << ekin/CLHEP::MeV
147 <<
" ElmXScap(b)= " << xs/CLHEP::barn <<
G4endl;
178 if (eKin > emax) {
return xs; }
180 G4int Z = std::min(ZZ, MAXZCAPTURE-1);
188 auto pv = GetPhysicsVector(Z);
189 if (pv ==
nullptr) {
return xs; }
193 if(pviso !=
nullptr) {
196 : (*pviso)[1]*std::sqrt(e1/ekin);
199 G4cout <<
"G4NeutronCaptureXS::IsoXS: Ekin(MeV)= " << ekin/MeV
200 <<
" xs(b)= " << xs/barn
201 <<
" Z= " << Z <<
" A= " <<
A <<
G4endl;
209 xs = (ekin >= e1) ? pv->LogVectorValue(ekin, logEkin)
210 : (*pv)[1]*std::sqrt(e1/ekin);
213 G4cout <<
"G4NeutronCaptureXS::IsoXS: Ekin(MeV)= " << ekin/MeV
214 <<
" xs(b)= " << xs/barn
215 <<
" Z= " << Z <<
" A= " <<
A <<
" no iso XS" <<
G4endl;
229 if(1 == nIso) {
return iso; }
242 for (j = 0; j<nIso; ++j) {
243 sum += abundVector[j];
252 if (nn < nIso) { temp.resize(nIso, 0.); }
254 for (j=0; j<nIso; ++j) {
260 for (j = 0; j<nIso; ++j) {
261 if (temp[j] >= sum) {
273 G4cout <<
"G4NeutronCaptureXS::BuildPhysicsTable for "
279 <<
" only neutron is allowed";
280 G4Exception(
"G4NeutronCaptureXS::BuildPhysicsTable(..)",
"had012",
289 std::call_once(applyOnce, [
this]() { isInitializer =
true; });
294 for (
auto const & elm : *table ) {
295 G4int Z = std::max( 1, std::min( elm->GetZasInt(), MAXZCAPTURE-1) );
302 std::size_t nIso = temp.size();
303 for (
auto const & elm : *table ) {
304 std::size_t n = elm->GetNumberOfIsotopes();
305 if (n > nIso) { nIso = n; }
307 temp.resize(nIso, 0.0);
310const G4String& G4NeutronCaptureXS::FindDirectoryPath()
313 if(gDataDirectory.empty()) {
314 std::ostringstream ost;
316 gDataDirectory = ost.str();
318 return gDataDirectory;
321void G4NeutronCaptureXS::InitialiseOnFly(
G4int Z)
328void G4NeutronCaptureXS::Initialise(
G4int Z)
333 std::ostringstream ost;
334 ost << FindDirectoryPath() << Z ;
340 if (amin[Z] < amax[Z]) {
341 for(
G4int A=amin[Z];
A<=amax[Z]; ++
A) {
342 std::ostringstream ost1;
343 ost1 << gDataDirectory << Z <<
"_" <<
A;
347 G4int nmax = amax[Z] -
A + 1;
360G4NeutronCaptureXS::RetrieveVector(std::ostringstream& ost,
G4bool warn)
363 std::ifstream filein(ost.str().c_str());
364 if (!filein.is_open()) {
367 ed <<
"Data file <" << ost.str().c_str()
368 <<
"> is not opened!";
369 G4Exception(
"G4NeutronCaptureXS::RetrieveVector(..)",
"had014",
374 G4cout <<
"File " << ost.str()
375 <<
" is opened by G4NeutronCaptureXS" <<
G4endl;
381 ed <<
"Data file <" << ost.str().c_str()
382 <<
"> is not retrieved!";
383 G4Exception(
"G4NeutronCaptureXS::RetrieveVector(..)",
"had015",
std::vector< G4Element * > G4ElementTable
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
G4double G4Log(G4double x)
#define G4MUTEX_INITIALIZER
G4GLOB_DLL std::ostream G4cout
G4double GetLogKineticEnergy() const
G4double GetKineticEnergy() const
G4PhysicsVector * GetElementData(G4int Z) const
void InitialiseForComponent(G4int Z, G4int nComponents=0)
void InitialiseForElement(G4int Z, G4PhysicsVector *v)
void AddComponent(G4int Z, G4int id, G4PhysicsVector *v)
G4PhysicsVector * GetComponentDataByID(G4int Z, G4int id) const
std::size_t GetNumberOfComponents(G4int Z) const
void SetName(const G4String &nam)
static G4ElementTable * GetElementTable()
G4double * GetRelativeAbundanceVector() const
const G4Isotope * GetIsotope(G4int iso) const
size_t GetNumberOfIsotopes() const
static G4HadronicParameters * Instance()
const G4String & GetDirPARTICLEXS() const
G4double ComputeIsoCrossSection(G4double kinEnergy, G4double loge, const G4ParticleDefinition *, G4int Z, G4int A, const G4Isotope *iso, const G4Element *elm, const G4Material *mat) final
void CrossSectionDescription(std::ostream &) const final
G4bool IsIsoApplicable(const G4DynamicParticle *, G4int Z, G4int A, const G4Element *, const G4Material *) final
G4double GetIsoCrossSection(const G4DynamicParticle *, G4int Z, G4int A, const G4Isotope *iso, const G4Element *elm, const G4Material *mat) final
const G4Isotope * SelectIsotope(const G4Element *, G4double kinEnergy, G4double logE) final
G4bool IsElementApplicable(const G4DynamicParticle *, G4int Z, const G4Material *) final
G4double IsoCrossSection(G4double ekin, G4double logekin, G4int Z, G4int A)
G4double ElementCrossSection(G4double kinEnergy, G4double loge, G4int Z)
void BuildPhysicsTable(const G4ParticleDefinition &) final
G4double ComputeCrossSectionPerElement(G4double kinEnergy, G4double loge, const G4ParticleDefinition *, const G4Element *, const G4Material *) final
G4double GetElementCrossSection(const G4DynamicParticle *, G4int Z, const G4Material *) final
const G4String & GetParticleName() const
G4double Energy(const std::size_t index) const
G4double LogVectorValue(const G4double energy, const G4double theLogEnergy) const
G4bool Retrieve(std::ifstream &fIn, G4bool ascii=false)