Geant4 10.7.0
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

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

Public Member Functions

 G4IsotopeMagneticMomentTable ()
 
virtual ~G4IsotopeMagneticMomentTable ()
 
virtual G4bool FindIsotope (G4IsotopeProperty *property)
 
virtual G4IsotopePropertyGetIsotope (G4int Z, G4int A, G4double E, G4Ions::G4FloatLevelBase flb=G4Ions::G4FloatLevelBase::no_Float)
 
virtual G4IsotopePropertyGetIsotopeByIsoLvl (G4int Z, G4int A, G4int lvl=0)
 
- Public Member Functions inherited from G4VIsotopeTable
 G4VIsotopeTable ()
 
 G4VIsotopeTable (const G4String &)
 
 G4VIsotopeTable (const G4VIsotopeTable &)
 
G4VIsotopeTableoperator= (const G4VIsotopeTable &)
 
virtual ~G4VIsotopeTable ()
 
virtual G4IsotopePropertyGetIsotope (G4int Z, G4int A, G4double E, G4Ions::G4FloatLevelBase flb=G4Ions::G4FloatLevelBase::no_Float)=0
 
virtual G4IsotopePropertyGetIsotopeByIsoLvl (G4int Z, G4int A, G4int level=0)
 
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

Definition at line 53 of file G4IsotopeMagneticMomentTable.hh.

Member Typedef Documentation

◆ G4IsotopeList

◆ G4IsotopeNameList

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
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)

◆ 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}

Member Function Documentation

◆ 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) {
158 G4IsotopeProperty* fP = fIsotopeList[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

◆ 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) {
199 G4IsotopeProperty* fP = fIsotopeList[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}

◆ 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) {
237 G4IsotopeProperty* fP = fIsotopeList[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}

◆ operator=()

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

Definition at line 149 of file G4IsotopeMagneticMomentTable.cc.

150{
151 return *this;
152}

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