Geant4 11.4.0
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 {0}
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 69 of file G4ParticleInelasticXS.cc.

70 : G4VCrossSectionDataSet("G4ParticleInelasticXS"),
71 particle(part),
72 elimit(20*CLHEP::MeV)
73{
75 if (nullptr == part) {
76 G4Exception("G4ParticleInelasticXS::G4ParticleInelasticXS(..)","had015",
77 FatalException, "NO particle definition in constructor");
78 } else {
79 verboseLevel = 0;
80 const G4String& particleName = particle->GetParticleName();
81 if(verboseLevel > 1) {
82 G4cout << "G4ParticleInelasticXS::G4ParticleInelasticXS for "
83 << particleName << " on atoms with Z < " << MAXZINELP << G4endl;
84 }
85 if (particleName == "proton") {
86 highEnergyXsection = xsr->GetComponentCrossSection("Glauber-Gribov");
87 if(highEnergyXsection == nullptr) {
88 highEnergyXsection = new G4ComponentGGHadronNucleusXsc();
89 }
90 } else {
91 highEnergyXsection =
92 xsr->GetComponentCrossSection("Glauber-Gribov Nucl-nucl");
93 if(highEnergyXsection == nullptr) {
94 highEnergyXsection = new G4ComponentGGNuclNuclXsc();
95 }
96 for (index=1; index<5; ++index) {
97 if (particleName == pname[index]) { break; }
98 }
99 index = std::min(index, 4);
100 if (1 < index) { SetMaxKinEnergy(25.6*CLHEP::PeV); }
101 }
102 }
103 // this should never happens but ...
104 if (nullptr == highEnergyXsection) {
105 highEnergyXsection = xsr->GetComponentCrossSection("Glauber-Gribov");
106 }
108 if (gDataDirectory.empty()) {
110 }
111 G4String ss = pname[index] + "ParticleXS";
112 SetName(ss);
113 if (data[index] == nullptr) {
114 data[index] = new G4ElementData(MAXZINELP);
115 data[index]->SetName(pname[index] + "PartInel");
116 for (G4int Z=1; Z<MAXZINELP; ++Z) { Initialise(Z); }
117 }
118}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
int G4int
Definition G4Types.hh:85
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
static G4CrossSectionDataSetRegistry * Instance()
static G4HadronicParameters * Instance()
const G4String & GetDirPARTICLEXS() const
G4VCrossSectionDataSet(const G4String &nam="")
void SetMaxKinEnergy(G4double value)
void SetForAllAtomsAndEnergies(G4bool val)
void SetName(const G4String &nam)

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

◆ ~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 301 of file G4ParticleInelasticXS.cc.

302{
303 if (verboseLevel > 0){
304 G4cout << "G4ParticleInelasticXS::BuildPhysicsTable for "
305 << p.GetParticleName() << G4endl;
306 }
307 if (&p != particle) {
309 ed << p.GetParticleName() << " is a wrong particle type -"
310 << particle->GetParticleName() << " is expected";
311 G4Exception("G4ParticleInelasticXS::BuildPhysicsTable(..)","had012",
312 FatalException, ed, "");
313 return;
314 }
315
316 // it is possible re-initialisation for the new run
318
319 // prepare isotope selection
320 std::size_t nIso = temp.size();
321
322 // Access to elements
323 for ( auto const & elm : *table ) {
324 std::size_t n = elm->GetNumberOfIsotopes();
325 if (n > nIso) { nIso = n; }
326 G4int Z = std::min( elm->GetZasInt(), MAXZINELP-1);
327 if ( nullptr == (data[index])->GetElementData(Z) ) {
328 InitialiseOnFly(Z);
329 }
330 }
331 temp.resize(nIso, 0.0);
332}
std::vector< G4Element * > G4ElementTable
std::ostringstream G4ExceptionDescription
static const G4ElementTable * GetElementTable()
Definition G4Element.cc:401
const G4String & GetParticleName() const

Referenced by G4InterfaceToXS::G4InterfaceToXS(), and ~G4ParticleInelasticXS().

◆ ComputeCrossSectionPerElement()

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

Reimplemented from G4VCrossSectionDataSet.

Definition at line 153 of file G4ParticleInelasticXS.cc.

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

Referenced by ~G4ParticleInelasticXS().

◆ 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 188 of file G4ParticleInelasticXS.cc.

192{
193 return IsoCrossSection(ekin, loge, Z, A);
194}
const G4double A[17]
G4double IsoCrossSection(G4double ekin, G4double logE, G4int Z, G4int A)

Referenced by ~G4ParticleInelasticXS().

◆ CrossSectionDescription()

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

Reimplemented from G4VCrossSectionDataSet.

Definition at line 120 of file G4ParticleInelasticXS.cc.

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

Referenced by ~G4ParticleInelasticXS().

◆ ElementCrossSection()

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

Definition at line 161 of file G4ParticleInelasticXS.cc.

162{
163 G4int Z = (ZZ >= MAXZINELP) ? MAXZINELP - 1 : ZZ;
164
165 // element data is always valid pointer by construction of XS
166 auto pv = GetPhysicsVector(Z);
167
168 // set to null x-section below lowest energy in the table
169 G4double xs = 0.0;
170 if (ekin > pv->Energy(0)) {
171 xs = (ekin <= pv->GetMaxEnergy()) ? pv->LogVectorValue(ekin, loge)
172 : coeff[Z][index]*highEnergyXsection->GetInelasticElementCrossSection(particle,
173 ekin, Z, aeff[Z]);
174 }
175
176#ifdef G4VERBOSE
177 if(verboseLevel > 1) {
178 G4cout << "ElmXS: Z= " << Z << " Ekin(MeV)= " << ekin/CLHEP::MeV
179 << " xs(bn)= " << xs/CLHEP::barn << " element data for "
180 << particle->GetParticleName()
181 << " idx= " << index << G4endl;
182 }
183#endif
184 return xs;
185}
double G4double
Definition G4Types.hh:83

Referenced by ComputeCrossSectionPerElement(), GetElementCrossSection(), and ~G4ParticleInelasticXS().

◆ GetElementCrossSection()

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

Reimplemented from G4VCrossSectionDataSet.

Definition at line 145 of file G4ParticleInelasticXS.cc.

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

Referenced by ~G4ParticleInelasticXS().

◆ 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 197 of file G4ParticleInelasticXS.cc.

200{
201 return IsoCrossSection(aParticle->GetKineticEnergy(),
202 aParticle->GetLogKineticEnergy(), Z, A);
203}

Referenced by ~G4ParticleInelasticXS().

◆ IsElementApplicable()

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

Reimplemented from G4VCrossSectionDataSet.

Definition at line 130 of file G4ParticleInelasticXS.cc.

132{
133 return true;
134}

◆ 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 137 of file G4ParticleInelasticXS.cc.

140{
141 return true;
142}

Referenced by ~G4ParticleInelasticXS().

◆ IsoCrossSection()

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

Definition at line 206 of file G4ParticleInelasticXS.cc.

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

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

◆ 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 251 of file G4ParticleInelasticXS.cc.

253{
254 G4int nIso = (G4int)anElement->GetNumberOfIsotopes();
255 const G4Isotope* iso = anElement->GetIsotope(0);
256
257 if (1 == nIso) { return iso; }
258
259 // more than 1 isotope
260 G4int Z = anElement->GetZasInt();
261
262 // initialisation for given Z
263 GetPhysicsVector(Z);
264
265 const G4double* abundVector = anElement->GetRelativeAbundanceVector();
267 G4double sum = 0.0;
268 G4int j;
269
270 // isotope wise cross section not available
271 if (Z >= MAXZINELP || 0 == data[index]->GetNumberOfComponents(Z)) {
272 for (j=0; j<nIso; ++j) {
273 sum += abundVector[j];
274 if(q <= sum) {
275 iso = anElement->GetIsotope(j);
276 break;
277 }
278 }
279 return iso;
280 }
281
282 G4int nn = (G4int)temp.size();
283 if (nn < nIso) { temp.resize(nIso, 0.); }
284
285 for (j=0; j<nIso; ++j) {
286 sum += abundVector[j]*IsoCrossSection(kinEnergy, logE, Z,
287 anElement->GetIsotope(j)->GetN());
288 temp[j] = sum;
289 }
290 sum *= q;
291 for (j=0; j<nIso; ++j) {
292 if (temp[j] >= sum) {
293 iso = anElement->GetIsotope(j);
294 break;
295 }
296 }
297 return iso;
298}
#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

Referenced by ~G4ParticleInelasticXS().


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