G4INCL::IsotopicDistribution Class Reference

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

#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.


Detailed Description

Class that stores isotopic abundances for a given element.

Definition at line 63 of file G4INCLNaturalIsotopicDistributions.hh.


Constructor & Destructor Documentation

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   }


Member Function Documentation

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

Get the isotope vector.

Definition at line 81 of file G4INCLNaturalIsotopicDistributions.cc.

00081                                                                {
00082     return theIsotopes;
00083   }


The documentation for this class was generated from the following files:
Generated on Mon May 27 17:54:08 2013 for Geant4 by  doxygen 1.4.7