Geant4 10.7.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 () final
 
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 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 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 ()
 
virtual G4bool IsElementApplicable (const G4DynamicParticle *, G4int Z, const G4Material *mat=nullptr)
 
virtual G4bool IsIsoApplicable (const G4DynamicParticle *, G4int Z, G4int A, const G4Element *elm=nullptr, const G4Material *mat=nullptr)
 
G4double GetCrossSection (const G4DynamicParticle *, const G4Element *, const G4Material *mat=nullptr)
 
G4double ComputeCrossSection (const G4DynamicParticle *, const G4Element *, const G4Material *mat=nullptr)
 
virtual G4double GetElementCrossSection (const G4DynamicParticle *, G4int Z, const G4Material *mat=nullptr)
 
virtual G4double GetIsoCrossSection (const G4DynamicParticle *, G4int Z, G4int A, const G4Isotope *iso=nullptr, const G4Element *elm=nullptr, const G4Material *mat=nullptr)
 
virtual const G4IsotopeSelectIsotope (const G4Element *, G4double kinEnergy, G4double logE)
 
virtual void BuildPhysicsTable (const G4ParticleDefinition &)
 
virtual void DumpPhysicsTable (const G4ParticleDefinition &)
 
virtual void CrossSectionDescription (std::ostream &) const
 
virtual G4int GetVerboseLevel () const
 
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
 

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 60 of file G4NeutronCaptureXS.hh.

Constructor & Destructor Documentation

◆ G4NeutronCaptureXS() [1/2]

G4NeutronCaptureXS::G4NeutronCaptureXS ( )
explicit

Definition at line 64 of file G4NeutronCaptureXS.cc.

66 emax(20*CLHEP::MeV),elimit(1.0e-10*CLHEP::eV)
67{
68 // verboseLevel = 0;
69 if(verboseLevel > 0){
70 G4cout << "G4NeutronCaptureXS::G4NeutronCaptureXS: Initialise for Z < "
71 << MAXZCAPTURE << G4endl;
72 }
73 logElimit = G4Log(elimit);
74 isMaster = false;
75 temp.resize(13,0.0);
76}
G4double G4Log(G4double x)
Definition: G4Log.hh:226
const G4int MAXZCAPTURE
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
static const char * Default_Name()

◆ ~G4NeutronCaptureXS()

G4NeutronCaptureXS::~G4NeutronCaptureXS ( )
final

Definition at line 78 of file G4NeutronCaptureXS.cc.

79{
80 if(isMaster) { delete data; data = nullptr; }
81}

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

242{
243 if(verboseLevel > 0){
244 G4cout << "G4NeutronCaptureXS::BuildPhysicsTable for "
245 << p.GetParticleName() << G4endl;
246 }
247 if(p.GetParticleName() != "neutron") {
249 ed << p.GetParticleName() << " is a wrong particle type -"
250 << " only neutron is allowed";
251 G4Exception("G4NeutronCaptureXS::BuildPhysicsTable(..)","had012",
252 FatalException, ed, "");
253 return;
254 }
255
256 if(nullptr == data) {
257#ifdef G4MULTITHREADED
258 G4MUTEXLOCK(&neutronCaptureXSMutex);
259 if(nullptr == data) {
260#endif
261 isMaster = true;
262 data = new G4ElementData();
263 data->SetName("NeutronCapture");
264 FindDirectoryPath();
265#ifdef G4MULTITHREADED
266 }
267 G4MUTEXUNLOCK(&neutronCaptureXSMutex);
268#endif
269 }
270
271 // it is possible re-initialisation for the second run
272 if(isMaster) {
273
274 // Access to elements
275 auto theCoupleTable = G4ProductionCutsTable::GetProductionCutsTable();
276 size_t numOfCouples = theCoupleTable->GetTableSize();
277 for(size_t j=0; j<numOfCouples; ++j) {
278 auto mat = theCoupleTable->GetMaterialCutsCouple(j)->GetMaterial();
279 auto elmVec = mat->GetElementVector();
280 size_t numOfElem = mat->GetNumberOfElements();
281 for (size_t ie = 0; ie < numOfElem; ++ie) {
282 G4int Z = std::max(1,std::min(((*elmVec)[ie])->GetZasInt(), MAXZCAPTURE-1));
283 if(nullptr == data->GetElementData(Z)) { Initialise(Z); }
284 }
285 }
286 }
287}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40
#define G4MUTEXLOCK(mutex)
Definition: G4Threading.hh:251
#define G4MUTEXUNLOCK(mutex)
Definition: G4Threading.hh:254
int G4int
Definition: G4Types.hh:85
G4PhysicsVector * GetElementData(G4int Z)
void SetName(const G4String &nam)
const G4String & GetParticleName() const
static G4ProductionCutsTable * GetProductionCutsTable()

◆ CrossSectionDescription()

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

Reimplemented from G4VCrossSectionDataSet.

Definition at line 83 of file G4NeutronCaptureXS.cc.

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

◆ Default_Name()

static const char * G4NeutronCaptureXS::Default_Name ( )
inlinestatic

Definition at line 68 of file G4NeutronCaptureXS.hh.

68{return "G4NeutronCaptureXS";}

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

◆ 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) { return xs; }
114
115 G4int Z = std::min(ZZ, MAXZCAPTURE-1);
116 G4double logEkin = aParticle->GetLogKineticEnergy();
117 if(ekin < elimit) { ekin = elimit; logEkin = logElimit; }
118
119 auto pv = GetPhysicsVector(Z);
120 if(pv == nullptr) { return xs; }
121
122 const G4double e1 = pv->Energy(1);
123 xs = (ekin >= e1) ? pv->LogVectorValue(ekin, logEkin)
124 : (*pv)[1]*std::sqrt(e1/ekin);
125
126#ifdef G4VERBOSE
127 if(verboseLevel > 1){
128 G4cout << "Ekin= " << ekin/CLHEP::MeV
129 << " ElmXScap(b)= " << xs/CLHEP::barn << G4endl;
130 }
131#endif
132 return xs;
133}
double G4double
Definition: G4Types.hh:83
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 136 of file G4NeutronCaptureXS.cc.

140{
141 return IsoCrossSection(aParticle->GetKineticEnergy(),
142 aParticle->GetLogKineticEnergy(),
143 Z, A);
144}
G4double IsoCrossSection(G4double ekin, G4double logekin, G4int Z, G4int A)

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

148{
149 G4double xs = 0.0;
150 if(eKin > emax) { return xs; }
151
152 G4int Z = std::min(ZZ, MAXZCAPTURE-1);
153 G4double ekin = eKin;
154 G4double logEkin = logE;
155 if(ekin < elimit) {
156 ekin = elimit;
157 logEkin = logElimit;
158 }
159
160 auto pv = GetPhysicsVector(Z);
161 if(pv == nullptr) { return xs; }
162
163 if(amin[Z] > 0 && A >= amin[Z] && A <= amax[Z]) {
164 G4PhysicsVector* pviso = data->GetComponentDataByID(Z, A - amin[Z]);
165 if(pviso != nullptr) {
166 const G4double e1 = pviso->Energy(1);
167 xs = (ekin >= e1) ? pviso->LogVectorValue(ekin, logEkin)
168 : (*pviso)[1]*std::sqrt(e1/ekin);
169#ifdef G4VERBOSE
170 if(verboseLevel > 0) {
171 G4cout << "G4NeutronCaptureXS::IsoXS: Ekin(MeV)= " << ekin/MeV
172 << " xs(b)= " << xs/barn
173 << " Z= " << Z << " A= " << A << G4endl;
174 }
175#endif
176 return xs;
177 }
178 }
179 // isotope data are not available or applicable
180 const G4double e1 = pv->Energy(1);
181 xs = (ekin >= e1) ? pv->LogVectorValue(ekin, logEkin)
182 : (*pv)[1]*std::sqrt(e1/ekin);
183#ifdef G4VERBOSE
184 if(verboseLevel > 0) {
185 G4cout << "G4NeutronCaptureXS::IsoXS: Ekin(MeV)= " << ekin/MeV
186 << " xs(b)= " << xs/barn
187 << " Z= " << Z << " A= " << A << " no iso XS" << G4endl;
188 }
189#endif
190 return xs;
191}
double A(double temperature)
G4PhysicsVector * GetComponentDataByID(G4int Z, G4int id)
G4double Energy(std::size_t index) const
G4double LogVectorValue(const G4double theEnergy, const G4double theLogEnergy) const

Referenced by 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 194 of file G4NeutronCaptureXS.cc.

196{
197 size_t nIso = anElement->GetNumberOfIsotopes();
198 const G4Isotope* iso = anElement->GetIsotope(0);
199
200 //G4cout << "SelectIsotope NIso= " << nIso << G4endl;
201 if(1 == nIso) { return iso; }
202
203 // more than 1 isotope
204 G4int Z = anElement->GetZasInt();
205
206 const G4double* abundVector = anElement->GetRelativeAbundanceVector();
208 G4double sum = 0.0;
209
210 // is there isotope wise cross section?
211 size_t j;
212 if(0 == amin[Z] || Z >= MAXZCAPTURE) {
213 for (j = 0; j<nIso; ++j) {
214 sum += abundVector[j];
215 if(q <= sum) {
216 iso = anElement->GetIsotope(j);
217 break;
218 }
219 }
220 return iso;
221 }
222 size_t nn = temp.size();
223 if(nn < nIso) { temp.resize(nIso, 0.); }
224
225 for (j=0; j<nIso; ++j) {
226 sum += abundVector[j]*IsoCrossSection(kinEnergy, logE, Z,
227 anElement->GetIsotope(j)->GetN());
228 temp[j] = sum;
229 }
230 sum *= q;
231 for (j = 0; j<nIso; ++j) {
232 if(temp[j] >= sum) {
233 iso = anElement->GetIsotope(j);
234 break;
235 }
236 }
237 return iso;
238}
#define G4UniformRand()
Definition: Randomize.hh:52
G4double * GetRelativeAbundanceVector() const
Definition: G4Element.hh:166
const G4Isotope * GetIsotope(G4int iso) const
Definition: G4Element.hh:169
size_t GetNumberOfIsotopes() const
Definition: G4Element.hh:158
G4int GetZasInt() const
Definition: G4Element.hh:131
G4int GetN() const
Definition: G4Isotope.hh:93

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