Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
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 63 of file G4INCLNaturalIsotopicDistributions.hh.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 57 of file G4INCLNaturalIsotopicDistributions.cc.

57  :
58  theIsotopes(aVector)
59  {
60  G4double previousAbundance = 0.;
61  // Cumulate the abundances
62  for(IsotopeIter i=theIsotopes.begin(), e=theIsotopes.end(); i!=e; ++i) {
63  i->theAbundance += previousAbundance;
64  previousAbundance = i->theAbundance;
65  }
66  // Normalize the abundances to 1
67  const G4double normalisation = 1./theIsotopes.back().theAbundance;
68  for(IsotopeIter i=theIsotopes.begin(), e=theIsotopes.end(); i!=e; ++i)
69  i->theAbundance *= normalisation;
70  }
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 72 of file G4INCLNaturalIsotopicDistributions.cc.

References G4INCL::Random::shoot().

72  {
73  const G4double r = Random::shoot();
74  for(unsigned int i=0; i<theIsotopes.size()-1; ++i) {
75  if(r<=theIsotopes.at(i).theAbundance)
76  return theIsotopes.at(i).theA;
77  }
78  return theIsotopes.back().theA;
79  }
G4double shoot()
Definition: G4INCLRandom.cc:74
double G4double
Definition: G4Types.hh:76
IsotopeVector const & G4INCL::IsotopicDistribution::getIsotopes ( ) const

Get the isotope vector.

Definition at line 81 of file G4INCLNaturalIsotopicDistributions.cc.

81  {
82  return theIsotopes;
83  }

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