64 G4cout <<
"G4NeutronElasticXS::G4NeutronElasticXS Initialise for Z < "
67 data.resize(maxZ+1, 0);
68 coeff.resize(maxZ+1, 1.0);
71 isInitialized =
false;
86 outFile <<
"G4NeutronElasticXS calculates the neutron elastic scattering\n"
87 <<
"cross section on nuclei using data from the high precision\n"
88 <<
"neutron database. These data are simplified and smoothed over\n"
89 <<
"the resonance region in order to reduce CPU time.\n"
90 <<
"G4NeutronElasticXS is valid for energies up to 20 MeV, for all\n"
91 <<
"targets through U.\n";
108 if(Z < 1 || Z > maxZ) {
return xs; }
119 if(!pv) {
return xs; }
123 if(ekin <= e1) {
return (*pv)[0]; }
129 xs = pv->
Value(ekin);
139 G4cout <<
"ekin= " << ekin <<
", XSinel= " << xs <<
G4endl;
147 if(isInitialized) {
return; }
149 G4cout <<
"G4NeutronElasticXS::BuildPhysicsTable for "
155 <<
" only neutron is allowed";
156 G4Exception(
"G4NeutronElasticXS::BuildPhysicsTable(..)",
"had012",
160 isInitialized =
true;
164 char* path = getenv(
"G4NEUTRONXSDATA");
173 for(
size_t i=0; i<numOfElm; ++i) {
176 else if(Z > maxZ) { Z = maxZ; }
179 if(!
data[Z]) { Initialise(Z, dynParticle, path); }
189 if(
data[Z]) {
return; }
190 const char* path =
p;
194 path = getenv(
"G4NEUTRONXSDATA");
196 G4Exception(
"G4NeutronElasticXS::Initialise(..)",
"had013",
198 "Environment variable G4NEUTRONXSDATA is not defined");
213 std::ostringstream ost;
214 ost << path <<
"/elast" <<
Z ;
215 std::ifstream filein(ost.str().c_str());
218 ed <<
"Data file <" << ost.str().c_str()
219 <<
"> is not opened!";
220 G4Exception(
"G4NeutronElasticXS::Initialise(..)",
"had014",
225 G4cout <<
"file " << ost.str()
226 <<
" is opened by G4NeutronElasticXS" <<
G4endl;
230 if(!
data[Z]->Retrieve(filein,
true)) {
232 ed <<
"Data file <" << ost.str().c_str()
233 <<
"> is not retrieved!";
234 G4Exception(
"G4NeutronElasticXS::Initialise(..)",
"had015",
240 size_t n =
data[
Z]->GetVectorLength() - 1;
252 if(sig2 > 0.) { coeff[
Z] = sig1/sig2; }
254 if(!dp) {
delete dynParticle; }
G4double GetElasticHadronNucleonXsc()
G4double GetElasticGlauberGribovXsc()
std::ostringstream G4ExceptionDescription
G4double GetKineticEnergy() const
CLHEP::Hep3Vector G4ThreeVector
virtual G4double GetIsoCrossSection(const G4DynamicParticle *, G4int Z, G4int A, const G4Isotope *iso=0, const G4Element *elm=0, const G4Material *mat=0)
size_t GetVectorLength() const
static G4NistManager * Instance()
const G4String & GetParticleName() const
G4GLOB_DLL std::ostream G4cout
static size_t GetNumberOfElements()
static G4Neutron * Neutron()
G4double Energy(size_t index) const
G4double Value(G4double theEnergy, size_t &lastidx) const
void SetKineticEnergy(G4double aEnergy)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
virtual ~G4NeutronElasticXS()
virtual G4double GetElementCrossSection(const G4DynamicParticle *, G4int Z, const G4Material *mat=0)
G4double GetHadronNucleonXscPDG(const G4DynamicParticle *, const G4ParticleDefinition *)
virtual void CrossSectionDescription(std::ostream &) const
std::vector< G4Element * > G4ElementTable
virtual G4bool IsElementApplicable(const G4DynamicParticle *, G4int Z, const G4Material *)
static G4ElementTable * GetElementTable()
const XML_Char const XML_Char * data
virtual void BuildPhysicsTable(const G4ParticleDefinition &)