Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4NeutronCaptureXS Class Reference

#include <G4NeutronCaptureXS.hh>

+ Inheritance 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 G4IsotopeSelectIsotope (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 ()
 
virtual G4bool IsElementApplicable (const G4DynamicParticle *, G4int Z, const G4Material *mat=0)
 
virtual G4bool IsIsoApplicable (const G4DynamicParticle *, G4int Z, G4int A, const G4Element *elm=0, const G4Material *mat=0)
 
G4double GetCrossSection (const G4DynamicParticle *, const G4Element *, const G4Material *mat=0)
 
G4double ComputeCrossSection (const G4DynamicParticle *, const G4Element *, const G4Material *mat=0)
 
virtual G4double GetElementCrossSection (const G4DynamicParticle *, G4int Z, const G4Material *mat=0)
 
virtual G4double GetIsoCrossSection (const G4DynamicParticle *, G4int Z, G4int A, const G4Isotope *iso=0, const G4Element *elm=0, const G4Material *mat=0)
 
virtual G4IsotopeSelectIsotope (const G4Element *, G4double kinEnergy)
 
virtual void BuildPhysicsTable (const G4ParticleDefinition &)
 
virtual void DumpPhysicsTable (const G4ParticleDefinition &)
 
virtual void CrossSectionDescription (std::ostream &) const
 
void SetVerboseLevel (G4int value)
 
G4double GetMinKinEnergy () const
 
void SetMinKinEnergy (G4double value)
 
G4double GetMaxKinEnergy () const
 
void SetMaxKinEnergy (G4double value)
 
const G4StringGetName () 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 59 of file G4NeutronCaptureXS.hh.

Constructor & Destructor Documentation

◆ G4NeutronCaptureXS()

G4NeutronCaptureXS::G4NeutronCaptureXS ( )

Definition at line 78 of file G4NeutronCaptureXS.cc.

79 : G4VCrossSectionDataSet("G4NeutronCaptureXS"),
80 emax(20*MeV),maxZ(92)
81{
82 // verboseLevel = 0;
83 if(verboseLevel > 0){
84 G4cout << "G4NeutronCaptureXS::G4NeutronCaptureXS: Initialise for Z < "
85 << maxZ + 1 << G4endl;
86 }
87 //data.resize(maxZ+1, 0);
88 data.SetName("NeutronCapture");
89 work.resize(13,0);
90 temp.resize(13,0.0);
91 isInitialized = false;
92}
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cout
void SetName(const G4String &nam)

◆ ~G4NeutronCaptureXS()

G4NeutronCaptureXS::~G4NeutronCaptureXS ( )
virtual

Definition at line 94 of file G4NeutronCaptureXS.cc.

95{
96 /*
97 for(G4int i=0; i<=maxZ; ++i) {
98 delete data[i];
99 }
100 */
101}

Member Function Documentation

◆ BuildPhysicsTable()

void G4NeutronCaptureXS::BuildPhysicsTable ( const G4ParticleDefinition p)
virtual

Reimplemented from G4VCrossSectionDataSet.

Definition at line 239 of file G4NeutronCaptureXS.cc.

240{
241 if(isInitialized) { return; }
242 if(verboseLevel > 0){
243 G4cout << "G4NeutronCaptureXS::BuildPhysicsTable for "
244 << p.GetParticleName() << G4endl;
245 }
246 if(p.GetParticleName() != "neutron") {
247 throw G4HadronicException(__FILE__, __LINE__,"Wrong particle type");
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 if (!path){
256 throw G4HadronicException(__FILE__, __LINE__,
257 "G4NEUTRONXSDATA environment variable not defined");
258 return;
259 }
260
261 // Access to elements
262 const G4ElementTable* theElmTable = G4Element::GetElementTable();
263 size_t numOfElm = G4Element::GetNumberOfElements();
264 if(numOfElm > 0) {
265 for(size_t i=0; i<numOfElm; ++i) {
266 G4int Z = G4int(((*theElmTable)[i])->GetZ());
267 if(Z < 1) { Z = 1; }
268 else if(Z > maxZ) { Z = maxZ; }
269 //G4cout << "Z= " << Z << G4endl;
270 // Initialisation
271 // if(!data[Z]) { Initialise(Z, path); }
272 if(!data.GetElementData(Z)) { Initialise(Z, path); }
273 }
274 }
275}
std::vector< G4Element * > G4ElementTable
int G4int
Definition: G4Types.hh:66
G4PhysicsVector * GetElementData(G4int Z)
static size_t GetNumberOfElements()
Definition: G4Element.cc:406
static const G4ElementTable * GetElementTable()
Definition: G4Element.cc:399
const G4String & GetParticleName() const

◆ CrossSectionDescription()

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}

◆ GetElementCrossSection()

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 > maxZ) { return xs; }
134 const G4double elimit = 1.0e-10*eV;
135 if(ekin < elimit) { ekin = elimit; }
136
137 // G4PhysicsVector* pv = data[Z];
138 G4PhysicsVector* pv = data.GetElementData(Z);
139
140 // element was not initialised
141 if(!pv) {
142 Initialise(Z);
143 // pv = data[Z];
144 pv = data.GetElementData(Z);
145 if(!pv) { return xs; }
146 }
147
148 G4double e1 = pv->Energy(0);
149 if(ekin < e1) { xs = (*pv)[0]*std::sqrt(e1/ekin); }
150 else { xs = pv->Value(ekin); }
151
152 if(verboseLevel > 0){
153 G4cout << "ekin= " << ekin << ", xs= " << xs << G4endl;
154 }
155 return xs;
156}
double G4double
Definition: G4Types.hh:64
G4double GetKineticEnergy() const
G4double Value(G4double theEnergy)
G4double Energy(size_t index) const

◆ GetIsoCrossSection()

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

163{
164 G4double xs = 0.0;
165 G4double ekin = aParticle->GetKineticEnergy();
166 if(ekin > emax || Z < 1 || Z > maxZ) { return xs; }
167 const G4double elimit = 1.0e-10*eV;
168 if(ekin < elimit) { ekin = elimit; }
169
170 // G4PhysicsVector* pv = data[Z];
171 G4PhysicsVector* pv = data.GetElementData(Z);
172
173 // element was not initialised
174 if(!pv) {
175 Initialise(Z);
176 // pv = data[Z];
177 pv = data.GetElementData(Z);
178 if(!pv) { return xs; }
179 }
180 pv = data.GetComponentDataByID(Z, A);
181 if(!pv) { return xs; }
182
183 G4double e1 = pv->Energy(0);
184 if(ekin < e1) { xs = (*pv)[0]*std::sqrt(e1/ekin); }
185 else { xs = pv->Value(ekin); }
186
187 if(verboseLevel > 0){
188 G4cout << "ekin= " << ekin << ", xs= " << xs << G4endl;
189 }
190 return xs;
191}
G4PhysicsVector * GetComponentDataByID(G4int Z, G4int id)

◆ IsElementApplicable()

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}

◆ IsIsoApplicable()

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 false;
125}

◆ SelectIsotope()

G4Isotope * G4NeutronCaptureXS::SelectIsotope ( const G4Element anElement,
G4double  kinEnergy 
)
virtual

Reimplemented from G4VCrossSectionDataSet.

Definition at line 193 of file G4NeutronCaptureXS.cc.

195{
196 G4int nIso = anElement->GetNumberOfIsotopes();
197 G4IsotopeVector* isoVector = anElement->GetIsotopeVector();
198 G4Isotope* iso = (*isoVector)[0];
199
200 // more than 1 isotope
201 if(1 < nIso) {
202 G4int Z = G4lrint(anElement->GetZ());
203 if(Z > maxZ) { Z = maxZ; }
204 G4double* abundVector = anElement->GetRelativeAbundanceVector();
206 G4double sum = 0.0;
207
208 // is there isotope wise cross section?
209 if(0 == amin[Z]) {
210 for (G4int j = 0; j<nIso; ++j) {
211 sum += abundVector[j];
212 if(q <= sum) {
213 iso = (*isoVector)[j];
214 break;
215 }
216 }
217 } else {
218 size_t nmax = data.GetNumberOfComponents(Z);
219 if(temp.size() < nmax) { temp.resize(nmax,0.0); }
220 for (size_t i=0; i<nmax; ++i) {
221 G4int A = (*isoVector)[i]->GetN();
223 if(v) { sum += abundVector[i]*v->Value(kinEnergy); }
224 temp[i] = sum;
225 }
226 sum *= q;
227 for (size_t j = 0; j<nmax; ++j) {
228 if(temp[j] >= sum) {
229 iso = (*isoVector)[j];
230 break;
231 }
232 }
233 }
234 }
235 return iso;
236}
std::vector< G4Isotope * > G4IsotopeVector
#define G4UniformRand()
Definition: Randomize.hh:53
size_t GetNumberOfComponents(G4int Z)
G4double * GetRelativeAbundanceVector() const
Definition: G4Element.hh:166
G4double GetZ() const
Definition: G4Element.hh:131
size_t GetNumberOfIsotopes() const
Definition: G4Element.hh:158
G4IsotopeVector * GetIsotopeVector() const
Definition: G4Element.hh:162
int G4lrint(double ad)
Definition: templates.hh:163

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