54 const G4int G4NeutronCaptureXS::amin[] = {0,
55 0, 0, 6, 0,10,12,14,16, 0, 0,
56 0, 0, 0,28, 0, 0, 0,36, 0,40,
57 0, 0, 0, 0, 0,54, 0,58,63,64,
58 0,70, 0, 0, 0, 0, 0, 0, 0,90,
59 0, 0, 0, 0, 0, 0,107,106, 0,112,
60 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
61 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
62 0, 0, 0,180, 0, 0, 0, 0, 0, 0,
63 0,204, 0, 0, 0, 0, 0, 0, 0, 0,
65 const G4int G4NeutronCaptureXS::amax[] = {0,
66 0, 0, 7, 0,11,13,15,18, 0, 0,
67 0, 0, 0,30, 0, 0, 0,40, 0,48,
68 0, 0, 0, 0, 0,58, 0,64,65,70,
69 0,76, 0, 0, 0, 0, 0, 0, 0,96,
70 0, 0, 0, 0, 0, 0,109,116, 0,124,
71 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
72 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
73 0, 0, 0,186, 0, 0, 0, 0, 0, 0,
74 0,208, 0, 0, 0, 0, 0, 0, 0, 0,
79 emax(20*
MeV),elimit(1.0e-10*
eV)
83 G4cout <<
"G4NeutronCaptureXS::G4NeutronCaptureXS: Initialise for Z < "
86 data.SetName(
"NeutronCapture");
89 isInitialized =
false;
97 outFile <<
"G4NeutronCaptureXS calculates the neutron capture cross sections\n"
98 <<
"on nuclei using data from the high precision neutron database.\n"
99 <<
"These data are simplified and smoothed over the resonance region\n"
100 <<
"in order to reduce CPU time. G4NeutronCaptureXS is valid up to\n"
101 <<
"20 MeV for all targets through U.\n";
125 if(ekin > emax || Z < 1 || Z >=
MAXZCAPTURE) {
return xs; }
126 if(ekin < elimit) { ekin = elimit; }
133 pv =
data.GetElementData(Z);
134 if(!pv) {
return xs; }
138 if(ekin < e1) { xs = (*pv)[0]*std::sqrt(e1/ekin); }
139 else if(ekin <= pv->GetMaxEnergy()) { xs = pv->
Value(ekin); }
156 xs = IsoCrossSection(ekin, Z, A);
164 if(ekin < elimit) { ekin = elimit; }
171 pv =
data.GetElementData(Z);
172 if(!pv) {
return xs; }
175 if(pviso) { pv = pviso; }
178 if(ekin < e1) { xs = (*pv)[1]*std::sqrt(e1/ekin); }
179 else if(ekin <= pv->GetMaxEnergy()) { xs = pv->
Value(ekin); }
182 G4cout <<
"G4NeutronCaptureXS::IsoCrossSection: Ekin(MeV)= " << ekin/
MeV
183 <<
" xs(b)= " << xs/
barn
208 sum += abundVector[j];
210 iso = (*isoVector)[j];
215 size_t nmax =
data.GetNumberOfComponents(Z);
216 if(temp.size() <
nmax) { temp.resize(nmax,0.0); }
217 for (
size_t i=0; i<
nmax; ++i) {
218 G4int A = (*isoVector)[i]->GetN();
219 sum += abundVector[i]*IsoCrossSection(kinEnergy, Z, A);
223 for (
size_t j = 0; j<
nmax; ++j) {
225 iso = (*isoVector)[j];
237 if(isInitialized) {
return; }
239 G4cout <<
"G4NeutronCaptureXS::BuildPhysicsTable for "
245 <<
" only neutron is allowed";
246 G4Exception(
"G4NeutronCaptureXS::BuildPhysicsTable(..)",
"had012",
250 isInitialized =
true;
254 char* path = getenv(
"G4NEUTRONXSDATA");
260 for(
size_t i=0; i<numOfElm; ++i) {
266 if(!
data.GetElementData(Z)) { Initialise(Z, path); }
272 G4NeutronCaptureXS::Initialise(
G4int Z,
const char*
p)
274 if(
data.GetElementData(Z)) {
return; }
275 const char* path =
p;
279 path = getenv(
"G4NEUTRONXSDATA");
282 "Environment variable G4NEUTRONXSDATA is not defined");
288 std::ostringstream ost;
289 ost << path <<
"/cap" <<
Z ;
291 data.InitialiseForElement(Z, v);
297 size_t nmax = (size_t)(amax[Z]-amin[Z]+1);
298 if(work.size() <
nmax) { work.resize(nmax,0); }
299 for(
G4int A=amin[Z]; A<=amax[
Z]; ++A) {
300 std::ostringstream ost1;
301 ost1 << path <<
"/cap" << Z <<
"_" << A;
302 v = RetrieveVector(ost1,
false);
307 data.InitialiseForComponent(Z, n);
308 for(
size_t j=0; j<i; ++j) {
309 if(work[j]) {
data.AddComponent(Z, amin[Z]+j, work[j]); }
315 G4NeutronCaptureXS::RetrieveVector(std::ostringstream& ost,
G4bool warn)
318 std::ifstream filein(ost.str().c_str());
320 if(!warn) {
return v; }
322 ed <<
"Data file <" << ost.str().c_str()
323 <<
"> is not opened!";
324 G4Exception(
"G4NeutronCaptureXS::RetrieveVector(..)",
"had014",
328 G4cout <<
"File " << ost.str()
329 <<
" is opened by G4NeutronCaptureXS" <<
G4endl;
335 ed <<
"Data file <" << ost.str().c_str()
336 <<
"> is not retrieved!";
337 G4Exception(
"G4NeutronCaptureXS::RetrieveVector(..)",
"had015",
size_t GetNumberOfIsotopes() const
virtual ~G4NeutronCaptureXS()
virtual G4bool Retrieve(std::ifstream &fIn, G4bool ascii)
std::vector< G4Isotope * > G4IsotopeVector
virtual G4double GetElementCrossSection(const G4DynamicParticle *, G4int Z, const G4Material *mat=0)
std::ostringstream G4ExceptionDescription
G4double GetKineticEnergy() const
virtual G4double GetIsoCrossSection(const G4DynamicParticle *, G4int Z, G4int A, const G4Isotope *iso, const G4Element *elm, const G4Material *mat)
virtual G4bool IsElementApplicable(const G4DynamicParticle *, G4int Z, const G4Material *)
size_t GetVectorLength() const
const G4String & GetParticleName() const
virtual void BuildPhysicsTable(const G4ParticleDefinition &)
G4GLOB_DLL std::ostream G4cout
static size_t GetNumberOfElements()
G4double * GetRelativeAbundanceVector() const
G4double Energy(size_t index) const
G4double Value(G4double theEnergy, size_t &lastidx) const
virtual void CrossSectionDescription(std::ostream &) const
virtual G4Isotope * SelectIsotope(const G4Element *, G4double kinEnergy)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
virtual G4bool IsIsoApplicable(const G4DynamicParticle *, G4int Z, G4int A, const G4Element *, const G4Material *)
G4IsotopeVector * GetIsotopeVector() const
std::vector< G4Element * > G4ElementTable
static G4ElementTable * GetElementTable()
const XML_Char const XML_Char * data