Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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. More...
 
G4int drawRandomIsotope () const
 Draw a random isotope based on the abundance vector. More...
 
IsotopeVector const & getIsotopes () const
 Get the isotope vector. More...
 

Detailed Description

Class that stores isotopic abundances for a given element.

Definition at line 64 of file G4INCLNaturalIsotopicDistributions.hh.

Constructor & Destructor Documentation

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  }
IsotopeVector::iterator IsotopeIter
double G4double
Definition: G4Types.hh:76

Member Function Documentation

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
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

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

Get the isotope vector.

Definition at line 83 of file G4INCLNaturalIsotopicDistributions.cc.

83  {
84  return theIsotopes;
85  }

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