Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4NeutronCaptureXS Class Reference

#include <G4NeutronCaptureXS.hh>

Inheritance diagram for G4NeutronCaptureXS:
Collaboration diagram for G4NeutronCaptureXS:

Public Member Functions

 G4NeutronCaptureXS ()
 
virtual ~G4NeutronCaptureXS ()
 
virtual G4bool IsElementApplicable (const G4DynamicParticle *, G4int Z, const G4Material *)
 
virtual G4bool IsIsoApplicable (const G4DynamicParticle *, G4int Z, G4int A, const G4Element *, const G4Material *)
 
virtual G4double GetElementCrossSection (const G4DynamicParticle *, G4int Z, const G4Material *mat=0)
 
virtual G4double GetIsoCrossSection (const G4DynamicParticle *, G4int Z, G4int A, const G4Isotope *iso, const G4Element *elm, const G4Material *mat)
 
virtual G4Isotope * SelectIsotope (const G4Element *, G4double kinEnergy)
 
virtual void BuildPhysicsTable (const G4ParticleDefinition &)
 
virtual void CrossSectionDescription (std::ostream &) const
 
- Public Member Functions inherited from G4VCrossSectionDataSet
 G4VCrossSectionDataSet (const G4String &nam="")
 
virtual ~G4VCrossSectionDataSet ()
 
G4double GetCrossSection (const G4DynamicParticle *, const G4Element *, const G4Material *mat=0)
 
G4double ComputeCrossSection (const G4DynamicParticle *, const G4Element *, const G4Material *mat=0)
 
virtual void DumpPhysicsTable (const G4ParticleDefinition &)
 
virtual G4int GetVerboseLevel () const
 
virtual void SetVerboseLevel (G4int value)
 
G4double GetMinKinEnergy () const
 
void SetMinKinEnergy (G4double value)
 
G4double GetMaxKinEnergy () const
 
void SetMaxKinEnergy (G4double value)
 
const G4String & GetName () const
 

Static Public Member Functions

static const char * Default_Name ()
 

Additional Inherited Members

- Protected Member Functions inherited from G4VCrossSectionDataSet
void SetName (const G4String &)
 
- Protected Attributes inherited from G4VCrossSectionDataSet
G4int verboseLevel
 

Detailed Description

Definition at line 61 of file G4NeutronCaptureXS.hh.

Constructor & Destructor Documentation

G4NeutronCaptureXS::G4NeutronCaptureXS ( )

Definition at line 86 of file G4NeutronCaptureXS.cc.

88  emax(20*MeV),elimit(1.0e-10*eV)
89 {
90  // verboseLevel = 0;
91  if(verboseLevel > 0){
92  G4cout << "G4NeutronCaptureXS::G4NeutronCaptureXS: Initialise for Z < "
93  << MAXZCAPTURE << G4endl;
94  }
95  isMaster = false;
96 }
G4VCrossSectionDataSet(const G4String &nam="")
const G4int MAXZCAPTURE
G4GLOB_DLL std::ostream G4cout
static constexpr double eV
Definition: G4SIunits.hh:215
static const char * Default_Name()
#define G4endl
Definition: G4ios.hh:61
static constexpr double MeV
Definition: G4SIunits.hh:214
G4NeutronCaptureXS::~G4NeutronCaptureXS ( )
virtual

Definition at line 98 of file G4NeutronCaptureXS.cc.

99 {
100  if(isMaster) { delete data; data = 0; }
101 }
const XML_Char const XML_Char * data
Definition: expat.h:268

Member Function Documentation

void G4NeutronCaptureXS::BuildPhysicsTable ( const G4ParticleDefinition &  p)
virtual

Reimplemented from G4VCrossSectionDataSet.

Definition at line 248 of file G4NeutronCaptureXS.cc.

249 {
250  if(verboseLevel > 0){
251  G4cout << "G4NeutronCaptureXS::BuildPhysicsTable for "
252  << p.GetParticleName() << G4endl;
253  }
254  if(p.GetParticleName() != "neutron") {
256  ed << p.GetParticleName() << " is a wrong particle type -"
257  << " only neutron is allowed";
258  G4Exception("G4NeutronCaptureXS::BuildPhysicsTable(..)","had012",
259  FatalException, ed, "");
260  return;
261  }
262 
263  if(!data) {
264  isMaster = true;
265  data = new G4ElementData();
266  data->SetName("NeutronCapture");
267  temp.resize(13,0.0);
268  }
269 
270  // it is possible re-initialisation for the second run
271  if(isMaster) {
272 
273  // check environment variable
274  // Build the complete string identifying the file with the data set
275  char* path = getenv("G4NEUTRONXSDATA");
276 
277  // Access to elements
278  const G4ElementTable* theElmTable = G4Element::GetElementTable();
279  size_t numOfElm = G4Element::GetNumberOfElements();
280  if(numOfElm > 0) {
281  for(size_t i=0; i<numOfElm; ++i) {
282  G4int Z = G4int(((*theElmTable)[i])->GetZ());
283  if(Z < 1) { Z = 1; }
284  else if(Z >= MAXZCAPTURE) { Z = MAXZCAPTURE-1; }
285  //G4cout << "Z= " << Z << G4endl;
286  // Initialisation
287  if(!data->GetElementData(Z)) { Initialise(Z, path); }
288  }
289  }
290  }
291 }
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
const G4int MAXZCAPTURE
int G4int
Definition: G4Types.hh:78
const G4String & GetParticleName() const
const XML_Char const XML_Char * data
Definition: expat.h:268
G4GLOB_DLL std::ostream G4cout
static size_t GetNumberOfElements()
Definition: G4Element.cc:405
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
#define G4endl
Definition: G4ios.hh:61
std::vector< G4Element * > G4ElementTable
static G4ElementTable * GetElementTable()
Definition: G4Element.cc:398

Here is the call graph for this function:

void G4NeutronCaptureXS::CrossSectionDescription ( std::ostream &  outFile) const
virtual

Reimplemented from G4VCrossSectionDataSet.

Definition at line 103 of file G4NeutronCaptureXS.cc.

104 {
105  outFile << "G4NeutronCaptureXS calculates the neutron capture cross sections\n"
106  << "on nuclei using data from the high precision neutron database.\n"
107  << "These data are simplified and smoothed over the resonance region\n"
108  << "in order to reduce CPU time. G4NeutronCaptureXS is valid up to\n"
109  << "20 MeV for all targets through U.\n";
110 }
static const char* G4NeutronCaptureXS::Default_Name ( )
inlinestatic

Definition at line 69 of file G4NeutronCaptureXS.hh.

69 {return "G4NeutronCaptureXS";}

Here is the caller graph for this function:

G4double G4NeutronCaptureXS::GetElementCrossSection ( const G4DynamicParticle *  aParticle,
G4int  Z,
const G4Material *  mat = 0 
)
virtual

Reimplemented from G4VCrossSectionDataSet.

Definition at line 128 of file G4NeutronCaptureXS.cc.

130 {
131  G4double xs = 0.0;
132  G4double ekin = aParticle->GetKineticEnergy();
133  if(ekin > emax || Z < 1 || Z >= MAXZCAPTURE) { return xs; }
134  if(ekin < elimit) { ekin = elimit; }
135 
136  // element was not initialised
137  G4PhysicsVector* pv = data->GetElementData(Z);
138  if(!pv) {
139  Initialise(Z);
140  pv = data->GetElementData(Z);
141  if(!pv) { return xs; }
142  }
143 
144  G4double e1 = pv->Energy(0);
145  if(ekin < e1) { xs = (*pv)[0]*std::sqrt(e1/ekin); }
146  else if(ekin <= pv->GetMaxEnergy()) { xs = pv->Value(ekin); }
147 
148  if(verboseLevel > 0){
149  G4cout << "ekin= " << ekin << ", xs= " << xs << G4endl;
150  }
151  return xs;
152 }
G4double GetKineticEnergy() const
const G4int MAXZCAPTURE
const XML_Char const XML_Char * data
Definition: expat.h:268
G4GLOB_DLL std::ostream G4cout
G4double Energy(size_t index) const
G4double Value(G4double theEnergy, size_t &lastidx) const
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

G4double G4NeutronCaptureXS::GetIsoCrossSection ( const G4DynamicParticle *  aParticle,
G4int  Z,
G4int  A,
const G4Isotope *  iso,
const G4Element *  elm,
const G4Material *  mat 
)
virtual

Reimplemented from G4VCrossSectionDataSet.

Definition at line 155 of file G4NeutronCaptureXS.cc.

159 {
160  G4double xs = 0.0;
161  G4double ekin = aParticle->GetKineticEnergy();
162  if(ekin <= emax && Z > 0 && Z < MAXZCAPTURE) {
163  xs = IsoCrossSection(ekin, Z, A);
164  }
165  return xs;
166 }
G4double GetKineticEnergy() const
const G4int MAXZCAPTURE
double A(double temperature)
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

G4bool G4NeutronCaptureXS::IsElementApplicable ( const G4DynamicParticle *  ,
G4int  Z,
const G4Material *   
)
virtual

Reimplemented from G4VCrossSectionDataSet.

Definition at line 113 of file G4NeutronCaptureXS.cc.

115 {
116  return true;
117 }
G4bool G4NeutronCaptureXS::IsIsoApplicable ( const G4DynamicParticle *  ,
G4int  Z,
G4int  A,
const G4Element *  ,
const G4Material *   
)
virtual

Reimplemented from G4VCrossSectionDataSet.

Definition at line 120 of file G4NeutronCaptureXS.cc.

123 {
124  return true;
125 }
G4Isotope * G4NeutronCaptureXS::SelectIsotope ( const G4Element *  anElement,
G4double  kinEnergy 
)
virtual

Reimplemented from G4VCrossSectionDataSet.

Definition at line 198 of file G4NeutronCaptureXS.cc.

200 {
201  size_t nIso = anElement->GetNumberOfIsotopes();
202  G4IsotopeVector* isoVector = anElement->GetIsotopeVector();
203  G4Isotope* iso = (*isoVector)[0];
204 
205  // more than 1 isotope
206  if(1 < nIso) {
207  G4int Z = G4lrint(anElement->GetZ());
208 
209  G4double* abundVector = anElement->GetRelativeAbundanceVector();
210  G4double q = G4UniformRand();
211  G4double sum = 0.0;
212 
213  // is there isotope wise cross section?
214  size_t j;
215  if(0 == amin[Z] || Z >= MAXZCAPTURE) {
216  for (j = 0; j<nIso; ++j) {
217  sum += abundVector[j];
218  if(q <= sum) {
219  iso = (*isoVector)[j];
220  break;
221  }
222  }
223  } else {
224 
225  // element may be not initialised in unit test
226  if(!data->GetElementData(Z)) { Initialise(Z); }
227  size_t nn = temp.size();
228  if(nn < nIso) { temp.resize(nIso, 0.); }
229 
230  for (j=0; j<nIso; ++j) {
231  sum += abundVector[j]*IsoCrossSection(kinEnergy, Z,
232  (*isoVector)[j]->GetN());
233  temp[j] = sum;
234  }
235  sum *= q;
236  for (j = 0; j<nIso; ++j) {
237  if(temp[j] >= sum) {
238  iso = (*isoVector)[j];
239  break;
240  }
241  }
242  }
243  }
244  return iso;
245 }
size_t GetNumberOfIsotopes() const
Definition: G4Element.hh:159
std::vector< G4Isotope * > G4IsotopeVector
G4double GetZ() const
Definition: G4Element.hh:131
const G4int MAXZCAPTURE
int G4int
Definition: G4Types.hh:78
const XML_Char const XML_Char * data
Definition: expat.h:268
#define G4UniformRand()
Definition: Randomize.hh:97
G4double * GetRelativeAbundanceVector() const
Definition: G4Element.hh:167
G4IsotopeVector * GetIsotopeVector() const
Definition: G4Element.hh:163
int G4lrint(double ad)
Definition: templates.hh:163
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:


The documentation for this class was generated from the following files: