Geant4-11
Public Member Functions | Private Attributes
G4INCL::IsotopicDistribution Class Reference

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

#include <G4INCLNaturalIsotopicDistributions.hh>

Public Member Functions

G4int drawRandomIsotope () const
 Draw a random isotope based on the abundance vector. More...
 
IsotopeVector const & getIsotopes () const
 Get the isotope vector. More...
 
 IsotopicDistribution (IsotopeVector const &aVector)
 Constructor. More...
 

Private Attributes

IsotopeVector theIsotopes
 

Detailed Description

Class that stores isotopic abundances for a given element.

Definition at line 64 of file G4INCLNaturalIsotopicDistributions.hh.

Constructor & Destructor Documentation

◆ IsotopicDistribution()

G4INCL::IsotopicDistribution::IsotopicDistribution ( IsotopeVector const &  aVector)

Constructor.

Definition at line 59 of file G4INCLNaturalIsotopicDistributions.cc.

59 :
60 theIsotopes(aVector)
61 {
62 G4double previousAbundance = 0.;
63 // Cumulate the abundances
64 for(IsotopeIter i=theIsotopes.begin(), e=theIsotopes.end(); i!=e; ++i) {
65 i->theAbundance += previousAbundance;
66 previousAbundance = i->theAbundance;
67 }
68 // Normalize the abundances to 1
69 const G4double normalisation = 1./theIsotopes.back().theAbundance;
70 for(IsotopeIter i=theIsotopes.begin(), e=theIsotopes.end(); i!=e; ++i)
71 i->theAbundance *= normalisation;
72 }
double G4double
Definition: G4Types.hh:83
IsotopeVector::iterator IsotopeIter

References theIsotopes.

Member Function Documentation

◆ drawRandomIsotope()

G4int G4INCL::IsotopicDistribution::drawRandomIsotope ( ) const

Draw a random isotope based on the abundance vector.

Definition at line 74 of file G4INCLNaturalIsotopicDistributions.cc.

74 {
75 const G4double r = Random::shoot();
76 for(unsigned int i=0; i<theIsotopes.size()-1; ++i) {
77 if(r<=theIsotopes.at(i).theAbundance)
78 return theIsotopes.at(i).theA;
79 }
80 return theIsotopes.back().theA;
81 }
G4double shoot()
Definition: G4INCLRandom.cc:93

References G4INCL::Random::shoot(), and theIsotopes.

Referenced by G4INCL::NaturalIsotopicDistributions::drawRandomIsotope().

◆ getIsotopes()

IsotopeVector const & G4INCL::IsotopicDistribution::getIsotopes ( ) const

Get the isotope vector.

Definition at line 83 of file G4INCLNaturalIsotopicDistributions.cc.

83 {
84 return theIsotopes;
85 }

References theIsotopes.

Referenced by G4INCL::INCL::initUniverseRadius().

Field Documentation

◆ theIsotopes

IsotopeVector G4INCL::IsotopicDistribution::theIsotopes
private

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