Geant4-11
Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Static Private Attributes
G4ParticleInelasticXS Class Referencefinal

#include <G4ParticleInelasticXS.hh>

Inheritance diagram for G4ParticleInelasticXS:
G4VCrossSectionDataSet

Public Member Functions

void BuildPhysicsTable (const G4ParticleDefinition &) final
 
G4double ComputeCrossSection (const G4DynamicParticle *, const G4Element *, const G4Material *mat=nullptr)
 
void CrossSectionDescription (std::ostream &) const final
 
virtual void DumpPhysicsTable (const G4ParticleDefinition &)
 
bool ForAllAtomsAndEnergies () const
 
 G4ParticleInelasticXS (const G4ParticleDefinition *)
 
 G4ParticleInelasticXS (const G4ParticleInelasticXS &)=delete
 
G4double GetCrossSection (const G4DynamicParticle *, const G4Element *, const G4Material *mat=nullptr)
 
G4double GetElementCrossSection (const G4DynamicParticle *, G4int Z, const G4Material *mat=nullptr) final
 
G4double GetIsoCrossSection (const G4DynamicParticle *, G4int Z, G4int A, const G4Isotope *iso=nullptr, const G4Element *elm=nullptr, const G4Material *mat=nullptr) final
 
G4double GetMaxKinEnergy () const
 
G4double GetMinKinEnergy () const
 
const G4StringGetName () const
 
virtual G4int GetVerboseLevel () const
 
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 IsoCrossSection (G4double ekin, G4double logE, G4int Z, G4int A)
 
G4ParticleInelasticXSoperator= (const G4ParticleInelasticXS &right)=delete
 
const G4IsotopeSelectIsotope (const G4Element *, G4double kinEnergy, G4double logE) final
 
void SetForAllAtomsAndEnergies (G4bool val)
 
void SetMaxKinEnergy (G4double value)
 
void SetMinKinEnergy (G4double value)
 
void SetName (const G4String &nam)
 
virtual void SetVerboseLevel (G4int value)
 
 ~G4ParticleInelasticXS () final
 

Protected Attributes

G4String name
 
G4int verboseLevel
 

Private Member Functions

const G4StringFindDirectoryPath ()
 
const G4PhysicsVectorGetPhysicsVector (G4int Z)
 
void Initialise (G4int Z)
 
void InitialiseOnFly (G4int Z)
 
G4PhysicsVectorRetrieveVector (std::ostringstream &in, G4bool warn)
 

Private Attributes

G4VComponentCrossSectionhighEnergyXsection = nullptr
 
G4int index = 0
 
G4bool isForAllAtomsAndEnergies
 
G4bool isMaster = false
 
G4double maxKinEnergy
 
G4double minKinEnergy
 
const G4ParticleDefinitionparticle
 
G4CrossSectionDataSetRegistryregistry
 
std::vector< G4doubletemp
 

Static Private Attributes

static G4double coeff [MAXZINELP][5] = {{1.0}, {1.0}, {1.0}, {1.0}, {1.0}}
 
static G4ElementDatadata [5] = {nullptr}
 
static G4String gDataDirectory [5] = {""}
 
static const G4int MAXZINELP = 93
 

Detailed Description

Definition at line 57 of file G4ParticleInelasticXS.hh.

Constructor & Destructor Documentation

◆ G4ParticleInelasticXS() [1/2]

G4ParticleInelasticXS::G4ParticleInelasticXS ( const G4ParticleDefinition part)
explicit

Definition at line 65 of file G4ParticleInelasticXS.cc.

66 : G4VCrossSectionDataSet("G4ParticleInelasticXS"),
67 particle(part)
68{
69 if(nullptr == part) {
70 G4Exception("G4ParticleInelasticXS::G4ParticleInelasticXS(..)","had015",
71 FatalException, "NO particle definition in constructor");
72 } else {
73 verboseLevel = 0;
74 const G4String& particleName = particle->GetParticleName();
75 if(verboseLevel > 1) {
76 G4cout << "G4ParticleInelasticXS::G4ParticleInelasticXS for "
77 << particleName << " on atoms with Z < " << MAXZINELP << G4endl;
78 }
79 if(particleName == "proton") {
81 if(highEnergyXsection == nullptr) {
83 }
84 } else {
86 if(highEnergyXsection == nullptr) {
88 }
89 if(particleName == "deuteron") index = 1;
90 else if(particleName == "triton") index = 2;
91 else if(particleName == "He3") index = 3;
92 else if(particleName == "alpha") index = 4;
93 else {
95 ed << particleName << " is a wrong particle type";
96 G4Exception("G4ParticleInelasticXS::BuildPhysicsTable(..)","had012",
97 FatalException, ed, "");
98 }
99 }
100 }
102}
@ 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 G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
G4VComponentCrossSection * GetComponentCrossSection(const G4String &name)
static G4CrossSectionDataSetRegistry * Instance()
const G4String & GetParticleName() const
G4VComponentCrossSection * highEnergyXsection
static const G4int MAXZINELP
const G4ParticleDefinition * particle
G4VCrossSectionDataSet(const G4String &nam="")
void SetForAllAtomsAndEnergies(G4bool val)

References FatalException, G4cout, G4endl, G4Exception(), G4CrossSectionDataSetRegistry::GetComponentCrossSection(), G4ParticleDefinition::GetParticleName(), highEnergyXsection, index, G4CrossSectionDataSetRegistry::Instance(), MAXZINELP, particle, G4VCrossSectionDataSet::SetForAllAtomsAndEnergies(), and G4VCrossSectionDataSet::verboseLevel.

◆ ~G4ParticleInelasticXS()

G4ParticleInelasticXS::~G4ParticleInelasticXS ( )
final

Definition at line 104 of file G4ParticleInelasticXS.cc.

105{
106 if(isMaster) {
107 delete data[index];
108 data[index] = nullptr;
109 }
110}
static G4ElementData * data[5]

References data, index, and isMaster.

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

283{
284 if(verboseLevel > 0){
285 G4cout << "G4ParticleInelasticXS::BuildPhysicsTable for "
286 << p.GetParticleName() << G4endl;
287 }
288 if(&p != particle) {
290 ed << p.GetParticleName() << " is a wrong particle type -"
291 << particle->GetParticleName() << " is expected";
292 G4Exception("G4ParticleInelasticXS::BuildPhysicsTable(..)","had012",
293 FatalException, ed, "");
294 return;
295 }
296
297 G4int fact = (p.GetParticleName() == "proton") ? 1 : 256;
298 SetMaxKinEnergy(G4HadronicParameters::Instance()->GetMaxEnergy() * fact);
299
300 if(data[index] == nullptr) {
301#ifdef G4MULTITHREADED
302 G4MUTEXLOCK(&particleInelasticXSMutex);
303 if(data[index] == nullptr) {
304#endif
305 isMaster = true;
306 data[index] = new G4ElementData();
307 data[index]->SetName(particle->GetParticleName() + "Inelastic");
309#ifdef G4MULTITHREADED
310 }
311 G4MUTEXUNLOCK(&particleInelasticXSMutex);
312#endif
313 }
314
315 // it is possible re-initialisation for the new run
317 if(isMaster) {
318
319 // Access to elements
320 for ( auto & elm : *table ) {
321 G4int Z = std::max( 1, std::min( elm->GetZasInt(), MAXZINELP-1) );
322 if ( nullptr == (data[index])->GetElementData(Z) ) { Initialise(Z); }
323 }
324 }
325 // prepare isotope selection
326 size_t nIso = temp.size();
327 for ( auto & elm : *table ) {
328 size_t n = elm->GetNumberOfIsotopes();
329 if(n > nIso) { nIso = n; }
330 }
331 temp.resize(nIso, 0.0);
332}
std::vector< G4Element * > G4ElementTable
#define G4MUTEXLOCK(mutex)
Definition: G4Threading.hh:251
#define G4MUTEXUNLOCK(mutex)
Definition: G4Threading.hh:254
int G4int
Definition: G4Types.hh:85
const G4int Z[17]
void SetName(const G4String &nam)
static G4ElementTable * GetElementTable()
Definition: G4Element.cc:397
static G4HadronicParameters * Instance()
const G4String & FindDirectoryPath()
std::vector< G4double > temp
void SetMaxKinEnergy(G4double value)
T max(const T t1, const T t2)
brief Return the largest of the two arguments
T min(const T t1, const T t2)
brief Return the smallest of the two arguments

References data, FatalException, FindDirectoryPath(), G4cout, G4endl, G4Exception(), G4MUTEXLOCK, G4MUTEXUNLOCK, G4Element::GetElementTable(), G4ParticleDefinition::GetParticleName(), index, Initialise(), G4HadronicParameters::Instance(), isMaster, G4INCL::Math::max(), MAXZINELP, G4INCL::Math::min(), CLHEP::detail::n, particle, G4VCrossSectionDataSet::SetMaxKinEnergy(), G4ElementData::SetName(), temp, G4VCrossSectionDataSet::verboseLevel, and Z.

◆ ComputeCrossSection()

G4double G4VCrossSectionDataSet::ComputeCrossSection ( const G4DynamicParticle part,
const G4Element elm,
const G4Material mat = nullptr 
)
inherited

Definition at line 81 of file G4VCrossSectionDataSet.cc.

84{
85 G4int Z = elm->GetZasInt();
86
87 if (IsElementApplicable(part, Z, mat)) {
88 return GetElementCrossSection(part, Z, mat);
89 }
90
91 // isotope-wise cross section making sum over available
92 // isotope cross sections, which may be incomplete, so
93 // the result is corrected
94 size_t nIso = elm->GetNumberOfIsotopes();
95 G4double fact = 0.0;
96 G4double xsec = 0.0;
97
98 // user-defined isotope abundances
99 const G4IsotopeVector* isoVector = elm->GetIsotopeVector();
100 const G4double* abundVector = elm->GetRelativeAbundanceVector();
101
102 for (size_t j=0; j<nIso; ++j) {
103 const G4Isotope* iso = (*isoVector)[j];
104 G4int A = iso->GetN();
105 if(abundVector[j] > 0.0 && IsIsoApplicable(part, Z, A, elm, mat)) {
106 fact += abundVector[j];
107 xsec += abundVector[j]*GetIsoCrossSection(part, Z, A, iso, elm, mat);
108 }
109 }
110 return (fact > 0.0) ? xsec/fact : 0.0;
111}
std::vector< G4Isotope * > G4IsotopeVector
double G4double
Definition: G4Types.hh:83
const G4double A[17]
G4double * GetRelativeAbundanceVector() const
Definition: G4Element.hh:167
size_t GetNumberOfIsotopes() const
Definition: G4Element.hh:159
G4int GetZasInt() const
Definition: G4Element.hh:132
G4IsotopeVector * GetIsotopeVector() const
Definition: G4Element.hh:163
G4int GetN() const
Definition: G4Isotope.hh:93
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 G4bool IsIsoApplicable(const G4DynamicParticle *, G4int Z, G4int A, const G4Element *elm=nullptr, const G4Material *mat=nullptr)
virtual G4bool IsElementApplicable(const G4DynamicParticle *, G4int Z, const G4Material *mat=nullptr)

References A, G4VCrossSectionDataSet::GetElementCrossSection(), G4VCrossSectionDataSet::GetIsoCrossSection(), G4Element::GetIsotopeVector(), G4Isotope::GetN(), G4Element::GetNumberOfIsotopes(), G4Element::GetRelativeAbundanceVector(), G4Element::GetZasInt(), G4VCrossSectionDataSet::IsElementApplicable(), G4VCrossSectionDataSet::IsIsoApplicable(), and Z.

Referenced by G4VCrossSectionDataSet::GetCrossSection().

◆ CrossSectionDescription()

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

Reimplemented from G4VCrossSectionDataSet.

Definition at line 112 of file G4ParticleInelasticXS.cc.

113{
114 outFile << "G4ParticleInelasticXS calculates n, p, d, t, he3, he4 inelastic\n"
115 << "cross section on nuclei using data from the high precision\n"
116 << "neutron database. These data are simplified and smoothed over\n"
117 << "the resonance region in order to reduce CPU time.\n"
118 << "For high energy Glauber-Gribov cross section model is used\n";
119}

◆ DumpPhysicsTable()

void G4VCrossSectionDataSet::DumpPhysicsTable ( const G4ParticleDefinition )
virtualinherited

◆ FindDirectoryPath()

const G4String & G4ParticleInelasticXS::FindDirectoryPath ( )
private

Definition at line 334 of file G4ParticleInelasticXS.cc.

335{
336 // check environment variable
337 // build the complete string identifying the file with the data set
338 if(gDataDirectory[index].empty()) {
339 char* path = std::getenv("G4PARTICLEXSDATA");
340 if (nullptr != path) {
341 std::ostringstream ost;
342 ost << path << "/" << particle->GetParticleName() << "/inel";
343 gDataDirectory[index] = ost.str();
344 } else {
345 G4Exception("G4NeutronInelasticXS::Initialise(..)","had013",
347 "Environment variable G4PARTICLEXSDATA is not defined");
348 }
349 }
350 return gDataDirectory[index];
351}
static G4String gDataDirectory[5]

References anonymous_namespace{G4MTcoutDestination.cc}::empty, FatalException, G4Exception(), gDataDirectory, G4ParticleDefinition::GetParticleName(), index, and particle.

Referenced by BuildPhysicsTable(), and Initialise().

◆ ForAllAtomsAndEnergies()

bool G4VCrossSectionDataSet::ForAllAtomsAndEnergies ( ) const
inlineinherited

◆ GetCrossSection()

G4double G4VCrossSectionDataSet::GetCrossSection ( const G4DynamicParticle dp,
const G4Element elm,
const G4Material mat = nullptr 
)
inlineinherited

Definition at line 187 of file G4VCrossSectionDataSet.hh.

190{
191 return ComputeCrossSection(dp, elm, mat);
192}
G4double ComputeCrossSection(const G4DynamicParticle *, const G4Element *, const G4Material *mat=nullptr)

References G4VCrossSectionDataSet::ComputeCrossSection().

◆ GetElementCrossSection()

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

Reimplemented from G4VCrossSectionDataSet.

Definition at line 136 of file G4ParticleInelasticXS.cc.

139{
140 G4double xs = 0.0;
141 G4double ekin = aParticle->GetKineticEnergy();
142
143 G4int Z = (ZZ >= MAXZINELP) ? MAXZINELP - 1 : ZZ;
144
145 auto pv = GetPhysicsVector(Z);
146 if(nullptr == pv) { return xs; }
147 // G4cout << "G4ParticleInelasticXS::GetCrossSection e= " << ekin
148 // << " Z= " << Z << G4endl;
149
150 if(ekin <= pv->GetMaxEnergy()) {
151 xs = pv->LogVectorValue(ekin, aParticle->GetLogKineticEnergy());
152 } else {
154 ekin, Z, aeff[Z]);
155 }
156
157#ifdef G4VERBOSE
158 if(verboseLevel > 1) {
159 G4cout << "ElmXS: Z= " << Z << " Ekin(MeV)= " << ekin/CLHEP::MeV
160 << " xs(bn)= " << xs/CLHEP::barn << " element data for "
162 << " idx= " << index << G4endl;
163 }
164#endif
165 return xs;
166}
static const G4double aeff[]
G4double GetLogKineticEnergy() const
G4double GetKineticEnergy() const
const G4PhysicsVector * GetPhysicsVector(G4int Z)
static G4double coeff[MAXZINELP][5]
G4double GetInelasticElementCrossSection(const G4ParticleDefinition *, G4double kinEnergy, const G4Element *)
static constexpr double barn
Definition: SystemOfUnits.h:86
static constexpr double MeV

References aeff, CLHEP::barn, coeff, G4cout, G4endl, G4VComponentCrossSection::GetInelasticElementCrossSection(), G4DynamicParticle::GetKineticEnergy(), G4DynamicParticle::GetLogKineticEnergy(), G4ParticleDefinition::GetParticleName(), GetPhysicsVector(), highEnergyXsection, index, MAXZINELP, CLHEP::MeV, particle, G4VCrossSectionDataSet::verboseLevel, and Z.

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

172{
173 return IsoCrossSection(aParticle->GetKineticEnergy(),
174 aParticle->GetLogKineticEnergy(),Z, A);
175}
G4double IsoCrossSection(G4double ekin, G4double logE, G4int Z, G4int A)

References A, G4DynamicParticle::GetKineticEnergy(), G4DynamicParticle::GetLogKineticEnergy(), IsoCrossSection(), and Z.

◆ GetMaxKinEnergy()

G4double G4VCrossSectionDataSet::GetMaxKinEnergy ( ) const
inlineinherited

◆ GetMinKinEnergy()

G4double G4VCrossSectionDataSet::GetMinKinEnergy ( ) const
inlineinherited

◆ GetName()

const G4String & G4VCrossSectionDataSet::GetName ( ) const
inlineinherited

◆ GetPhysicsVector()

const G4PhysicsVector * G4ParticleInelasticXS::GetPhysicsVector ( G4int  Z)
inlineprivate

Definition at line 124 of file G4ParticleInelasticXS.hh.

125{
127 if(pv == nullptr) {
129 pv = data[index]->GetElementData(Z);
130 }
131 return pv;
132}
G4PhysicsVector * GetElementData(G4int Z)

References data, G4ElementData::GetElementData(), index, InitialiseOnFly(), and Z.

Referenced by GetElementCrossSection(), and IsoCrossSection().

◆ GetVerboseLevel()

G4int G4VCrossSectionDataSet::GetVerboseLevel ( ) const
inlinevirtualinherited

◆ Initialise()

void G4ParticleInelasticXS::Initialise ( G4int  Z)
private

Definition at line 366 of file G4ParticleInelasticXS.cc.

367{
368 if(nullptr != data[index]->GetElementData(Z)) { return; }
369
370 // upload element data
371 std::ostringstream ost;
372 ost << FindDirectoryPath() << Z ;
373 G4PhysicsVector* v = RetrieveVector(ost, true);
375 /*
376 G4cout << "G4ParticleInelasticXS::Initialise for Z= " << Z
377 << " idx= " << index
378 << " Amin= " << amin[Z]
379 << " Amax= " << amax[Z]
380 << " " << FindDirectoryPath() << G4endl;
381 */
382 // upload isotope data
383 if(amin[Z] < amax[Z]) {
384 G4int nmax = amax[Z] - amin[Z] + 1;
386
387 for(G4int A=amin[Z]; A<=amax[Z]; ++A) {
388 std::ostringstream ost1;
389 ost1 << FindDirectoryPath() << Z << "_" << A;
390 G4PhysicsVector* v1 = RetrieveVector(ost1, false);
391 data[index]->AddComponent(Z, A, v1);
392 /*
393 G4cout << " Isotope x-section Z= " << Z << " A= " << A
394 << " v1= " << v1 << G4endl;
395 */
396 }
397 }
398 // smooth transition
399 G4double sig1 = (*v)[v->GetVectorLength()-1];
400 G4double ehigh = v->GetMaxEnergy();
402 particle, ehigh, Z, aeff[Z]);
403 coeff[Z][index] = (sig2 > 0.) ? sig1/sig2 : 1.0;
404 /*
405 G4cout << "G4ParticleInelasticXS: index= " << index
406 << " Z= " << Z << " coeff= " << coeff[Z][index] << G4endl;
407 */
408}
static const G4int amax[]
static const G4int amin[]
void InitialiseForComponent(G4int Z, G4int nComponents=0)
void InitialiseForElement(G4int Z, G4PhysicsVector *v)
void AddComponent(G4int Z, G4int id, G4PhysicsVector *v)
G4PhysicsVector * RetrieveVector(std::ostringstream &in, G4bool warn)
G4double GetMaxEnergy() const
std::size_t GetVectorLength() const

References A, G4ElementData::AddComponent(), aeff, amax, amin, coeff, data, FindDirectoryPath(), G4VComponentCrossSection::GetInelasticElementCrossSection(), G4PhysicsVector::GetMaxEnergy(), G4PhysicsVector::GetVectorLength(), highEnergyXsection, index, G4ElementData::InitialiseForComponent(), G4ElementData::InitialiseForElement(), particle, RetrieveVector(), and Z.

Referenced by BuildPhysicsTable(), and InitialiseOnFly().

◆ InitialiseOnFly()

void G4ParticleInelasticXS::InitialiseOnFly ( G4int  Z)
private

Definition at line 353 of file G4ParticleInelasticXS.cc.

354{
355#ifdef G4MULTITHREADED
356 G4MUTEXLOCK(&particleInelasticXSMutex);
357 if(nullptr == data[index]->GetElementData(Z)) {
358#endif
359 Initialise(Z);
360#ifdef G4MULTITHREADED
361 }
362 G4MUTEXUNLOCK(&particleInelasticXSMutex);
363#endif
364}

References data, G4MUTEXLOCK, G4MUTEXUNLOCK, index, Initialise(), and Z.

Referenced by GetPhysicsVector().

◆ IsElementApplicable()

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

Reimplemented from G4VCrossSectionDataSet.

Definition at line 122 of file G4ParticleInelasticXS.cc.

124{
125 return true;
126}

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

132{
133 return true;
134}

◆ IsoCrossSection()

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

Definition at line 178 of file G4ParticleInelasticXS.cc.

180{
181 G4double xs = 0.0;
182 G4int Z = (ZZ >= MAXZINELP) ? MAXZINELP - 1 : ZZ;
183 /*
184 G4cout << "G4ParticleInelasticXS: IsoCrossSection Z= "
185 << Z << " A= " << A
186 << " Amin= " << amin[Z] << " Amax= " << amax[Z]
187 << " E(MeV)= " << ekin << G4endl;
188 */
189 auto pv = GetPhysicsVector(Z);
190 if(pv == nullptr) { return xs; }
191
192 // compute isotope cross section if applicable
193 const G4double emax = pv->GetMaxEnergy();
194 if(ekin <= emax && amin[Z] < amax[Z] && A >= amin[Z] && A <= amax[Z]) {
195 auto pviso = data[index]->GetComponentDataByIndex(Z, A - amin[Z]);
196 if(pviso != nullptr) {
197 xs = pviso->LogVectorValue(ekin, logE);
198#ifdef G4VERBOSE
199 if(verboseLevel > 1) {
200 G4cout << "G4ParticleInelasticXS::IsoXS: for "
201 << particle->GetParticleName() << " Ekin(MeV)= "
202 << ekin/CLHEP::MeV << " xs(b)= " << xs/CLHEP::barn
203 << " Z= " << Z << " A= " << A
204 << " idx= " << index << G4endl;
205 }
206#endif
207 return xs;
208 }
209 }
210 // use element x-section
211 if(ekin <= emax) {
212 xs = pv->LogVectorValue(ekin, logE);
213 } else {
214 xs = coeff[Z][index] *
216 ekin, Z, aeff[Z]);
217 }
218 xs *= A/aeff[Z];
219#ifdef G4VERBOSE
220 if(verboseLevel > 1) {
221 G4cout << "IsoXS for " << particle->GetParticleName()
222 << " Target Z= " << Z << " A= " << A
223 << " Ekin(MeV)= " << ekin/CLHEP::MeV
224 << " xs(bn)= " << xs/CLHEP::barn
225 << " idx= " << index << G4endl;
226 }
227#endif
228 return xs;
229}
static const G4double emax
G4PhysicsVector * GetComponentDataByIndex(G4int Z, G4int idx)
G4double LogVectorValue(const G4double energy, const G4double theLogEnergy) const

References A, aeff, amax, amin, CLHEP::barn, coeff, data, emax, G4cout, G4endl, G4ElementData::GetComponentDataByIndex(), G4VComponentCrossSection::GetInelasticElementCrossSection(), G4ParticleDefinition::GetParticleName(), GetPhysicsVector(), highEnergyXsection, index, G4PhysicsVector::LogVectorValue(), MAXZINELP, CLHEP::MeV, particle, G4VCrossSectionDataSet::verboseLevel, and Z.

Referenced by GetIsoCrossSection(), and SelectIsotope().

◆ operator=()

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

◆ RetrieveVector()

G4PhysicsVector * G4ParticleInelasticXS::RetrieveVector ( std::ostringstream &  in,
G4bool  warn 
)
private

Definition at line 411 of file G4ParticleInelasticXS.cc.

412{
413 G4PhysicsLogVector* v = nullptr;
414 std::ifstream filein(ost.str().c_str());
415 if (!filein.is_open()) {
416 if(warn) {
418 ed << "Data file <" << ost.str().c_str()
419 << "> is not opened!";
420 G4Exception("G4ParticleInelasticXS::RetrieveVector(..)","had014",
421 FatalException, ed, "Check G4PARTICLEXSDATA");
422 }
423 } else {
424 if(verboseLevel > 1) {
425 G4cout << "File " << ost.str()
426 << " is opened by G4ParticleInelasticXS" << G4endl;
427 }
428 // retrieve data from DB
429 v = new G4PhysicsLogVector();
430 if(!v->Retrieve(filein, true)) {
432 ed << "Data file <" << ost.str().c_str()
433 << "> is not retrieved!";
434 G4Exception("G4ParticleInelasticXS::RetrieveVector(..)","had015",
435 FatalException, ed, "Check G4PARTICLEXSDATA");
436 }
437 }
438 return v;
439}
G4bool Retrieve(std::ifstream &fIn, G4bool ascii=false)

References FatalException, G4cout, G4endl, G4Exception(), G4PhysicsVector::Retrieve(), and G4VCrossSectionDataSet::verboseLevel.

Referenced by Initialise().

◆ SelectIsotope()

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

Reimplemented from G4VCrossSectionDataSet.

Definition at line 231 of file G4ParticleInelasticXS.cc.

233{
234 size_t nIso = anElement->GetNumberOfIsotopes();
235 const G4Isotope* iso = anElement->GetIsotope(0);
236
237 //G4cout << "SelectIsotope NIso= " << nIso << G4endl;
238 if(1 == nIso) { return iso; }
239
240 // more than 1 isotope
241 G4int Z = anElement->GetZasInt();
242 //G4cout << "SelectIsotope Z= " << Z << G4endl;
243
244 const G4double* abundVector = anElement->GetRelativeAbundanceVector();
246 G4double sum = 0.0;
247 size_t j;
248
249 // isotope wise cross section not available
250 if(amax[Z] == amin[Z] || Z >= MAXZINELP) {
251 for (j=0; j<nIso; ++j) {
252 sum += abundVector[j];
253 if(q <= sum) {
254 iso = anElement->GetIsotope(j);
255 break;
256 }
257 }
258 return iso;
259 }
260
261 size_t nn = temp.size();
262 if(nn < nIso) { temp.resize(nIso, 0.); }
263
264 for (j=0; j<nIso; ++j) {
265 //G4cout << j << "-th isotope " << (*isoVector)[j]->GetN()
266 // << " abund= " << abundVector[j] << G4endl;
267 sum += abundVector[j]*IsoCrossSection(kinEnergy, logE, Z,
268 anElement->GetIsotope(j)->GetN());
269 temp[j] = sum;
270 }
271 sum *= q;
272 for (j=0; j<nIso; ++j) {
273 if(temp[j] >= sum) {
274 iso = anElement->GetIsotope(j);
275 break;
276 }
277 }
278 return iso;
279}
#define G4UniformRand()
Definition: Randomize.hh:52
const G4Isotope * GetIsotope(G4int iso) const
Definition: G4Element.hh:170

References amax, amin, G4UniformRand, G4Element::GetIsotope(), G4Isotope::GetN(), G4Element::GetNumberOfIsotopes(), G4Element::GetRelativeAbundanceVector(), G4Element::GetZasInt(), IsoCrossSection(), MAXZINELP, G4InuclParticleNames::nn, temp, and Z.

◆ SetForAllAtomsAndEnergies()

void G4VCrossSectionDataSet::SetForAllAtomsAndEnergies ( G4bool  val)
inlineinherited

◆ SetMaxKinEnergy()

void G4VCrossSectionDataSet::SetMaxKinEnergy ( G4double  value)
inlineinherited

◆ SetMinKinEnergy()

void G4VCrossSectionDataSet::SetMinKinEnergy ( G4double  value)
inlineinherited

◆ SetName()

void G4VCrossSectionDataSet::SetName ( const G4String nam)
inlineinherited

Definition at line 240 of file G4VCrossSectionDataSet.hh.

241{
242 name = nam;
243}

References G4VCrossSectionDataSet::name.

Referenced by G4ParticleHPInelasticData::G4ParticleHPInelasticData().

◆ SetVerboseLevel()

void G4VCrossSectionDataSet::SetVerboseLevel ( G4int  value)
inlinevirtualinherited

Field Documentation

◆ coeff

G4double G4ParticleInelasticXS::coeff = {{1.0}, {1.0}, {1.0}, {1.0}, {1.0}}
staticprivate

Definition at line 115 of file G4ParticleInelasticXS.hh.

Referenced by GetElementCrossSection(), Initialise(), and IsoCrossSection().

◆ data

G4ElementData * G4ParticleInelasticXS::data = {nullptr}
staticprivate

◆ gDataDirectory

G4String G4ParticleInelasticXS::gDataDirectory = {""}
staticprivate

Definition at line 116 of file G4ParticleInelasticXS.hh.

Referenced by FindDirectoryPath().

◆ highEnergyXsection

G4VComponentCrossSection* G4ParticleInelasticXS::highEnergyXsection = nullptr
private

◆ index

G4int G4ParticleInelasticXS::index = 0
private

◆ isForAllAtomsAndEnergies

G4bool G4VCrossSectionDataSet::isForAllAtomsAndEnergies
privateinherited

◆ isMaster

G4bool G4ParticleInelasticXS::isMaster = false
private

Definition at line 111 of file G4ParticleInelasticXS.hh.

Referenced by BuildPhysicsTable(), and ~G4ParticleInelasticXS().

◆ maxKinEnergy

G4double G4VCrossSectionDataSet::maxKinEnergy
privateinherited

◆ MAXZINELP

const G4int G4ParticleInelasticXS::MAXZINELP = 93
staticprivate

◆ minKinEnergy

G4double G4VCrossSectionDataSet::minKinEnergy
privateinherited

◆ name

G4String G4VCrossSectionDataSet::name
protectedinherited

◆ particle

const G4ParticleDefinition* G4ParticleInelasticXS::particle
private

◆ registry

G4CrossSectionDataSetRegistry* G4VCrossSectionDataSet::registry
privateinherited

◆ temp

std::vector<G4double> G4ParticleInelasticXS::temp
private

Definition at line 108 of file G4ParticleInelasticXS.hh.

Referenced by BuildPhysicsTable(), and SelectIsotope().

◆ verboseLevel

G4int G4VCrossSectionDataSet::verboseLevel
protectedinherited

Definition at line 168 of file G4VCrossSectionDataSet.hh.

Referenced by G4BGGNucleonElasticXS::BuildPhysicsTable(), G4BGGPionElasticXS::BuildPhysicsTable(), G4BGGPionInelasticXS::BuildPhysicsTable(), G4GammaNuclearXS::BuildPhysicsTable(), G4NeutronCaptureXS::BuildPhysicsTable(), G4NeutronElasticXS::BuildPhysicsTable(), G4NeutronInelasticXS::BuildPhysicsTable(), BuildPhysicsTable(), G4BGGNucleonInelasticXS::BuildPhysicsTable(), G4LENDCrossSection::create_used_target_map(), G4BGGNucleonElasticXS::G4BGGNucleonElasticXS(), G4BGGNucleonInelasticXS::G4BGGNucleonInelasticXS(), G4BGGPionElasticXS::G4BGGPionElasticXS(), G4BGGPionInelasticXS::G4BGGPionInelasticXS(), G4GammaNuclearXS::G4GammaNuclearXS(), G4NeutronCaptureXS::G4NeutronCaptureXS(), G4NeutronElasticXS::G4NeutronElasticXS(), G4NeutronInelasticXS::G4NeutronInelasticXS(), G4ParticleInelasticXS(), G4NeutronCaptureXS::GetElementCrossSection(), G4NeutronElasticXS::GetElementCrossSection(), G4NeutronInelasticXS::GetElementCrossSection(), G4BGGNucleonElasticXS::GetElementCrossSection(), G4BGGPionElasticXS::GetElementCrossSection(), G4BGGPionInelasticXS::GetElementCrossSection(), G4BGGNucleonInelasticXS::GetElementCrossSection(), G4GammaNuclearXS::GetElementCrossSection(), GetElementCrossSection(), G4BGGNucleonElasticXS::GetIsoCrossSection(), G4BGGPionElasticXS::GetIsoCrossSection(), G4BGGPionInelasticXS::GetIsoCrossSection(), G4GammaNuclearXS::GetIsoCrossSection(), G4BGGNucleonInelasticXS::GetIsoCrossSection(), G4VCrossSectionDataSet::GetVerboseLevel(), G4NeutronElasticXS::Initialise(), IsoCrossSection(), G4NeutronCaptureXS::IsoCrossSection(), G4NeutronInelasticXS::IsoCrossSection(), G4GammaNuclearXS::RetrieveVector(), G4NeutronCaptureXS::RetrieveVector(), G4NeutronInelasticXS::RetrieveVector(), RetrieveVector(), and G4VCrossSectionDataSet::SetVerboseLevel().


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