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

#include <G4IsotopeMagneticMomentTable.hh>

+ Inheritance diagram for G4IsotopeMagneticMomentTable:

Public Types

using G4IsotopeList = std::vector<G4IsotopeProperty*>
 
using G4IsotopeNameList = std::vector<G4String>
 

Public Member Functions

 G4IsotopeMagneticMomentTable ()
 
 ~G4IsotopeMagneticMomentTable () override
 
virtual G4bool FindIsotope (G4IsotopeProperty *property)
 
G4IsotopePropertyGetIsotope (G4int Z, G4int A, G4double E, G4Ions::G4FloatLevelBase flb=G4Ions::G4FloatLevelBase::no_Float) override
 
G4IsotopePropertyGetIsotopeByIsoLvl (G4int Z, G4int A, G4int lvl=0) override
 
- Public Member Functions inherited from G4VIsotopeTable
 G4VIsotopeTable ()=default
 
 G4VIsotopeTable (const G4String &)
 
 G4VIsotopeTable (const G4VIsotopeTable &)=default
 
G4VIsotopeTableoperator= (const G4VIsotopeTable &)
 
virtual ~G4VIsotopeTable ()=default
 
G4int GetVerboseLevel () const
 
void SetVerboseLevel (G4int level)
 
void DumpTable (G4int Zmin=1, G4int Zmax=118)
 
const G4StringGetName () const
 

Protected Member Functions

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

Detailed Description

IsomerLevel is added 30 Apr. 2013 H.Kurashige

Definition at line 49 of file G4IsotopeMagneticMomentTable.hh.

Member Typedef Documentation

◆ G4IsotopeList

◆ G4IsotopeNameList

Constructor & Destructor Documentation

◆ G4IsotopeMagneticMomentTable() [1/2]

G4IsotopeMagneticMomentTable::G4IsotopeMagneticMomentTable ( )

Definition at line 55 of file G4IsotopeMagneticMomentTable.cc.

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

◆ ~G4IsotopeMagneticMomentTable()

G4IsotopeMagneticMomentTable::~G4IsotopeMagneticMomentTable ( )
override

Definition at line 120 of file G4IsotopeMagneticMomentTable.cc.

121{
122 for (const auto& i : fIsotopeList) {
123 delete i;
124 }
125 fIsotopeList.clear();
126}

◆ G4IsotopeMagneticMomentTable() [2/2]

G4IsotopeMagneticMomentTable::G4IsotopeMagneticMomentTable ( const G4IsotopeMagneticMomentTable & right)
protected

Definition at line 128 of file G4IsotopeMagneticMomentTable.cc.

130 : G4VIsotopeTable(right), fIsotopeList(0)
131{}

Member Function Documentation

◆ FindIsotope()

G4bool G4IsotopeMagneticMomentTable::FindIsotope ( G4IsotopeProperty * property)
virtual

Definition at line 139 of file G4IsotopeMagneticMomentTable.cc.

140{
141 for (const auto fP : fIsotopeList) {
142 // check Z
143 if (fP->GetAtomicNumber() > pP->GetAtomicNumber()) {
144 // Not Found
145 break;
146 }
147 if (fP->GetAtomicNumber() < pP->GetAtomicNumber()) {
148 // next
149 continue;
150 }
151
152 // check A
153 if (fP->GetAtomicMass() != pP->GetAtomicMass()) {
154 // next
155 continue;
156 }
157
158 // check isomerLevel
159 if (fP->GetIsomerLevel() != pP->GetIsomerLevel()) {
160 // next
161 continue;
162 }
163
164 // check E
165 if (std::fabs(fP->GetEnergy() - pP->GetEnergy()) < levelTolerance) {
166 // Found
167 return true;
168 }
169 }
170 return false;
171}

◆ GetIsotope()

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

Implements G4VIsotopeTable.

Definition at line 173 of file G4IsotopeMagneticMomentTable.cc.

175{
176 G4IsotopeProperty* fProperty = nullptr;
177 for (const auto fP : fIsotopeList) {
178 // check Z
179 if (fP->GetAtomicNumber() > Z) {
180 // Not Found
181 break;
182 }
183 if (fP->GetAtomicNumber() < Z) {
184 // next
185 continue;
186 }
187
188 // check A
189 if (fP->GetAtomicMass() != A) {
190 // next
191 continue;
192 }
193
194 // check E
195 if (std::fabs(fP->GetEnergy() - E) < levelTolerance) {
196 // Found
197 fProperty = fP;
198 // fP->DumpInfo();
199 break;
200 }
201 }
202
203 return fProperty;
204}
const G4double A[17]

◆ GetIsotopeByIsoLvl()

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

Reimplemented from G4VIsotopeTable.

Definition at line 206 of file G4IsotopeMagneticMomentTable.cc.

207{
208 G4IsotopeProperty* fProperty = nullptr;
209 for (const auto fP : fIsotopeList) {
210 // check Z
211 if (fP->GetAtomicNumber() > Z) {
212 // Not Found
213 break;
214 }
215 if (fP->GetAtomicNumber() < Z) {
216 // next
217 continue;
218 }
219 // check A
220 if (fP->GetAtomicMass() != A) {
221 // next
222 continue;
223 }
224
225 // check isomerLevel
226 if (fP->GetIsomerLevel() == lvl) {
227 // Found
228 fProperty = fP;
229 // fP->DumpInfo();
230 break;
231 }
232 }
233
234 return fProperty;
235}

◆ operator=()

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

Definition at line 134 of file G4IsotopeMagneticMomentTable.cc.

135{
136 return *this;
137}

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