Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4INCL::NaturalIsotopicDistributions Class Reference

Class that stores isotopic abundances for a given element. More...

#include <G4INCLNaturalIsotopicDistributions.hh>

Public Member Functions

 NaturalIsotopicDistributions ()
 Constructor.
 
G4int drawRandomIsotope (G4int const Z) const
 Draw a random isotope.
 
IsotopicDistribution constgetIsotopicDistribution (G4int const Z) const
 Get an isotopic distribution.
 

Detailed Description

Class that stores isotopic abundances for a given element.

Definition at line 82 of file G4INCLNaturalIsotopicDistributions.hh.

Constructor & Destructor Documentation

◆ NaturalIsotopicDistributions()

G4INCL::NaturalIsotopicDistributions::NaturalIsotopicDistributions ( )

Constructor.

Definition at line 409 of file G4INCLNaturalIsotopicDistributions.cc.

409 {
410 G4int oldZ = -1;
411 IsotopeVector aVector;
412 for(unsigned int i=0; i<sizeOfArray(theRawDistributions); ++i) {
413 std::pair<G4int, Isotope> const &aPair = theRawDistributions[i];
414 if(aPair.first == oldZ) {
415 aVector.push_back(aPair.second);
416 } else {
417 if(oldZ!=-1)
418 theDistributions.insert(std::pair<G4int, IsotopicDistribution>(oldZ, IsotopicDistribution(aVector)));
419 oldZ = aPair.first;
420 aVector.clear();
421 aVector.push_back(aPair.second);
422 }
423 }
424 // last element
425 theDistributions.insert(std::pair<G4int, IsotopicDistribution>(oldZ, IsotopicDistribution(aVector)));
426 }
int G4int
Definition: G4Types.hh:66
std::vector< Isotope > IsotopeVector

Member Function Documentation

◆ drawRandomIsotope()

G4int G4INCL::NaturalIsotopicDistributions::drawRandomIsotope ( G4int const  Z) const

Draw a random isotope.

Parameters
Zthe element number

Definition at line 108 of file G4INCLNaturalIsotopicDistributions.cc.

108 {
110 }
G4int drawRandomIsotope() const
Draw a random isotope based on the abundance vector.
IsotopicDistribution const & getIsotopicDistribution(G4int const Z) const
Get an isotopic distribution.

Referenced by G4INCL::ParticleTable::drawRandomNaturalIsotope().

◆ getIsotopicDistribution()

IsotopicDistribution const & G4INCL::NaturalIsotopicDistributions::getIsotopicDistribution ( G4int const  Z) const

Get an isotopic distribution.

Parameters
Zthe element number

Definition at line 93 of file G4INCLNaturalIsotopicDistributions.cc.

93 {
94 std::map<G4int, IsotopicDistribution>::const_iterator i = theDistributions.find(Z);
95 if(i!=theDistributions.end())
96 return i->second;
97 else {
98 FATAL("Requested natural isotopic distribution for synthetic element Z = " << Z << std::endl);
99#ifdef INCL_ROOT_USE
100 gSystem->Exit(EXIT_FAILURE);
101#else
102 std::exit(EXIT_FAILURE);
103#endif
104 return theDistributions.begin()->second;
105 }
106 }
#define FATAL(x)

Referenced by drawRandomIsotope(), and G4INCL::ParticleTable::getNaturalIsotopicDistribution().


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