Geant4 11.2.2
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
 
G4String name
 

Detailed Description

Definition at line 57 of file G4NeutronCaptureXS.hh.

Constructor & Destructor Documentation

◆ G4NeutronCaptureXS() [1/2]

G4NeutronCaptureXS::G4NeutronCaptureXS ( )

Definition at line 65 of file G4NeutronCaptureXS.cc.

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

◆ ~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 270 of file G4NeutronCaptureXS.cc.

271{
272 if (verboseLevel > 0){
273 G4cout << "G4NeutronCaptureXS::BuildPhysicsTable for "
274 << p.GetParticleName() << G4endl;
275 }
276 if (p.GetParticleName() != "neutron") {
278 ed << p.GetParticleName() << " is a wrong particle type -"
279 << " only neutron is allowed";
280 G4Exception("G4NeutronCaptureXS::BuildPhysicsTable(..)","had012",
281 FatalException, ed, "");
282 return;
283 }
284
285 // it is possible re-initialisation for the second run
287
288 // initialise static tables only once
289 std::call_once(applyOnce, [this]() { isInitializer = true; });
290
291 if (isInitializer) {
292 G4AutoLock l(&neutronCaptureXSMutex);
293 // Access to elements
294 for ( auto const & elm : *table ) {
295 G4int Z = std::max( 1, std::min( elm->GetZasInt(), MAXZCAPTURE-1) );
296 if ( nullptr == data->GetElementData(Z) ) { Initialise(Z); }
297 }
298 l.unlock();
299 }
300
301 // prepare isotope selection
302 std::size_t nIso = temp.size();
303 for ( auto const & elm : *table ) {
304 std::size_t n = elm->GetNumberOfIsotopes();
305 if (n > nIso) { nIso = n; }
306 }
307 temp.resize(nIso, 0.0);
308}
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
G4PhysicsVector * GetElementData(G4int Z) const
static G4ElementTable * GetElementTable()
Definition G4Element.cc:389
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 120 of file G4NeutronCaptureXS.cc.

124{
125 G4double xs = 0.0;
126 if (ekin < emax) {
127 xs = ElementCrossSection(ekin, loge, elm->GetZasInt());
128 }
129 return xs;
130}
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 154 of file G4NeutronCaptureXS.cc.

159{
160 return IsoCrossSection(ekin, loge, Z, A);
161}
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 82 of file G4NeutronCaptureXS.cc.

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

◆ Default_Name()

static const char * G4NeutronCaptureXS::Default_Name ( )
inlinestatic

Definition at line 65 of file G4NeutronCaptureXS.hh.

65{return "G4NeutronCaptureXS";}

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

◆ ElementCrossSection()

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

Definition at line 133 of file G4NeutronCaptureXS.cc.

134{
135 G4int Z = std::min(ZZ, MAXZCAPTURE-1);
136 G4double logEkin = loge;
137 if (ekin < elimit) { ekin = elimit; logEkin = logElimit; }
138
139 auto pv = GetPhysicsVector(Z);
140 const G4double e1 = pv->Energy(1);
141 G4double xs = (ekin >= e1) ? pv->LogVectorValue(ekin, logEkin)
142 : (*pv)[1]*std::sqrt(e1/ekin);
143
144#ifdef G4VERBOSE
145 if (verboseLevel > 1){
146 G4cout << "Ekin= " << ekin/CLHEP::MeV
147 << " ElmXScap(b)= " << xs/CLHEP::barn << G4endl;
148 }
149#endif
150 return xs;
151}

Referenced by ComputeCrossSectionPerElement(), and GetElementCrossSection().

◆ GetElementCrossSection()

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

Reimplemented from G4VCrossSectionDataSet.

Definition at line 108 of file G4NeutronCaptureXS.cc.

110{
111 G4double xs = 0.0;
112 G4double ekin = aParticle->GetKineticEnergy();
113 if (ekin < emax) {
114 xs = ElementCrossSection(ekin, aParticle->GetLogKineticEnergy(), Z);
115 }
116 return xs;
117}
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 164 of file G4NeutronCaptureXS.cc.

168{
169 return IsoCrossSection(aParticle->GetKineticEnergy(),
170 aParticle->GetLogKineticEnergy(),
171 Z, A);
172}

◆ IsElementApplicable()

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

Reimplemented from G4VCrossSectionDataSet.

Definition at line 93 of file G4NeutronCaptureXS.cc.

95{
96 return true;
97}

◆ IsIsoApplicable()

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

Reimplemented from G4VCrossSectionDataSet.

Definition at line 100 of file G4NeutronCaptureXS.cc.

103{
104 return true;
105}

◆ IsoCrossSection()

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

Definition at line 174 of file G4NeutronCaptureXS.cc.

176{
177 G4double xs = 0.0;
178 if (eKin > emax) { return xs; }
179
180 G4int Z = std::min(ZZ, MAXZCAPTURE-1);
181 G4double ekin = eKin;
182 G4double logEkin = logE;
183 if (ekin < elimit) {
184 ekin = elimit;
185 logEkin = logElimit;
186 }
187
188 auto pv = GetPhysicsVector(Z);
189 if (pv == nullptr) { return xs; }
190
191 if (data->GetNumberOfComponents(Z) > 0) {
192 G4PhysicsVector* pviso = data->GetComponentDataByID(Z, A);
193 if(pviso != nullptr) {
194 const G4double e1 = pviso->Energy(1);
195 xs = (ekin >= e1) ? pviso->LogVectorValue(ekin, logEkin)
196 : (*pviso)[1]*std::sqrt(e1/ekin);
197#ifdef G4VERBOSE
198 if(verboseLevel > 0) {
199 G4cout << "G4NeutronCaptureXS::IsoXS: Ekin(MeV)= " << ekin/MeV
200 << " xs(b)= " << xs/barn
201 << " Z= " << Z << " A= " << A << G4endl;
202 }
203#endif
204 return xs;
205 }
206 }
207 // isotope data are not available or applicable
208 const G4double e1 = pv->Energy(1);
209 xs = (ekin >= e1) ? pv->LogVectorValue(ekin, logEkin)
210 : (*pv)[1]*std::sqrt(e1/ekin);
211#ifdef G4VERBOSE
212 if (verboseLevel > 0) {
213 G4cout << "G4NeutronCaptureXS::IsoXS: Ekin(MeV)= " << ekin/MeV
214 << " xs(b)= " << xs/barn
215 << " Z= " << Z << " A= " << A << " no iso XS" << G4endl;
216 }
217#endif
218 return xs;
219}
G4PhysicsVector * GetComponentDataByID(G4int Z, G4int id) const
std::size_t GetNumberOfComponents(G4int Z) const
G4double Energy(const std::size_t index) const
G4double LogVectorValue(const G4double energy, const G4double theLogEnergy) const

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

224{
225 G4int nIso = (G4int)anElement->GetNumberOfIsotopes();
226 const G4Isotope* iso = anElement->GetIsotope(0);
227
228 //G4cout << "SelectIsotope NIso= " << nIso << G4endl;
229 if(1 == nIso) { return iso; }
230
231 // more than 1 isotope
232 G4int Z = anElement->GetZasInt();
233 if (nullptr == data->GetElementData(Z)) { InitialiseOnFly(Z); }
234
235 const G4double* abundVector = anElement->GetRelativeAbundanceVector();
237 G4double sum = 0.0;
238
239 // is there isotope wise cross section?
240 G4int j;
241 if (Z >= MAXZCAPTURE || 0 == data->GetNumberOfComponents(Z)) {
242 for (j = 0; j<nIso; ++j) {
243 sum += abundVector[j];
244 if(q <= sum) {
245 iso = anElement->GetIsotope(j);
246 break;
247 }
248 }
249 return iso;
250 }
251 G4int nn = (G4int)temp.size();
252 if (nn < nIso) { temp.resize(nIso, 0.); }
253
254 for (j=0; j<nIso; ++j) {
255 sum += abundVector[j]*IsoCrossSection(kinEnergy, logE, Z,
256 anElement->GetIsotope(j)->GetN());
257 temp[j] = sum;
258 }
259 sum *= q;
260 for (j = 0; j<nIso; ++j) {
261 if (temp[j] >= sum) {
262 iso = anElement->GetIsotope(j);
263 break;
264 }
265 }
266 return iso;
267}
#define G4UniformRand()
Definition Randomize.hh:52
G4double * GetRelativeAbundanceVector() const
Definition G4Element.hh:149
const G4Isotope * GetIsotope(G4int iso) const
Definition G4Element.hh:151
size_t GetNumberOfIsotopes() const
Definition G4Element.hh:143
G4int GetN() const
Definition G4Isotope.hh:83

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