Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4Isotope Class Reference

#include <G4Isotope.hh>

Public Member Functions

 G4Isotope (const G4String &name, G4int z, G4int n, G4double a=0., G4int mlevel=0)
 
 ~G4Isotope ()
 
 G4Isotope (const G4Isotope &)=delete
 
G4Isotopeoperator= (const G4Isotope &)=delete
 
const G4StringGetName () const
 
G4int GetZ () const
 
G4int GetN () const
 
G4double GetA () const
 
G4int Getm () const
 
size_t GetIndex () const
 
G4bool operator== (const G4Isotope &) const
 
G4bool operator!= (const G4Isotope &) const
 
void SetName (const G4String &name)
 

Static Public Member Functions

static G4IsotopeGetIsotope (const G4String &name, G4bool warning=false)
 
static const G4IsotopeTableGetIsotopeTable ()
 
static size_t GetNumberOfIsotopes ()
 

Friends

std::ostream & operator<< (std::ostream &flux, const G4Isotope *isotope)
 
std::ostream & operator<< (std::ostream &flux, const G4Isotope &isotope)
 
std::ostream & operator<< (std::ostream &flux, const G4IsotopeTable &IsotopeTable)
 

Detailed Description

Definition at line 61 of file G4Isotope.hh.

Constructor & Destructor Documentation

◆ G4Isotope() [1/2]

G4Isotope::G4Isotope ( const G4String & name,
G4int z,
G4int n,
G4double a = 0.,
G4int mlevel = 0 )

Definition at line 53 of file G4Isotope.cc.

54 : fName(Name), fZ(Z), fN(N), fA(A), fm(il)
55{
56 if (Z < 1) {
58 ed << "Wrong Isotope " << Name << " Z= " << Z << G4endl;
59 G4Exception("G4Isotope::G4Isotope()", "mat001", FatalException, ed);
60 }
61 if (N < Z) {
63 ed << "Wrong Isotope " << Name << " Z= " << Z << " > N= " << N << G4endl;
64 G4Exception("G4Isotope::G4Isotope()", "mat002", FatalException, ed);
65 }
66 if (A <= 0.0) {
67 fA =
68 (G4NistManager::Instance()->GetAtomicMass(Z, N)) * CLHEP::g / (CLHEP::mole * CLHEP::amu_c2);
69 }
70 theIsotopeTable.push_back(this);
71 fIndexInTable = theIsotopeTable.size() - 1;
72}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
const G4double A[17]
#define G4endl
Definition G4ios.hh:67
G4double GetAtomicMass(G4int Z, G4int N) const
static G4NistManager * Instance()
#define N
Definition crc32.c:57

◆ ~G4Isotope()

G4Isotope::~G4Isotope ( )

Definition at line 76 of file G4Isotope.cc.

76{ theIsotopeTable[fIndexInTable] = nullptr; }

◆ G4Isotope() [2/2]

G4Isotope::G4Isotope ( const G4Isotope & )
delete

Member Function Documentation

◆ GetA()

G4double G4Isotope::GetA ( ) const
inline

Definition at line 86 of file G4Isotope.hh.

86{ return fA; }

Referenced by G4tgbGeometryDumper::DumpIsotope(), and G4GDMLWriteMaterials::IsotopeWrite().

◆ GetIndex()

size_t G4Isotope::GetIndex ( ) const
inline

Definition at line 97 of file G4Isotope.hh.

97{ return fIndexInTable; }

◆ GetIsotope()

G4Isotope * G4Isotope::GetIsotope ( const G4String & name,
G4bool warning = false )
static

Definition at line 140 of file G4Isotope.cc.

141{
142 // search the isotope by its name
143 for (auto& J : theIsotopeTable) {
144 if (J->GetName() == isotopeName) {
145 return J;
146 }
147 }
148
149 // the isotope does not exist in the table
150 if (warning) {
151 G4cout << "\n---> warning from G4Isotope::GetIsotope(). The isotope: " << isotopeName
152 << " does not exist in the table. Return NULL pointer." << G4endl;
153 }
154 return nullptr;
155}
G4GLOB_DLL std::ostream G4cout

Referenced by G4GDMLReadMaterials::GetIsotope().

◆ GetIsotopeTable()

const G4IsotopeTable * G4Isotope::GetIsotopeTable ( )
static

Definition at line 132 of file G4Isotope.cc.

132{ return &theIsotopeTable; }

Referenced by G4NistManager::~G4NistManager().

◆ Getm()

◆ GetN()

◆ GetName()

const G4String & G4Isotope::GetName ( ) const
inline

◆ GetNumberOfIsotopes()

size_t G4Isotope::GetNumberOfIsotopes ( )
static

Definition at line 136 of file G4Isotope.cc.

136{ return theIsotopeTable.size(); }

◆ GetZ()

◆ operator!=()

G4bool G4Isotope::operator!= ( const G4Isotope & right) const

Definition at line 84 of file G4Isotope.cc.

84{ return (this != (G4Isotope*)&right); }

◆ operator=()

G4Isotope & G4Isotope::operator= ( const G4Isotope & )
delete

◆ operator==()

G4bool G4Isotope::operator== ( const G4Isotope & right) const

Definition at line 80 of file G4Isotope.cc.

80{ return (this == (G4Isotope*)&right); }

◆ SetName()

void G4Isotope::SetName ( const G4String & name)
inline

Definition at line 108 of file G4Isotope.hh.

108{ fName = name; }
const char * name(G4int ptype)

Friends And Related Symbol Documentation

◆ operator<< [1/3]

std::ostream & operator<< ( std::ostream & flux,
const G4Isotope & isotope )
friend

Definition at line 110 of file G4Isotope.cc.

111{
112 flux << &isotope;
113 return flux;
114}

◆ operator<< [2/3]

std::ostream & operator<< ( std::ostream & flux,
const G4Isotope * isotope )
friend

Definition at line 88 of file G4Isotope.cc.

89{
90 std::ios::fmtflags mode = flux.flags();
91 flux.setf(std::ios::fixed, std::ios::floatfield);
92 G4long prec = flux.precision(3);
93
94 // clang-format off
95 flux
96 << " Isotope: " << std::setw(5) << isotope->fName
97 << " Z = " << std::setw(2) << isotope->fZ
98 << " N = " << std::setw(3) << isotope->fN
99 << " A = " << std::setw(6) << std::setprecision(2)
100 << (isotope->fA)/(g/mole) << " g/mole";
101 // clang-format on
102
103 flux.precision(prec);
104 flux.setf(mode, std::ios::floatfield);
105 return flux;
106}
long G4long
Definition G4Types.hh:87

◆ operator<< [3/3]

std::ostream & operator<< ( std::ostream & flux,
const G4IsotopeTable & IsotopeTable )
friend

Definition at line 118 of file G4Isotope.cc.

119{
120 // Dump info for all known isotopes
121 flux << "\n***** Table : Nb of isotopes = " << IsotopeTable.size() << " *****\n" << G4endl;
122
123 for (auto& i : IsotopeTable) {
124 flux << i << G4endl;
125 }
126
127 return flux;
128}

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