#include <G4INCLNaturalIsotopicDistributions.hh>
Public Member Functions | |
IsotopicDistribution (IsotopeVector const &aVector) | |
Constructor. | |
G4int | drawRandomIsotope () const |
Draw a random isotope based on the abundance vector. | |
IsotopeVector const & | getIsotopes () const |
Get the isotope vector. |
Definition at line 63 of file G4INCLNaturalIsotopicDistributions.hh.
G4INCL::IsotopicDistribution::IsotopicDistribution | ( | IsotopeVector const & | aVector | ) |
Constructor.
Definition at line 57 of file G4INCLNaturalIsotopicDistributions.cc.
00057 : 00058 theIsotopes(aVector) 00059 { 00060 G4double previousAbundance = 0.; 00061 // Cumulate the abundances 00062 for(IsotopeIter i=theIsotopes.begin(); i!=theIsotopes.end(); ++i) { 00063 i->theAbundance += previousAbundance; 00064 previousAbundance = i->theAbundance; 00065 } 00066 // Normalize the abundances to 1 00067 const G4double normalisation = 1./theIsotopes.back().theAbundance; 00068 for(IsotopeIter i=theIsotopes.begin(); i!=theIsotopes.end(); ++i) 00069 i->theAbundance *= normalisation; 00070 }
G4int G4INCL::IsotopicDistribution::drawRandomIsotope | ( | ) | const |
Draw a random isotope based on the abundance vector.
Definition at line 72 of file G4INCLNaturalIsotopicDistributions.cc.
References G4INCL::Random::shoot().
Referenced by G4INCL::NaturalIsotopicDistributions::drawRandomIsotope().
00072 { 00073 const G4double r = Random::shoot(); 00074 for(unsigned int i=0; i<theIsotopes.size()-1; ++i) { 00075 if(r<=theIsotopes.at(i).theAbundance) 00076 return theIsotopes.at(i).theA; 00077 } 00078 return theIsotopes.back().theA; 00079 }
IsotopeVector const & G4INCL::IsotopicDistribution::getIsotopes | ( | ) | const |