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

#include <G4NeutronCaptureXS.hh>

Inheritance diagram for G4NeutronCaptureXS:

Public Member Functions

 G4NeutronCaptureXS ()
 ~G4NeutronCaptureXS () override=default
G4bool IsElementApplicable (const G4DynamicParticle *, G4int Z, const G4Material *) final
G4bool IsIsoApplicable (const G4DynamicParticle *, G4int Z, G4int A, const G4Element *, const G4Material *) final
G4double GetElementCrossSection (const G4DynamicParticle *, G4int Z, const G4Material *) final
G4double ComputeCrossSectionPerElement (G4double kinEnergy, G4double loge, const G4ParticleDefinition *, const G4Element *, const G4Material *) final
G4double ComputeIsoCrossSection (G4double kinEnergy, G4double loge, const G4ParticleDefinition *, G4int Z, G4int A, const G4Isotope *iso, const G4Element *elm, const G4Material *mat) final
G4double GetIsoCrossSection (const G4DynamicParticle *, G4int Z, G4int A, const G4Isotope *iso, const G4Element *elm, const G4Material *mat) final
const G4IsotopeSelectIsotope (const G4Element *, G4double kinEnergy, G4double logE) final
void BuildPhysicsTable (const G4ParticleDefinition &) final
void CrossSectionDescription (std::ostream &) const final
G4double ElementCrossSection (G4double kinEnergy, G4double loge, G4int Z)
G4double IsoCrossSection (G4double ekin, G4double logekin, G4int Z, G4int A)
G4NeutronCaptureXSoperator= (const G4NeutronCaptureXS &right)=delete
 G4NeutronCaptureXS (const G4NeutronCaptureXS &)=delete
Public Member Functions inherited from G4VCrossSectionDataSet
 G4VCrossSectionDataSet (const G4String &nam="")
virtual ~G4VCrossSectionDataSet ()
G4double GetCrossSection (const G4DynamicParticle *, const G4Element *, const G4Material *mat=nullptr)
G4double ComputeCrossSection (const G4DynamicParticle *, const G4Element *, const G4Material *mat=nullptr)
virtual void DumpPhysicsTable (const G4ParticleDefinition &)
virtual void SetVerboseLevel (G4int value)
G4double GetMinKinEnergy () const
void SetMinKinEnergy (G4double value)
G4double GetMaxKinEnergy () const
void SetMaxKinEnergy (G4double value)
bool ForAllAtomsAndEnergies () const
void SetForAllAtomsAndEnergies (G4bool val)
const G4StringGetName () const
void SetName (const G4String &nam)
G4VCrossSectionDataSetoperator= (const G4VCrossSectionDataSet &right)=delete
 G4VCrossSectionDataSet (const G4VCrossSectionDataSet &)=delete

Static Public Member Functions

static const char * Default_Name ()

Additional Inherited Members

Protected Attributes inherited from G4VCrossSectionDataSet
G4int verboseLevel {0}
G4String name

Detailed Description

Definition at line 57 of file G4NeutronCaptureXS.hh.

Constructor & Destructor Documentation

◆ G4NeutronCaptureXS() [1/2]

G4NeutronCaptureXS::G4NeutronCaptureXS ( )

Definition at line 67 of file G4NeutronCaptureXS.cc.

69 emax(20*CLHEP::MeV), elimit(1.0e-5*CLHEP::eV)
70{
71 verboseLevel = 0;
72 if (verboseLevel > 0) {
73 G4cout << "G4NeutronCaptureXS::G4NeutronCaptureXS: Initialise for Z < "
74 << MAXZCAPTURE << G4endl;
75 }
76 logElimit = G4Log(elimit);
77 if (nullptr == data) {
78 data = new G4ElementData(MAXZCAPTURE+1);
79 data->SetName("nCapture");
80 dataR = new G4ElementData(MAXZCAPTURE+1);
81 dataR->SetName("nRCapture");
82 FindDirectoryPath();
83 }
84}
G4double G4Log(G4double x)
Definition G4Log.hh:169
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
static const char * Default_Name()
G4VCrossSectionDataSet(const G4String &nam="")

Referenced by G4NeutronCaptureXS(), and operator=().

◆ ~G4NeutronCaptureXS()

G4NeutronCaptureXS::~G4NeutronCaptureXS ( )
overridedefault

◆ G4NeutronCaptureXS() [2/2]

G4NeutronCaptureXS::G4NeutronCaptureXS ( const G4NeutronCaptureXS & )
delete

Member Function Documentation

◆ BuildPhysicsTable()

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

Reimplemented from G4VCrossSectionDataSet.

Definition at line 316 of file G4NeutronCaptureXS.cc.

317{
318 if (verboseLevel > 0){
319 G4cout << "G4NeutronCaptureXS::BuildPhysicsTable for "
320 << p.GetParticleName() << G4endl;
321 }
322 if (p.GetParticleName() != "neutron") {
324 ed << p.GetParticleName() << " is a wrong particle type -"
325 << " only neutron is allowed";
326 G4Exception("G4NeutronCaptureXS::BuildPhysicsTable(..)","had012",
327 FatalException, ed, "");
328 return;
329 }
330
332
333 // it is possible re-initialisation for the second run
335
336 // initialise static tables only once
337 std::call_once(applyOnce, [this]() { isInitializer = true; });
338
339 if (isInitializer) {
340 G4AutoLock l(&neutronCaptureXSMutex);
341 // Access to elements
342 for ( auto const & elm : *table ) {
343 G4int Z = std::max( 1, std::min( elm->GetZasInt(), MAXZCAPTURE) );
344 if ( nullptr == data->GetElementData(Z) ) { Initialise(Z); }
345 }
346 l.unlock();
347 }
348
349 // prepare isotope selection
350 std::size_t nIso = temp.size();
351 for ( auto const & elm : *table ) {
352 std::size_t n = elm->GetNumberOfIsotopes();
353 if (n > nIso) { nIso = n; }
354 }
355 temp.resize(nIso, 0.0);
356}
G4TemplateAutoLock< G4Mutex > G4AutoLock
std::vector< G4Element * > G4ElementTable
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
int G4int
Definition G4Types.hh:85
static const G4ElementTable * GetElementTable()
Definition G4Element.cc:401
static G4HadronicParameters * Instance()
const G4String & GetParticleName() const

◆ ComputeCrossSectionPerElement()

G4double G4NeutronCaptureXS::ComputeCrossSectionPerElement ( G4double kinEnergy,
G4double loge,
const G4ParticleDefinition * ,
const G4Element * elm,
const G4Material *  )
finalvirtual

Reimplemented from G4VCrossSectionDataSet.

Definition at line 124 of file G4NeutronCaptureXS.cc.

128{
129 G4double xs = 0.0;
130 if (ekin < emax) {
131 xs = ElementCrossSection(ekin, loge, elm->GetZasInt());
132 }
133 return xs;
134}
double G4double
Definition G4Types.hh:83
G4int GetZasInt() const
Definition G4Element.hh:120
G4double ElementCrossSection(G4double kinEnergy, G4double loge, G4int Z)

◆ ComputeIsoCrossSection()

G4double G4NeutronCaptureXS::ComputeIsoCrossSection ( G4double kinEnergy,
G4double loge,
const G4ParticleDefinition * ,
G4int Z,
G4int A,
const G4Isotope * iso,
const G4Element * elm,
const G4Material * mat )
finalvirtual

Reimplemented from G4VCrossSectionDataSet.

Definition at line 178 of file G4NeutronCaptureXS.cc.

183{
184 return IsoCrossSection(ekin, loge, Z, A);
185}
const G4double A[17]
G4double IsoCrossSection(G4double ekin, G4double logekin, G4int Z, G4int A)

◆ CrossSectionDescription()

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

Reimplemented from G4VCrossSectionDataSet.

Definition at line 86 of file G4NeutronCaptureXS.cc.

87{
88 outFile << "G4NeutronCaptureXS calculates the neutron capture cross sections\n"
89 << "on nuclei using data from the high precision neutron database.\n"
90 << "These data are simplified and smoothed over the resonance region\n"
91 << "in order to reduce CPU time. G4NeutronCaptureXS is set to zero\n"
92 << "above 20 MeV for all targets. For Z > 92 the cross section of\n"
93 << "Uranium is used.\n";
94}

◆ Default_Name()

const char * G4NeutronCaptureXS::Default_Name ( )
inlinestatic

Definition at line 65 of file G4NeutronCaptureXS.hh.

65{return "G4NeutronCaptureXS";}

Referenced by LBE::ConstructHad(), G4NeutronCrossSectionXS::ConstructProcess(), and G4NeutronCaptureXS().

◆ ElementCrossSection()

G4double G4NeutronCaptureXS::ElementCrossSection ( G4double kinEnergy,
G4double loge,
G4int Z )

Definition at line 137 of file G4NeutronCaptureXS.cc.

138{
139 G4int Z = std::min(ZZ, MAXZCAPTURE);
140 G4double ekin = eKin;
141 G4double logEkin = logE;
142 if (ekin < elimit) {
143 ekin = elimit;
144 logEkin = logElimit;
145 }
146
147 G4double xs;
148 G4bool done{false};
149
150 // data from the resonance region
151 if (fRfilesEnabled) {
152 auto pv = GetPhysicsVectorR(Z);
153 if (nullptr != pv && ekin < cap_max_r_e[Z]) {
154 const G4double e0 = pv->Energy(0);
155 xs = (ekin >= e0) ? pv->LogVectorValue(ekin, logEkin)
156 : (*pv)[0]*std::sqrt(e0/ekin);
157 done = true;
158 }
159 }
160 // data above the resonance region
161 if (!done) {
162 auto pv = GetPhysicsVector(Z);
163 const G4double e0 = pv->Energy(0);
164 xs = (ekin >= e0) ? pv->LogVectorValue(ekin, logEkin)
165 : (*pv)[0]*std::sqrt(e0/ekin);
166 }
167
168#ifdef G4VERBOSE
169 if (verboseLevel > 1){
170 G4cout << "Ekin= " << ekin/CLHEP::MeV
171 << " ElmXScap(b)= " << xs/CLHEP::barn << G4endl;
172 }
173#endif
174 return xs;
175}
bool G4bool
Definition G4Types.hh:86

Referenced by ComputeCrossSectionPerElement(), and GetElementCrossSection().

◆ GetElementCrossSection()

G4double G4NeutronCaptureXS::GetElementCrossSection ( const G4DynamicParticle * aParticle,
G4int Z,
const G4Material *  )
finalvirtual

Reimplemented from G4VCrossSectionDataSet.

Definition at line 112 of file G4NeutronCaptureXS.cc.

114{
115 G4double xs = 0.0;
116 G4double ekin = aParticle->GetKineticEnergy();
117 if (ekin < emax) {
118 xs = ElementCrossSection(ekin, aParticle->GetLogKineticEnergy(), Z);
119 }
120 return xs;
121}
G4double GetLogKineticEnergy() const
G4double GetKineticEnergy() const

◆ GetIsoCrossSection()

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

Reimplemented from G4VCrossSectionDataSet.

Definition at line 188 of file G4NeutronCaptureXS.cc.

192{
193 return IsoCrossSection(aParticle->GetKineticEnergy(),
194 aParticle->GetLogKineticEnergy(),
195 Z, A);
196}

◆ IsElementApplicable()

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

Reimplemented from G4VCrossSectionDataSet.

Definition at line 97 of file G4NeutronCaptureXS.cc.

99{
100 return true;
101}

◆ IsIsoApplicable()

G4bool G4NeutronCaptureXS::IsIsoApplicable ( const G4DynamicParticle * ,
G4int Z,
G4int A,
const G4Element * ,
const G4Material *  )
finalvirtual

Reimplemented from G4VCrossSectionDataSet.

Definition at line 104 of file G4NeutronCaptureXS.cc.

107{
108 return true;
109}

◆ IsoCrossSection()

G4double G4NeutronCaptureXS::IsoCrossSection ( G4double ekin,
G4double logekin,
G4int Z,
G4int A )

Definition at line 198 of file G4NeutronCaptureXS.cc.

200{
201 G4double xs = 0.0;
202 if (eKin > emax) { return xs; }
203
204 G4int Z = std::min(ZZ, MAXZCAPTURE);
205 G4double ekin = eKin;
206 G4double logEkin = logE;
207 if (ekin < elimit) {
208 ekin = elimit;
209 logEkin = logElimit;
210 }
211
212 G4bool done{false};
213
214 // data from the resonance region
215 if (fRfilesEnabled) {
216 auto pv = GetPhysicsVectorR(Z);
217 if (nullptr != pv && ekin < cap_max_r_e[Z]) {
218 // use isotope x-section if possible
219 if (dataR->GetNumberOfComponents(Z) > 0) {
220 auto pviso = dataR->GetComponentDataByID(Z, A);
221 if (pviso != nullptr) {
222 const G4double e0 = pviso->Energy(0);
223 xs = (ekin >= e0) ? pviso->LogVectorValue(ekin, logEkin)
224 : (*pviso)[0]*std::sqrt(e0/ekin);
225 done = true;
226 }
227 }
228 // isotope data are not available or applicable
229 if (!done) {
230 const G4double e0 = pv->Energy(0);
231 xs = (ekin >= e0) ? pv->LogVectorValue(ekin, logEkin)
232 : (*pv)[0]*std::sqrt(e0/ekin);
233 done = true;
234 }
235 }
236 }
237 // data above the resonance region
238 if (!done) {
239 auto pv = GetPhysicsVector(Z);
240 // use isotope x-section if possible
241 if (data->GetNumberOfComponents(Z) > 0) {
242 auto pviso = data->GetComponentDataByID(Z, A);
243 if (pviso != nullptr) {
244 const G4double e0 = pviso->Energy(0);
245 xs = (ekin >= e0) ? pviso->LogVectorValue(ekin, logEkin)
246 : (*pviso)[0]*std::sqrt(e0/ekin);
247 done = true;
248 }
249 }
250 // isotope data are not available or applicable
251 if (!done) {
252 const G4double e0 = pv->Energy(0);
253 xs = (ekin >= e0) ? pv->LogVectorValue(ekin, logEkin)
254 : (*pv)[0]*std::sqrt(e0/ekin);
255 }
256 }
257#ifdef G4VERBOSE
258 if (verboseLevel > 0) {
259 G4cout << "G4NeutronCaptureXS::IsoXS: Ekin(MeV)= " << ekin/MeV
260 << " xs(b)= " << xs/CLHEP::barn
261 << " Z= " << Z << " A= " << A << " no iso XS" << G4endl;
262 }
263#endif
264 return xs;
265}

Referenced by ComputeIsoCrossSection(), GetIsoCrossSection(), and SelectIsotope().

◆ operator=()

G4NeutronCaptureXS & G4NeutronCaptureXS::operator= ( const G4NeutronCaptureXS & right)
delete

◆ SelectIsotope()

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

Reimplemented from G4VCrossSectionDataSet.

Definition at line 268 of file G4NeutronCaptureXS.cc.

270{
271 G4int nIso = (G4int)anElement->GetNumberOfIsotopes();
272 const G4Isotope* iso = anElement->GetIsotope(0);
273
274 //G4cout << "SelectIsotope NIso= " << nIso << G4endl;
275 if(1 == nIso) { return iso; }
276
277 // more than 1 isotope
278 G4int Z = anElement->GetZasInt();
279 if (nullptr == data->GetElementData(Z)) { InitialiseOnFly(Z); }
280
281 const G4double* abundVector = anElement->GetRelativeAbundanceVector();
283 G4double sum = 0.0;
284
285 // is there isotope wise cross section?
286 G4int j;
287 if (Z > MAXZCAPTURE || 0 == data->GetNumberOfComponents(Z)) {
288 for (j = 0; j<nIso; ++j) {
289 sum += abundVector[j];
290 if (q <= sum) {
291 iso = anElement->GetIsotope(j);
292 break;
293 }
294 }
295 return iso;
296 }
297 G4int nn = (G4int)temp.size();
298 if (nn < nIso) { temp.resize(nIso, 0.); }
299
300 for (j=0; j<nIso; ++j) {
301 sum += abundVector[j]*IsoCrossSection(kinEnergy, logE, Z,
302 anElement->GetIsotope(j)->GetN());
303 temp[j] = sum;
304 }
305 sum *= q;
306 for (j = 0; j<nIso; ++j) {
307 if (temp[j] >= sum) {
308 iso = anElement->GetIsotope(j);
309 break;
310 }
311 }
312 return iso;
313}
#define G4UniformRand()
Definition Randomize.hh:52
G4double * GetRelativeAbundanceVector() const
Definition G4Element.hh:149
std::size_t GetNumberOfIsotopes() const
Definition G4Element.hh:143
const G4Isotope * GetIsotope(G4int iso) const
Definition G4Element.hh:151
G4int GetN() const
Definition G4Isotope.hh:83

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