Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Protected Member Functions
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

 G4IsotopeMagneticMomentTable ()
 
virtual ~G4IsotopeMagneticMomentTable ()
 
virtual G4bool FindIsotope (G4IsotopeProperty *property)
 
virtual G4IsotopePropertyGetIsotope (G4int Z, G4int A, G4double E)
 
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 ()
 
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

Definition at line 62 of file G4IsotopeMagneticMomentTable.hh.

Definition at line 63 of file G4IsotopeMagneticMomentTable.hh.

Constructor & Destructor Documentation

G4IsotopeMagneticMomentTable::G4IsotopeMagneticMomentTable ( )

Definition at line 56 of file G4IsotopeMagneticMomentTable.cc.

References G4cout, G4endl, G4Exception(), JustWarning, python.hepunit::MeV, G4IsotopeProperty::SetAtomicMass(), G4IsotopeProperty::SetAtomicNumber(), G4IsotopeProperty::SetEnergy(), G4IsotopeProperty::SetIsomerLevel(), G4IsotopeProperty::SetiSpin(), and G4IsotopeProperty::SetMagneticMoment().

57  :G4VIsotopeTable("MagneticMoment")
58 {
59  if ( !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",
67  JustWarning,
68  "Please setenv G4IONMAGNETICMOMENT");
69  }
70 #endif
71  G4Exception( "G4IsotopeMagneticMomentTable",
72  "File Not Found",
73  JustWarning,
74  "Please setenv G4IONMAGNETICMOMENT");
75  return;
76  }
77 
78  G4String file = 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",
90  JustWarning,
91  "Can not open G4IONMAGNETICMOMENT file");
92  return;
93  }
94 
95  char inputChars[80]={' '};
96 
97  while ( !DataFile.eof() ) {
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 }
void SetAtomicMass(G4int A)
int G4int
Definition: G4Types.hh:78
void SetiSpin(G4int J)
void SetMagneticMoment(G4double M)
G4GLOB_DLL std::ostream G4cout
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
void SetEnergy(G4double E)
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
void SetAtomicNumber(G4int Z)
void SetIsomerLevel(G4int level)
G4IsotopeMagneticMomentTable::G4IsotopeMagneticMomentTable ( const G4IsotopeMagneticMomentTable right)
protected

Definition at line 142 of file G4IsotopeMagneticMomentTable.cc.

143  :G4VIsotopeTable(right),
144  fIsotopeList(0)
145 {
146 }
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

G4bool G4IsotopeMagneticMomentTable::FindIsotope ( G4IsotopeProperty property)
virtual

Definition at line 155 of file G4IsotopeMagneticMomentTable.cc.

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

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 }
G4int GetAtomicNumber() const
G4int GetIsomerLevel() const
G4double GetEnergy() const
G4int GetAtomicMass() const
G4IsotopeProperty * G4IsotopeMagneticMomentTable::GetIsotope ( G4int  Z,
G4int  A,
G4double  E 
)
virtual

Implements G4VIsotopeTable.

Definition at line 194 of file G4IsotopeMagneticMomentTable.cc.

References G4IsotopeProperty::GetAtomicMass(), G4IsotopeProperty::GetAtomicNumber(), and G4IsotopeProperty::GetEnergy().

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

Reimplemented from G4VIsotopeTable.

Definition at line 232 of file G4IsotopeMagneticMomentTable.cc.

References G4IsotopeProperty::GetAtomicMass(), G4IsotopeProperty::GetAtomicNumber(), and G4IsotopeProperty::GetIsomerLevel().

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