Geant4 11.1.1
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 const & getIsotopes () const
 Get the isotope vector.
 

Detailed Description

Class that stores isotopic abundances for a given element.

Definition at line 64 of file G4INCLNaturalIsotopicDistributions.hh.

Constructor & Destructor Documentation

◆ IsotopicDistribution()

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

Member Function Documentation

◆ drawRandomIsotope()

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

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

◆ getIsotopes()

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: