Geant4-11
Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
G4IsotopeMagneticMomentTable Class Reference

#include <G4IsotopeMagneticMomentTable.hh>

Inheritance diagram for G4IsotopeMagneticMomentTable:
G4VIsotopeTable

Public Types

typedef std::vector< G4IsotopeProperty * > G4IsotopeList
 
typedef std::vector< G4StringG4IsotopeNameList
 

Public Member Functions

void DumpTable (G4int Zmin=1, G4int Zmax=118)
 
virtual G4bool FindIsotope (G4IsotopeProperty *property)
 
 G4IsotopeMagneticMomentTable ()
 
virtual G4IsotopePropertyGetIsotope (G4int Z, G4int A, G4double E, G4Ions::G4FloatLevelBase flb=G4Ions::G4FloatLevelBase::no_Float)
 
virtual G4IsotopePropertyGetIsotopeByIsoLvl (G4int Z, G4int A, G4int lvl=0)
 
const G4StringGetName () const
 
void SetVerboseLevel (G4int level)
 
virtual ~G4IsotopeMagneticMomentTable ()
 

Protected Member Functions

 G4IsotopeMagneticMomentTable (const G4IsotopeMagneticMomentTable &right)
 
G4IsotopeMagneticMomentTableoperator= (const G4IsotopeMagneticMomentTable &right)
 

Private Member Functions

G4int GetVerboseLevel () const
 

Private Attributes

G4IsotopeList fIsotopeList
 
G4String fName = ""
 
G4int verboseLevel = 0
 

Static Private Attributes

static const G4double levelTolerance = 2.0*keV
 
static const G4double nuclearMagneton = eplus*hbar_Planck/2./(proton_mass_c2 /c_squared)
 

Detailed Description

Definition at line 53 of file G4IsotopeMagneticMomentTable.hh.

Member Typedef Documentation

◆ G4IsotopeList

Definition at line 62 of file G4IsotopeMagneticMomentTable.hh.

◆ G4IsotopeNameList

Definition at line 63 of file G4IsotopeMagneticMomentTable.hh.

Constructor & Destructor Documentation

◆ G4IsotopeMagneticMomentTable() [1/2]

G4IsotopeMagneticMomentTable::G4IsotopeMagneticMomentTable ( )

Definition at line 56 of file G4IsotopeMagneticMomentTable.cc.

57 :G4VIsotopeTable("MagneticMoment")
58{
59 if ( !std::getenv("G4IONMAGNETICMOMENT")) {
60#ifdef G4VERBOSE
61 if (GetVerboseLevel()>1) {
62 G4cout << "G4IsotopeMagneticMomentTable::G4IsotopeMagneticMomentTable(): "
63 << "Please setenv G4IONMAGNETICMOMENT for the magnetic moment data."
64 << G4endl;
65 G4Exception( "G4IsotopeMagneticMomentTable",
66 "File Not Found",
68 "Please setenv G4IONMAGNETICMOMENT");
69 }
70#endif
71 G4Exception( "G4IsotopeMagneticMomentTable",
72 "File Not Found",
74 "Please setenv G4IONMAGNETICMOMENT");
75 return;
76 }
77
78 G4String file = std::getenv("G4IONMAGNETICMOMENT");
79 std::ifstream DataFile(file);
80
81 if (!DataFile ) {
82#ifdef G4VERBOSE
83 if (GetVerboseLevel()>0) {
84 G4cout << "G4IsotopeMagneticMomentTable::G4IsotopeMagneticMomentTable(): "
85 << file << " is not found " << G4endl;
86 }
87#endif
88 G4Exception( "G4IsotopeMagneticMomentTable",
89 "File Not Found",
91 "Can not open G4IONMAGNETICMOMENT file");
92 return;
93 }
94
95 char inputChars[80]={' '};
96
97 while ( !DataFile.eof() ) { // Loop checking, 09.08.2015, K.Kurashige
98 DataFile.getline(inputChars, 80);
99 G4String inputLine = inputChars;
100 G4int ionA, ionZ, ionJ, isomer;
101 G4double ionE, ionMu, ionLife;
102 G4String ionName, ionLifeUnit;
103
104 if (inputChars[0] != '#' && inputLine.length() != 0) {
105 std::istringstream tmpstream(inputLine);
106 tmpstream >> ionZ >> ionName >> ionA
107 >> isomer >> ionE
108 >> ionLife >> ionLifeUnit
109 >> ionJ >> ionMu;
110
111 G4IsotopeProperty* fProperty = new G4IsotopeProperty();
112 // Set Isotope Property
113 fProperty->SetAtomicNumber(ionZ);
114 fProperty->SetAtomicMass(ionA);
115 fProperty->SetIsomerLevel(isomer);
116 fProperty->SetEnergy(ionE * MeV);
117 fProperty->SetiSpin(ionJ);
118 fProperty->SetMagneticMoment(ionMu*nuclearMagneton);
119
120 fIsotopeList.push_back(fProperty);
121
122 //if (GetVerboseLevel()>2) {
123 // fProperty->DumpInfo();
124 //}
125
126 }
127 }
128
129 DataFile.close();
130}
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
static constexpr double MeV
Definition: G4SIunits.hh:200
double G4double
Definition: G4Types.hh:83
int G4int
Definition: G4Types.hh:85
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
void SetAtomicMass(G4int A)
void SetEnergy(G4double E)
void SetiSpin(G4int J)
void SetAtomicNumber(G4int Z)
void SetIsomerLevel(G4int level)
void SetMagneticMoment(G4double M)

References geant4_check_module_cycles::file, fIsotopeList, G4cout, G4endl, G4Exception(), GetVerboseLevel(), JustWarning, MeV, nuclearMagneton, G4IsotopeProperty::SetAtomicMass(), G4IsotopeProperty::SetAtomicNumber(), G4IsotopeProperty::SetEnergy(), G4IsotopeProperty::SetIsomerLevel(), G4IsotopeProperty::SetiSpin(), and G4IsotopeProperty::SetMagneticMoment().

◆ G4IsotopeMagneticMomentTable() [2/2]

G4IsotopeMagneticMomentTable::G4IsotopeMagneticMomentTable ( const G4IsotopeMagneticMomentTable right)
protected

Definition at line 142 of file G4IsotopeMagneticMomentTable.cc.

143 :G4VIsotopeTable(right),
144 fIsotopeList(0)
145{
146}

◆ ~G4IsotopeMagneticMomentTable()

G4IsotopeMagneticMomentTable::~G4IsotopeMagneticMomentTable ( )
virtual

Definition at line 133 of file G4IsotopeMagneticMomentTable.cc.

134{
135 for (size_t i = 0 ; i< fIsotopeList.size(); i++) {
136 delete fIsotopeList[i];
137 }
138 fIsotopeList.clear();
139}

References fIsotopeList.

Member Function Documentation

◆ DumpTable()

void G4VIsotopeTable::DumpTable ( G4int  Zmin = 1,
G4int  Zmax = 118 
)
inherited

Definition at line 83 of file G4VIsotopeTable.cc.

84{
85 G4int Z, A;
86 G4int lvl;
87 const G4int MAX_LVL=9;
88 for ( Z =Zmin; Z<=Zmax; ++Z )
89 {
90 for ( A= Z; A<=3*Z; ++A )
91 {
92 for ( lvl=0; lvl<=MAX_LVL; ++lvl )
93 {
94 G4IsotopeProperty* ptr = GetIsotope(Z,A,lvl);
95 if (ptr!=nullptr) ptr->DumpInfo();
96 }
97 }
98 }
99}
const G4int Z[17]
const G4double A[17]
virtual G4IsotopeProperty * GetIsotope(G4int Z, G4int A, G4double E, G4Ions::G4FloatLevelBase flb=G4Ions::G4FloatLevelBase::no_Float)=0

References A, G4IsotopeProperty::DumpInfo(), G4VIsotopeTable::GetIsotope(), and Z.

◆ FindIsotope()

G4bool G4IsotopeMagneticMomentTable::FindIsotope ( G4IsotopeProperty property)
virtual

Definition at line 155 of file G4IsotopeMagneticMomentTable.cc.

156{
157 for (size_t i = 0 ; i< fIsotopeList.size(); ++i) {
159
160 // check Z
161 if ( fP->GetAtomicNumber() > pP->GetAtomicNumber()) {
162 // Not Found
163 break;
164 }
165 if ( fP->GetAtomicNumber() < pP->GetAtomicNumber()) {
166 // next
167 continue;
168 }
169
170 // check A
171 if ( fP->GetAtomicMass() != pP->GetAtomicMass()) {
172 // next
173 continue;
174 }
175
176 //check isomerLevel
177 if (fP->GetIsomerLevel() != pP->GetIsomerLevel()) {
178 // next
179 continue;
180 }
181
182 //check E
183 if (std::fabs(fP->GetEnergy() - pP->GetEnergy()) < levelTolerance) {
184 // Found
185 return true;
186 }
187
188 }
189 return false;
190}
G4double GetEnergy() const
G4int GetAtomicMass() const
G4int GetAtomicNumber() const
G4int GetIsomerLevel() const

References fIsotopeList, G4IsotopeProperty::GetAtomicMass(), G4IsotopeProperty::GetAtomicNumber(), G4IsotopeProperty::GetEnergy(), G4IsotopeProperty::GetIsomerLevel(), and levelTolerance.

◆ GetIsotope()

G4IsotopeProperty * G4IsotopeMagneticMomentTable::GetIsotope ( G4int  Z,
G4int  A,
G4double  E,
G4Ions::G4FloatLevelBase  flb = G4Ions::G4FloatLevelBase::no_Float 
)
virtual

Implements G4VIsotopeTable.

Definition at line 194 of file G4IsotopeMagneticMomentTable.cc.

196{
197 G4IsotopeProperty* fProperty = 0;
198 for (size_t i = 0 ; i< fIsotopeList.size(); ++i) {
200
201 // check Z
202 if ( fP->GetAtomicNumber() > Z) {
203 // Not Found
204 break;
205 }
206 if ( fP->GetAtomicNumber() < Z) {
207 // next
208 continue;
209 }
210
211 // check A
212 if ( fP->GetAtomicMass() != A ) {
213 // next
214 continue;
215 }
216
217 //check E
218 if (std::fabs(fP->GetEnergy() - E) < levelTolerance) {
219 // Found
220 fProperty = fP;
221 // fP->DumpInfo();
222 break;
223 }
224
225 }
226
227 return fProperty;
228
229}

References A, fIsotopeList, G4IsotopeProperty::GetAtomicMass(), G4IsotopeProperty::GetAtomicNumber(), G4IsotopeProperty::GetEnergy(), levelTolerance, and Z.

◆ GetIsotopeByIsoLvl()

G4IsotopeProperty * G4IsotopeMagneticMomentTable::GetIsotopeByIsoLvl ( G4int  Z,
G4int  A,
G4int  lvl = 0 
)
virtual

Reimplemented from G4VIsotopeTable.

Definition at line 233 of file G4IsotopeMagneticMomentTable.cc.

234{
235 G4IsotopeProperty* fProperty = 0;
236 for (size_t i = 0 ; i< fIsotopeList.size(); ++i) {
238
239 // check Z
240 if ( fP->GetAtomicNumber() > Z) {
241 // Not Found
242 break;
243 }
244 if ( fP->GetAtomicNumber() < Z) {
245 // next
246 continue;
247 }
248 // check A
249 if ( fP->GetAtomicMass() != A ) {
250 // next
251 continue;
252 }
253
254
255 //check isomerLevel
256 if (fP->GetIsomerLevel() == lvl) {
257 // Found
258 fProperty = fP;
259 //fP->DumpInfo();
260 break;
261 }
262
263 }
264
265 return fProperty;
266
267}

References A, fIsotopeList, G4IsotopeProperty::GetAtomicMass(), G4IsotopeProperty::GetAtomicNumber(), G4IsotopeProperty::GetIsomerLevel(), and Z.

◆ GetName()

const G4String & G4VIsotopeTable::GetName ( ) const
inlineinherited

Definition at line 101 of file G4VIsotopeTable.hh.

102{
103 return fName;
104}

References G4VIsotopeTable::fName.

Referenced by G4IonTable::RegisterIsotopeTable().

◆ GetVerboseLevel()

G4int G4IsotopeMagneticMomentTable::GetVerboseLevel ( ) const
inlineprivate

Definition at line 116 of file G4IsotopeMagneticMomentTable.hh.

117{
119}
G4int GetVerboseLevel() const
static G4ParticleTable * GetParticleTable()

References G4ParticleTable::GetParticleTable(), and G4ParticleTable::GetVerboseLevel().

Referenced by G4IsotopeMagneticMomentTable().

◆ operator=()

G4IsotopeMagneticMomentTable & G4IsotopeMagneticMomentTable::operator= ( const G4IsotopeMagneticMomentTable right)
protected

Definition at line 149 of file G4IsotopeMagneticMomentTable.cc.

150{
151 return *this;
152}

◆ SetVerboseLevel()

void G4VIsotopeTable::SetVerboseLevel ( G4int  level)
inlineinherited

Definition at line 113 of file G4VIsotopeTable.hh.

114{
115 verboseLevel = level;
116}

References G4VIsotopeTable::verboseLevel.

Field Documentation

◆ fIsotopeList

G4IsotopeList G4IsotopeMagneticMomentTable::fIsotopeList
private

◆ fName

G4String G4VIsotopeTable::fName = ""
privateinherited

Definition at line 92 of file G4VIsotopeTable.hh.

Referenced by G4VIsotopeTable::GetName(), and G4VIsotopeTable::operator=().

◆ levelTolerance

const G4double G4IsotopeMagneticMomentTable::levelTolerance = 2.0*keV
staticprivate

Definition at line 110 of file G4IsotopeMagneticMomentTable.hh.

Referenced by FindIsotope(), and GetIsotope().

◆ nuclearMagneton

const G4double G4IsotopeMagneticMomentTable::nuclearMagneton = eplus*hbar_Planck/2./(proton_mass_c2 /c_squared)
staticprivate

Definition at line 111 of file G4IsotopeMagneticMomentTable.hh.

Referenced by G4IsotopeMagneticMomentTable().

◆ verboseLevel

G4int G4VIsotopeTable::verboseLevel = 0
privateinherited

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