Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4INCL::NaturalIsotopicDistributions Class Reference

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

#include <G4INCLNaturalIsotopicDistributions.hh>

Public Member Functions

 NaturalIsotopicDistributions ()
 Constructor. More...
 
G4int drawRandomIsotope (G4int const Z) const
 Draw a random isotope. More...
 
IsotopicDistribution const & getIsotopicDistribution (G4int const Z) const
 Get an isotopic distribution. More...
 

Detailed Description

Class that stores isotopic abundances for a given element.

Definition at line 81 of file G4INCLNaturalIsotopicDistributions.hh.

Constructor & Destructor Documentation

G4INCL::NaturalIsotopicDistributions::NaturalIsotopicDistributions ( )

Constructor.

Definition at line 398 of file G4INCLNaturalIsotopicDistributions.cc.

398  {
399  G4int oldZ = -1;
400  IsotopeVector aVector;
401  for(unsigned int i=0; i<sizeOfArray(theRawDistributions); ++i) {
402  std::pair<G4int, Isotope> const &aPair = theRawDistributions[i];
403  if(aPair.first == oldZ) {
404  aVector.push_back(aPair.second);
405  } else {
406  if(oldZ!=-1)
407  theDistributions.insert(std::pair<G4int, IsotopicDistribution>(oldZ, IsotopicDistribution(aVector)));
408  oldZ = aPair.first;
409  aVector.clear();
410  aVector.push_back(aPair.second);
411  }
412  }
413  // last element
414  theDistributions.insert(std::pair<G4int, IsotopicDistribution>(oldZ, IsotopicDistribution(aVector)));
415  }
int G4int
Definition: G4Types.hh:78
std::vector< Isotope > IsotopeVector

Member Function Documentation

G4int G4INCL::NaturalIsotopicDistributions::drawRandomIsotope ( G4int const  Z) const

Draw a random isotope.

Parameters
Zthe element number

Definition at line 97 of file G4INCLNaturalIsotopicDistributions.cc.

97  {
99  }
IsotopicDistribution const & getIsotopicDistribution(G4int const Z) const
Get an isotopic distribution.
G4int drawRandomIsotope() const
Draw a random isotope based on the abundance vector.
IsotopicDistribution const & G4INCL::NaturalIsotopicDistributions::getIsotopicDistribution ( G4int const  Z) const

Get an isotopic distribution.

Parameters
Zthe element number

Definition at line 87 of file G4INCLNaturalIsotopicDistributions.cc.

87  {
88  std::map<G4int, IsotopicDistribution>::const_iterator i = theDistributions.find(Z);
89  if(i!=theDistributions.end())
90  return i->second;
91  else {
92  INCL_FATAL("Requested natural isotopic distribution for synthetic element Z = " << Z << '\n');
93  return theDistributions.begin()->second;
94  }
95  }
#define INCL_FATAL(x)

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