54G4String G4NeutronCaptureXS::gDataDirectory =
"";
67 G4cout <<
"G4NeutronCaptureXS::G4NeutronCaptureXS: Initialise for Z < "
70 logElimit =
G4Log(elimit);
75 if(isMaster) {
delete data; data =
nullptr; }
80 outFile <<
"G4NeutronCaptureXS calculates the neutron capture cross sections\n"
81 <<
"on nuclei using data from the high precision neutron database.\n"
82 <<
"These data are simplified and smoothed over the resonance region\n"
83 <<
"in order to reduce CPU time. G4NeutronCaptureXS is set to zero\n"
84 <<
"above 20 MeV for all targets. Cross section is zero also for Z>92.\n";
126 G4int Z = std::min(ZZ, MAXZCAPTURE-1);
128 if(ekin < elimit) { ekin = elimit; logEkin = logElimit; }
130 auto pv = GetPhysicsVector(
Z);
132 G4double xs = (ekin >= e1) ? pv->LogVectorValue(ekin, logEkin)
133 : (*pv)[1]*std::sqrt(e1/ekin);
137 G4cout <<
"Ekin= " << ekin/CLHEP::MeV
138 <<
" ElmXScap(b)= " << xs/CLHEP::barn <<
G4endl;
169 if(eKin > emax) {
return xs; }
171 G4int Z = std::min(ZZ, MAXZCAPTURE-1);
179 auto pv = GetPhysicsVector(
Z);
180 if(pv ==
nullptr) {
return xs; }
182 if(amin[
Z] < amax[
Z] &&
A >= amin[
Z] &&
A <= amax[
Z]) {
184 if(pviso !=
nullptr) {
187 : (*pviso)[1]*std::sqrt(e1/ekin);
190 G4cout <<
"G4NeutronCaptureXS::IsoXS: Ekin(MeV)= " << ekin/MeV
191 <<
" xs(b)= " << xs/barn
192 <<
" Z= " <<
Z <<
" A= " <<
A <<
G4endl;
200 xs = (ekin >= e1) ? pv->LogVectorValue(ekin, logEkin)
201 : (*pv)[1]*std::sqrt(e1/ekin);
204 G4cout <<
"G4NeutronCaptureXS::IsoXS: Ekin(MeV)= " << ekin/MeV
205 <<
" xs(b)= " << xs/barn
206 <<
" Z= " <<
Z <<
" A= " <<
A <<
" no iso XS" <<
G4endl;
220 if(1 == nIso) {
return iso; }
231 if(amax[
Z] == amin[
Z] ||
Z >= MAXZCAPTURE) {
232 for (j = 0; j<nIso; ++j) {
233 sum += abundVector[j];
242 if(nn < nIso) { temp.resize(nIso, 0.); }
244 for (j=0; j<nIso; ++j) {
250 for (j = 0; j<nIso; ++j) {
263 G4cout <<
"G4NeutronCaptureXS::BuildPhysicsTable for "
269 <<
" only neutron is allowed";
270 G4Exception(
"G4NeutronCaptureXS::BuildPhysicsTable(..)",
"had012",
275 if(
nullptr == data) {
277 if(
nullptr == data) {
280 data->
SetName(
"NeutronCapture");
291 for (
auto & elm : *table ) {
292 G4int Z = std::max( 1, std::min( elm->GetZasInt(), MAXZCAPTURE-1) );
297 std::size_t nIso = temp.size();
298 for (
auto & elm : *table ) {
299 std::size_t n = elm->GetNumberOfIsotopes();
300 if(n > nIso) { nIso = n; }
302 temp.resize(nIso, 0.0);
305const G4String& G4NeutronCaptureXS::FindDirectoryPath()
309 if(gDataDirectory.empty()) {
311 if (
nullptr != path) {
312 std::ostringstream ost;
313 ost << path <<
"/neutron/cap";
314 gDataDirectory = ost.str();
316 G4Exception(
"G4NeutronCaptureXS::Initialise(..)",
"had013",
318 "Environment variable G4PARTICLEXSDATA is not defined");
321 return gDataDirectory;
324void G4NeutronCaptureXS::InitialiseOnFly(
G4int Z)
331void G4NeutronCaptureXS::Initialise(
G4int Z)
336 std::ostringstream ost;
337 ost << FindDirectoryPath() <<
Z ;
342 if(amin[
Z] < amax[
Z]) {
343 G4int nmax = amax[
Z] - amin[
Z] + 1;
347 std::ostringstream ost1;
348 ost1 << gDataDirectory <<
Z <<
"_" <<
A;
349 v = RetrieveVector(ost1,
false);
356G4NeutronCaptureXS::RetrieveVector(std::ostringstream& ost,
G4bool warn)
359 std::ifstream filein(ost.str().c_str());
360 if (!filein.is_open()) {
363 ed <<
"Data file <" << ost.str().c_str()
364 <<
"> is not opened!";
365 G4Exception(
"G4NeutronCaptureXS::RetrieveVector(..)",
"had014",
370 G4cout <<
"File " << ost.str()
371 <<
" is opened by G4NeutronCaptureXS" <<
G4endl;
377 ed <<
"Data file <" << ost.str().c_str()
378 <<
"> is not retrieved!";
379 G4Exception(
"G4NeutronCaptureXS::RetrieveVector(..)",
"had015",
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
G4double G4Log(G4double x)
#define G4MUTEX_INITIALIZER
G4GLOB_DLL std::ostream G4cout
G4double GetLogKineticEnergy() const
G4double GetKineticEnergy() const
G4PhysicsVector * GetComponentDataByIndex(G4int Z, G4int idx)
void InitialiseForComponent(G4int Z, G4int nComponents=0)
void InitialiseForElement(G4int Z, G4PhysicsVector *v)
G4PhysicsVector * GetElementData(G4int Z)
void AddComponent(G4int Z, G4int id, G4PhysicsVector *v)
void SetName(const G4String &nam)
static G4ElementTable * GetElementTable()
G4double * GetRelativeAbundanceVector() const
const G4Isotope * GetIsotope(G4int iso) const
size_t GetNumberOfIsotopes() 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
~G4NeutronCaptureXS() 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)