Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
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 constgetIsotopes () const
 Get the isotope vector.
 

Detailed Description

Class that stores isotopic abundances for a given element.

Definition at line 65 of file G4INCLNaturalIsotopicDistributions.hh.

Constructor & Destructor Documentation

◆ IsotopicDistribution()

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

Constructor.

Definition at line 65 of file G4INCLNaturalIsotopicDistributions.cc.

65 :
66 theIsotopes(aVector)
67 {
68 G4double previousAbundance = 0.;
69 // Cumulate the abundances
70 for(IsotopeIter i=theIsotopes.begin(); i!=theIsotopes.end(); ++i) {
71 i->theAbundance += previousAbundance;
72 previousAbundance = i->theAbundance;
73 }
74 // Normalize the abundances to 1
75 const G4double normalisation = 1./theIsotopes.back().theAbundance;
76 for(IsotopeIter i=theIsotopes.begin(); i!=theIsotopes.end(); ++i)
77 i->theAbundance *= normalisation;
78 }
double G4double
Definition: G4Types.hh:64
IsotopeVector::iterator IsotopeIter

Member Function Documentation

◆ drawRandomIsotope()

G4int G4INCL::IsotopicDistribution::drawRandomIsotope ( ) const

Draw a random isotope based on the abundance vector.

Definition at line 80 of file G4INCLNaturalIsotopicDistributions.cc.

80 {
81 const G4double r = Random::shoot();
82 for(unsigned int i=0; i<theIsotopes.size()-1; ++i) {
83 if(r<=theIsotopes.at(i).theAbundance)
84 return theIsotopes.at(i).theA;
85 }
86 return theIsotopes.back().theA;
87 }
static G4double shoot()
Definition: G4INCLRandom.hh:99

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

◆ getIsotopes()

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

Get the isotope vector.

Definition at line 89 of file G4INCLNaturalIsotopicDistributions.cc.

89 {
90 return theIsotopes;
91 }

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