Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
G4NeutronCaptureXS Class Reference

#include <G4NeutronCaptureXS.hh>

Inheritance diagram for G4NeutronCaptureXS:
G4VCrossSectionDataSet

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
 

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 77 of file G4NeutronCaptureXS.cc.

References G4cout, G4endl, MAXZCAPTURE, and G4VCrossSectionDataSet::verboseLevel.

78  : G4VCrossSectionDataSet("G4NeutronCaptureXS"),
79  emax(20*MeV),elimit(1.0e-10*eV)
80 {
81  // verboseLevel = 0;
82  if(verboseLevel > 0){
83  G4cout << "G4NeutronCaptureXS::G4NeutronCaptureXS: Initialise for Z < "
84  << MAXZCAPTURE << G4endl;
85  }
86  data.SetName("NeutronCapture");
87  work.resize(13,0);
88  temp.resize(13,0.0);
89  isInitialized = false;
90 }
G4VCrossSectionDataSet(const G4String &nam="")
const G4int MAXZCAPTURE
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
const XML_Char const XML_Char * data
G4NeutronCaptureXS::~G4NeutronCaptureXS ( )
virtual

Definition at line 92 of file G4NeutronCaptureXS.cc.

93 {}

Member Function Documentation

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

Reimplemented from G4VCrossSectionDataSet.

Definition at line 235 of file G4NeutronCaptureXS.cc.

References FatalException, G4cout, G4endl, G4Exception(), G4Element::GetElementTable(), G4Element::GetNumberOfElements(), G4ParticleDefinition::GetParticleName(), MAXZCAPTURE, and G4VCrossSectionDataSet::verboseLevel.

236 {
237  if(isInitialized) { return; }
238  if(verboseLevel > 0){
239  G4cout << "G4NeutronCaptureXS::BuildPhysicsTable for "
240  << p.GetParticleName() << G4endl;
241  }
242  if(p.GetParticleName() != "neutron") {
244  ed << p.GetParticleName() << " is a wrong particle type -"
245  << " only neutron is allowed";
246  G4Exception("G4NeutronCaptureXS::BuildPhysicsTable(..)","had012",
247  FatalException, ed, "");
248  return;
249  }
250  isInitialized = true;
251 
252  // check environment variable
253  // Build the complete string identifying the file with the data set
254  char* path = getenv("G4NEUTRONXSDATA");
255 
256  // Access to elements
257  const G4ElementTable* theElmTable = G4Element::GetElementTable();
258  size_t numOfElm = G4Element::GetNumberOfElements();
259  if(numOfElm > 0) {
260  for(size_t i=0; i<numOfElm; ++i) {
261  G4int Z = G4int(((*theElmTable)[i])->GetZ());
262  if(Z < 1) { Z = 1; }
263  else if(Z >= MAXZCAPTURE) { Z = MAXZCAPTURE-1; }
264  //G4cout << "Z= " << Z << G4endl;
265  // Initialisation
266  if(!data.GetElementData(Z)) { Initialise(Z, path); }
267  }
268  }
269 }
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
const G4int MAXZCAPTURE
int G4int
Definition: G4Types.hh:78
const G4String & GetParticleName() const
G4GLOB_DLL std::ostream G4cout
static size_t GetNumberOfElements()
Definition: G4Element.cc:402
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:395
const XML_Char const XML_Char * data
void G4NeutronCaptureXS::CrossSectionDescription ( std::ostream &  outFile) const
virtual

Reimplemented from G4VCrossSectionDataSet.

Definition at line 95 of file G4NeutronCaptureXS.cc.

96 {
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";
102 }
std::ofstream outFile
Definition: GammaRayTel.cc:68
G4double G4NeutronCaptureXS::GetElementCrossSection ( const G4DynamicParticle *  aParticle,
G4int  Z,
const G4Material *  mat = 0 
)
virtual

Reimplemented from G4VCrossSectionDataSet.

Definition at line 120 of file G4NeutronCaptureXS.cc.

References G4PhysicsVector::Energy(), G4cout, G4endl, G4DynamicParticle::GetKineticEnergy(), MAXZCAPTURE, G4PhysicsVector::Value(), and G4VCrossSectionDataSet::verboseLevel.

122 {
123  G4double xs = 0.0;
124  G4double ekin = aParticle->GetKineticEnergy();
125  if(ekin > emax || Z < 1 || Z >= MAXZCAPTURE) { return xs; }
126  if(ekin < elimit) { ekin = elimit; }
127 
128  G4PhysicsVector* pv = data.GetElementData(Z);
129 
130  // element was not initialised
131  if(!pv) {
132  Initialise(Z);
133  pv = data.GetElementData(Z);
134  if(!pv) { return xs; }
135  }
136 
137  G4double e1 = pv->Energy(0);
138  if(ekin < e1) { xs = (*pv)[0]*std::sqrt(e1/ekin); }
139  else if(ekin <= pv->GetMaxEnergy()) { xs = pv->Value(ekin); }
140 
141  if(verboseLevel > 0){
142  G4cout << "ekin= " << ekin << ", xs= " << xs << G4endl;
143  }
144  return xs;
145 }
G4double GetKineticEnergy() const
const G4int MAXZCAPTURE
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
const XML_Char const XML_Char * data
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 148 of file G4NeutronCaptureXS.cc.

References G4DynamicParticle::GetKineticEnergy(), and MAXZCAPTURE.

152 {
153  G4double xs = 0.0;
154  G4double ekin = aParticle->GetKineticEnergy();
155  if(ekin <= emax && Z > 0 && Z < MAXZCAPTURE) {
156  xs = IsoCrossSection(ekin, Z, A);
157  }
158  return xs;
159 }
G4double GetKineticEnergy() const
const G4int MAXZCAPTURE
double G4double
Definition: G4Types.hh:76
G4bool G4NeutronCaptureXS::IsElementApplicable ( const G4DynamicParticle *  ,
G4int  Z,
const G4Material *   
)
virtual

Reimplemented from G4VCrossSectionDataSet.

Definition at line 105 of file G4NeutronCaptureXS.cc.

107 {
108  return true;
109 }
G4bool G4NeutronCaptureXS::IsIsoApplicable ( const G4DynamicParticle *  ,
G4int  Z,
G4int  A,
const G4Element *  ,
const G4Material *   
)
virtual

Reimplemented from G4VCrossSectionDataSet.

Definition at line 112 of file G4NeutronCaptureXS.cc.

115 {
116  return true;
117 }
G4Isotope * G4NeutronCaptureXS::SelectIsotope ( const G4Element *  anElement,
G4double  kinEnergy 
)
virtual

Reimplemented from G4VCrossSectionDataSet.

Definition at line 190 of file G4NeutronCaptureXS.cc.

References G4lrint(), G4UniformRand, G4Element::GetIsotopeVector(), G4Element::GetNumberOfIsotopes(), G4Element::GetRelativeAbundanceVector(), G4Element::GetZ(), MAXZCAPTURE, and nmax.

192 {
193  G4int nIso = anElement->GetNumberOfIsotopes();
194  G4IsotopeVector* isoVector = anElement->GetIsotopeVector();
195  G4Isotope* iso = (*isoVector)[0];
196 
197  // more than 1 isotope
198  if(1 < nIso) {
199  G4int Z = G4lrint(anElement->GetZ());
200  if(Z >= MAXZCAPTURE) { Z = MAXZCAPTURE-1; }
201  G4double* abundVector = anElement->GetRelativeAbundanceVector();
202  G4double q = G4UniformRand();
203  G4double sum = 0.0;
204 
205  // is there isotope wise cross section?
206  if(0 == amin[Z]) {
207  for (G4int j = 0; j<nIso; ++j) {
208  sum += abundVector[j];
209  if(q <= sum) {
210  iso = (*isoVector)[j];
211  break;
212  }
213  }
214  } else {
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);
220  temp[i] = sum;
221  }
222  sum *= q;
223  for (size_t j = 0; j<nmax; ++j) {
224  if(temp[j] >= sum) {
225  iso = (*isoVector)[j];
226  break;
227  }
228  }
229  }
230  }
231  return iso;
232 }
size_t GetNumberOfIsotopes() const
Definition: G4Element.hh:158
std::vector< G4Isotope * > G4IsotopeVector
G4double GetZ() const
Definition: G4Element.hh:131
const G4int MAXZCAPTURE
int G4int
Definition: G4Types.hh:78
#define G4UniformRand()
Definition: Randomize.hh:87
G4double * GetRelativeAbundanceVector() const
Definition: G4Element.hh:166
const G4int nmax
G4IsotopeVector * GetIsotopeVector() const
Definition: G4Element.hh:162
int G4lrint(double ad)
Definition: templates.hh:163
double G4double
Definition: G4Types.hh:76
const XML_Char const XML_Char * data

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