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

#include <G4ParticleInelasticXS.hh>

+ Inheritance diagram for G4ParticleInelasticXS:

Public Member Functions

 G4ParticleInelasticXS (const G4ParticleDefinition *)
 
 ~G4ParticleInelasticXS () override=default
 
G4bool IsElementApplicable (const G4DynamicParticle *, G4int Z, const G4Material *mat=nullptr) final
 
G4bool IsIsoApplicable (const G4DynamicParticle *, G4int Z, G4int A, const G4Element *elm=nullptr, const G4Material *mat=nullptr) final
 
G4double GetElementCrossSection (const G4DynamicParticle *, G4int Z, const G4Material *mat=nullptr) 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=nullptr, const G4Element *elm=nullptr, const G4Material *mat=nullptr) 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 logE, G4int Z, G4int A)
 
G4ParticleInelasticXSoperator= (const G4ParticleInelasticXS &right)=delete
 
 G4ParticleInelasticXS (const G4ParticleInelasticXS &)=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
 

Additional Inherited Members

- Protected Attributes inherited from G4VCrossSectionDataSet
G4int verboseLevel
 
G4String name
 

Detailed Description

Definition at line 56 of file G4ParticleInelasticXS.hh.

Constructor & Destructor Documentation

◆ G4ParticleInelasticXS() [1/2]

G4ParticleInelasticXS::G4ParticleInelasticXS ( const G4ParticleDefinition * part)
explicit

Definition at line 72 of file G4ParticleInelasticXS.cc.

73 : G4VCrossSectionDataSet("G4ParticleInelasticXS"),
74 particle(part),
75 elimit(20*CLHEP::MeV)
76{
77 if(nullptr == part) {
78 G4Exception("G4ParticleInelasticXS::G4ParticleInelasticXS(..)","had015",
79 FatalException, "NO particle definition in constructor");
80 } else {
81 verboseLevel = 0;
82 const G4String& particleName = particle->GetParticleName();
83 if(verboseLevel > 1) {
84 G4cout << "G4ParticleInelasticXS::G4ParticleInelasticXS for "
85 << particleName << " on atoms with Z < " << MAXZINELP << G4endl;
86 }
88 if(particleName == "proton") {
89 highEnergyXsection = xsr->GetComponentCrossSection("Glauber-Gribov");
90 if(highEnergyXsection == nullptr) {
91 highEnergyXsection = new G4ComponentGGHadronNucleusXsc();
92 }
93 } else {
94 highEnergyXsection =
95 xsr->GetComponentCrossSection("Glauber-Gribov Nucl-nucl");
96 if(highEnergyXsection == nullptr) {
97 highEnergyXsection = new G4ComponentGGNuclNuclXsc();
98 }
99 for (index=1; index<5; ++index) {
100 if (particleName == pname[index]) { break; }
101 }
102 if (index == 5) {
104 ed << particleName << " is a wrong particle type";
105 G4Exception("G4ParticleInelasticXS::BuildPhysicsTable(..)","had012",
106 FatalException, ed, "");
107 }
108 if (1 < index) { SetMaxKinEnergy(25.6*CLHEP::PeV); }
109 }
110 }
112 if (data[0] == nullptr) {
113 for (G4int i=0; i<5; ++i) {
114 data[i] = new G4ElementData(MAXZINELP);
115 data[i]->SetName(pname[i] + "IonInel");
116 }
117 FindDirectoryPath();
118 }
119}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
int G4int
Definition G4Types.hh:85
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
static G4CrossSectionDataSetRegistry * Instance()
void SetName(const G4String &nam)
const G4String & GetParticleName() const
G4VCrossSectionDataSet(const G4String &nam="")
void SetMaxKinEnergy(G4double value)
void SetForAllAtomsAndEnergies(G4bool val)

◆ ~G4ParticleInelasticXS()

G4ParticleInelasticXS::~G4ParticleInelasticXS ( )
overridedefault

◆ G4ParticleInelasticXS() [2/2]

G4ParticleInelasticXS::G4ParticleInelasticXS ( const G4ParticleInelasticXS & )
delete

Member Function Documentation

◆ BuildPhysicsTable()

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

Reimplemented from G4VCrossSectionDataSet.

Definition at line 291 of file G4ParticleInelasticXS.cc.

292{
293 if (verboseLevel > 0){
294 G4cout << "G4ParticleInelasticXS::BuildPhysicsTable for "
295 << p.GetParticleName() << G4endl;
296 }
297 if (&p != particle) {
299 ed << p.GetParticleName() << " is a wrong particle type -"
300 << particle->GetParticleName() << " is expected";
301 G4Exception("G4ParticleInelasticXS::BuildPhysicsTable(..)","had012",
302 FatalException, ed, "");
303 return;
304 }
305
306 // it is possible re-initialisation for the new run
308
309 // initialise static tables only once
310 std::call_once(applyOnce, [this]() { isInitializer = true; });
311
312 if (isInitializer) {
313 G4AutoLock l(&pInelasticXSMutex);
314
315 // Access to elements
316 for ( auto const & elm : *table ) {
317 G4int Z = std::max( 1, std::min( elm->GetZasInt(), MAXZINELP-1) );
318 for (G4int i=0; i<5; ++i) {
319 if ( nullptr == (data[i])->GetElementData(Z) ) { Initialise(Z, i); }
320 }
321 }
322 l.unlock();
323 }
324 // prepare isotope selection
325 std::size_t nIso = temp.size();
326 for ( auto const & elm : *table ) {
327 std::size_t n = elm->GetNumberOfIsotopes();
328 if (n > nIso) { nIso = n; }
329 }
330 temp.resize(nIso, 0.0);
331}
std::vector< G4Element * > G4ElementTable
static G4ElementTable * GetElementTable()
Definition G4Element.cc:389

◆ ComputeCrossSectionPerElement()

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

Reimplemented from G4VCrossSectionDataSet.

Definition at line 154 of file G4ParticleInelasticXS.cc.

158{
159 return ElementCrossSection(ekin, loge, elm->GetZasInt());
160}
G4int GetZasInt() const
Definition G4Element.hh:120
G4double ElementCrossSection(G4double kinEnergy, G4double loge, G4int Z)

◆ ComputeIsoCrossSection()

G4double G4ParticleInelasticXS::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 183 of file G4ParticleInelasticXS.cc.

187{
188 return IsoCrossSection(ekin, loge, Z, A);
189}
const G4double A[17]
G4double IsoCrossSection(G4double ekin, G4double logE, G4int Z, G4int A)

◆ CrossSectionDescription()

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

Reimplemented from G4VCrossSectionDataSet.

Definition at line 121 of file G4ParticleInelasticXS.cc.

122{
123 outFile << "G4ParticleInelasticXS calculates n, p, d, t, he3, he4 inelastic\n"
124 << "cross section on nuclei using data from the high precision\n"
125 << "neutron database. These data are simplified and smoothed over\n"
126 << "the resonance region in order to reduce CPU time.\n"
127 << "For high energy Glauber-Gribov cross section model is used.\n";
128}

◆ ElementCrossSection()

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

Definition at line 162 of file G4ParticleInelasticXS.cc.

163{
164 G4int Z = (ZZ >= MAXZINELP) ? MAXZINELP - 1 : ZZ;
165 auto pv = GetPhysicsVector(Z);
166
167 G4double xs = (ekin <= pv->GetMaxEnergy()) ? pv->LogVectorValue(ekin, loge)
168 : coeff[Z][index]*highEnergyXsection->GetInelasticElementCrossSection(particle,
169 ekin, Z, aeff[Z]);
170
171#ifdef G4VERBOSE
172 if(verboseLevel > 1) {
173 G4cout << "ElmXS: Z= " << Z << " Ekin(MeV)= " << ekin/CLHEP::MeV
174 << " xs(bn)= " << xs/CLHEP::barn << " element data for "
175 << particle->GetParticleName()
176 << " idx= " << index << G4endl;
177 }
178#endif
179 return xs;
180}
double G4double
Definition G4Types.hh:83
G4double GetInelasticElementCrossSection(const G4ParticleDefinition *, G4double kinEnergy, const G4Element *)

Referenced by ComputeCrossSectionPerElement(), and GetElementCrossSection().

◆ GetElementCrossSection()

G4double G4ParticleInelasticXS::GetElementCrossSection ( const G4DynamicParticle * aParticle,
G4int Z,
const G4Material * mat = nullptr )
finalvirtual

Reimplemented from G4VCrossSectionDataSet.

Definition at line 146 of file G4ParticleInelasticXS.cc.

148{
149 return ElementCrossSection(aParticle->GetKineticEnergy(),
150 aParticle->GetLogKineticEnergy(), Z);
151}
G4double GetLogKineticEnergy() const
G4double GetKineticEnergy() const

◆ GetIsoCrossSection()

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

Reimplemented from G4VCrossSectionDataSet.

Definition at line 192 of file G4ParticleInelasticXS.cc.

195{
196 return IsoCrossSection(aParticle->GetKineticEnergy(),
197 aParticle->GetLogKineticEnergy(), Z, A);
198}

◆ IsElementApplicable()

G4bool G4ParticleInelasticXS::IsElementApplicable ( const G4DynamicParticle * ,
G4int Z,
const G4Material * mat = nullptr )
finalvirtual

Reimplemented from G4VCrossSectionDataSet.

Definition at line 131 of file G4ParticleInelasticXS.cc.

133{
134 return true;
135}

◆ IsIsoApplicable()

G4bool G4ParticleInelasticXS::IsIsoApplicable ( const G4DynamicParticle * ,
G4int Z,
G4int A,
const G4Element * elm = nullptr,
const G4Material * mat = nullptr )
finalvirtual

Reimplemented from G4VCrossSectionDataSet.

Definition at line 138 of file G4ParticleInelasticXS.cc.

141{
142 return true;
143}

◆ IsoCrossSection()

G4double G4ParticleInelasticXS::IsoCrossSection ( G4double ekin,
G4double logE,
G4int Z,
G4int A )

Definition at line 201 of file G4ParticleInelasticXS.cc.

203{
204 G4double xs = 0.0;
205 G4int Z = (ZZ >= MAXZINELP) ? MAXZINELP - 1 : ZZ;
206 auto pv = GetPhysicsVector(Z);
207
208 // compute isotope cross section if applicable
209 if (ekin <= elimit && data[index]->GetNumberOfComponents(Z) > 0) {
210 auto pviso = data[index]->GetComponentDataByID(Z, A);
211 if(pviso != nullptr) {
212 xs = pviso->LogVectorValue(ekin, logE);
213#ifdef G4VERBOSE
214 if(verboseLevel > 1) {
215 G4cout << "G4ParticleInelasticXS::IsoXS: for "
216 << particle->GetParticleName() << " Ekin(MeV)= "
217 << ekin/CLHEP::MeV << " xs(b)= " << xs/CLHEP::barn
218 << " Z= " << Z << " A= " << A
219 << " idx= " << index << G4endl;
220 }
221#endif
222 return xs;
223 }
224 }
225 // use element x-section
226 xs = (ekin <= pv->GetMaxEnergy()) ? pv->LogVectorValue(ekin, logE)
227 : coeff[Z][index] *
228 highEnergyXsection->GetInelasticElementCrossSection(particle,
229 ekin, Z, aeff[Z]);
230 xs *= A/aeff[Z];
231#ifdef G4VERBOSE
232 if(verboseLevel > 1) {
233 G4cout << "IsoXS for " << particle->GetParticleName()
234 << " Target Z= " << Z << " A= " << A
235 << " Ekin(MeV)= " << ekin/CLHEP::MeV
236 << " xs(bn)= " << xs/CLHEP::barn
237 << " idx= " << index << G4endl;
238 }
239#endif
240 return xs;
241}
G4PhysicsVector * GetComponentDataByID(G4int Z, G4int id) const

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

◆ operator=()

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

◆ SelectIsotope()

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

Reimplemented from G4VCrossSectionDataSet.

Definition at line 243 of file G4ParticleInelasticXS.cc.

245{
246 G4int nIso = (G4int)anElement->GetNumberOfIsotopes();
247 const G4Isotope* iso = anElement->GetIsotope(0);
248
249 if (1 == nIso) { return iso; }
250
251 // more than 1 isotope
252 G4int Z = anElement->GetZasInt();
253 if (nullptr == data[index]->GetElementData(Z)) { InitialiseOnFly(Z); }
254
255 const G4double* abundVector = anElement->GetRelativeAbundanceVector();
257 G4double sum = 0.0;
258 G4int j;
259
260 // isotope wise cross section not available
261 if (Z >= MAXZINELP || 0 == data[index]->GetNumberOfComponents(Z)) {
262 for (j=0; j<nIso; ++j) {
263 sum += abundVector[j];
264 if(q <= sum) {
265 iso = anElement->GetIsotope(j);
266 break;
267 }
268 }
269 return iso;
270 }
271
272 G4int nn = (G4int)temp.size();
273 if (nn < nIso) { temp.resize(nIso, 0.); }
274
275 for (j=0; j<nIso; ++j) {
276 sum += abundVector[j]*IsoCrossSection(kinEnergy, logE, Z,
277 anElement->GetIsotope(j)->GetN());
278 temp[j] = sum;
279 }
280 sum *= q;
281 for (j=0; j<nIso; ++j) {
282 if (temp[j] >= sum) {
283 iso = anElement->GetIsotope(j);
284 break;
285 }
286 }
287 return iso;
288}
#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: