Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Protected Member Functions
G4IsomerTable Class Reference

#include <G4IsomerTable.hh>

Inheritance diagram for G4IsomerTable:
G4VIsotopeTable

Public Types

typedef std::vector
< G4IsotopeProperty * > 
G4IsotopeList
 

Public Member Functions

 G4IsomerTable ()
 
virtual ~G4IsomerTable ()
 
virtual G4IsotopePropertyGetIsotope (G4int Z, G4int A, G4double E)
 
virtual G4IsotopePropertyGetIsotopeByIsoLvl (G4int Z, G4int A, G4int lvl=0)
 
size_t entries () const
 
G4IsotopePropertyGetIsotopeByIndex (size_t idx) const
 
- 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

 G4IsomerTable (const G4IsomerTable &right)
 
G4IsomerTableoperator= (const G4IsomerTable &right)
 
void FillIsotopeList ()
 

Detailed Description

Definition at line 55 of file G4IsomerTable.hh.

Member Typedef Documentation

Definition at line 64 of file G4IsomerTable.hh.

Constructor & Destructor Documentation

G4IsomerTable::G4IsomerTable ( )

Definition at line 53 of file G4IsomerTable.cc.

References FillIsotopeList(), G4ParticleTable::GetParticleTable(), G4VIsotopeTable::GetVerboseLevel(), and G4VIsotopeTable::SetVerboseLevel().

54  :G4VIsotopeTable("Isomer"),
55  fIsotopeList(0)
56 {
59  return;
60 }
void FillIsotopeList()
static G4ParticleTable * GetParticleTable()
G4int GetVerboseLevel() const
void SetVerboseLevel(G4int level)
G4IsomerTable::G4IsomerTable ( const G4IsomerTable right)
protected

Definition at line 109 of file G4IsomerTable.cc.

References FillIsotopeList().

110  :G4VIsotopeTable(right),
111  fIsotopeList(0)
112 {
113  FillIsotopeList();
114 }
void FillIsotopeList()
G4IsomerTable::~G4IsomerTable ( )
virtual

Definition at line 96 of file G4IsomerTable.cc.

97 {
98  if (fIsotopeList!=0) {
99  for (size_t i = 0 ; i<fIsotopeList->size(); i++) {
100  delete (*fIsotopeList)[i];
101  }
102  fIsotopeList->clear();
103  delete fIsotopeList;
104  fIsotopeList = 0;
105  }
106 }

Member Function Documentation

size_t G4IsomerTable::entries ( ) const
inline

Definition at line 118 of file G4IsomerTable.hh.

Referenced by GetIsotope(), and GetIsotopeByIsoLvl().

119 {
120  return fIsotopeList->size();
121 }
void G4IsomerTable::FillIsotopeList ( )
protected

Definition at line 63 of file G4IsomerTable.cc.

References python.hepunit::joule, python.hepunit::keV, ns, and python.hepunit::tesla.

Referenced by G4IsomerTable(), and operator=().

64 {
65  if(fIsotopeList !=0) return;
66 
67  fIsotopeList = new G4IsotopeList();
68  fIsotopeList->reserve(nEntries);
69 
70  for (size_t i=0; i<nEntries; i++) {
71  G4int pid = (G4int)(isomerTable[i][idxPID]);
72  G4int ionZ = pid/10000;
73  G4int ionA = (pid-ionZ*10000)/10;
74  G4int lvl = pid%10;
75  G4double ionE = isomerTable[i][idxEnergy]*keV;
76  G4double ionLife = isomerTable[i][idxLife]*ns;
77  G4int ionJ = (G4int)(isomerTable[i][idxSpin]);
78  G4double ionMu = isomerTable[i][idxMu]*(joule/tesla);
79 
80  G4IsotopeProperty* fProperty = new G4IsotopeProperty();
81  // Set Isotope Property
82  fProperty->SetAtomicNumber(ionZ);
83  fProperty->SetAtomicMass(ionA);
84  fProperty->SetIsomerLevel(lvl);
85  fProperty->SetEnergy(ionE);
86  fProperty->SetiSpin(ionJ);
87  fProperty->SetLifeTime(ionLife);
88  fProperty->SetDecayTable(0);
89  fProperty->SetMagneticMoment(ionMu);
90 
91  fIsotopeList->push_back(fProperty);
92  }
93 }
int G4int
Definition: G4Types.hh:78
double G4double
Definition: G4Types.hh:76
#define ns
Definition: xmlparse.cc:597
std::vector< G4IsotopeProperty * > G4IsotopeList
G4IsotopeProperty * G4IsomerTable::GetIsotope ( G4int  Z,
G4int  A,
G4double  E 
)
virtual

Implements G4VIsotopeTable.

Definition at line 125 of file G4IsomerTable.cc.

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

126 {
127  G4IsotopeProperty* fProperty = 0;
128  if ((Z<MinZ)||(Z>MaxZ)||(A>MaxA)) return fProperty; // not found
129 
130  G4int low = 0;
131  G4int high = entries() -1;
132  G4int ptr = (low+high)/2;
133 
134  // find Z
135  G4int zptr = (*fIsotopeList)[ptr]->GetAtomicNumber();
136  while ( high-low > 1){
137  if (zptr == Z){
138  while ((zptr == Z)&&(ptr>0)) {
139  ptr -= 1;
140  zptr = (*fIsotopeList)[ptr]->GetAtomicNumber();
141  }
142  if (ptr!=0) ptr += 1;
143  break;
144  } else if (zptr >Z) {
145  high = ptr;
146  ptr = (low+high)/2;
147  } else {
148  low = ptr;
149  ptr = (low+high)/2;
150  }
151  zptr = (*fIsotopeList)[ptr]->GetAtomicNumber();
152  }
153  if ( Z == (*fIsotopeList)[low]->GetAtomicNumber()) ptr =low;
154  else if ( Z != zptr ) return fProperty; // not found
155 
156  // find A
157  G4int aptr = (*fIsotopeList)[ptr]->GetAtomicMass();
158  while ( (aptr<A) && (ptr+1<(G4int)(entries())) ) {
159  ptr +=1;
160  aptr = (*fIsotopeList)[ptr]->GetAtomicMass();
161  if (Z != (*fIsotopeList)[ptr]->GetAtomicNumber()) break;
162  }
163  if ( aptr != A) return fProperty; // not found
164 
165  // find E
166  G4double ptrE = (*fIsotopeList)[ptr]->GetEnergy();
167  while ( (ptrE < E-levelTolerance ) && (ptr+1<(G4int)(entries())) ){
168  ptr +=1;
169  ptrE = (*fIsotopeList)[ptr]->GetEnergy();
170  if (A != (*fIsotopeList)[ptr]->GetAtomicMass()) return fProperty; // not found
171  }
172  if (ptrE > E+levelTolerance) return fProperty; // not found
173 
174  // FOUND !!
175  fProperty = (*fIsotopeList)[ptr];
176 
177  return fProperty;
178 
179 }
size_t entries() const
int G4int
Definition: G4Types.hh:78
G4double GetEnergy() const
double G4double
Definition: G4Types.hh:76
G4int GetAtomicMass() const
G4IsotopeProperty * G4IsomerTable::GetIsotopeByIndex ( size_t  idx) const
inline

Definition at line 124 of file G4IsomerTable.hh.

125 {
126  if (idx<fIsotopeList->size()) return (*fIsotopeList)[idx];
127  else return 0;
128 }
G4IsotopeProperty * G4IsomerTable::GetIsotopeByIsoLvl ( G4int  Z,
G4int  A,
G4int  lvl = 0 
)
virtual

Reimplemented from G4VIsotopeTable.

Definition at line 183 of file G4IsomerTable.cc.

References entries().

184 {
185  G4IsotopeProperty* fProperty = 0;
186  if ((Z<MinZ)||(Z>MaxZ)||(A>MaxA)) return fProperty; // not found
187 
188  G4int low = 0;
189  G4int high = entries() -1;
190  G4int ptr = (low+high)/2;
191 
192 
193  // find PID
194  const G4int PID = 10000*Z +10*A + lvl;
195  G4int id = (fIsotopeList->at(ptr))->GetAtomicNumber() *10000
196  + (fIsotopeList->at(ptr))->GetAtomicMass() *10
197  + (fIsotopeList->at(ptr))->GetIsomerLevel();
198  while ( high-low > 1){
199  if (id == PID){
200  break;
201  } else if (id >PID) {
202  high = ptr;
203  ptr = (low+high)/2;
204  } else {
205  low = ptr;
206  ptr = (low+high)/2;
207  }
208  id = (fIsotopeList->at(ptr))->GetAtomicNumber() *10000
209  + (fIsotopeList->at(ptr))->GetAtomicMass() *10
210  + (fIsotopeList->at(ptr))->GetIsomerLevel();
211  }
212 
213  if (id == PID) {
214  fProperty = (*fIsotopeList)[ptr];
215  } else {
216  id = (fIsotopeList->at(low))->GetAtomicNumber() *10000
217  + (fIsotopeList->at(low))->GetAtomicMass() *10
218  + (fIsotopeList->at(low))->GetIsomerLevel();
219  if (id == PID) {
220  fProperty = (*fIsotopeList)[low];
221  } else {
222  id = (fIsotopeList->at(high))->GetAtomicNumber() *10000
223  + (fIsotopeList->at(high))->GetAtomicMass() *10
224  + (fIsotopeList->at(high))->GetIsomerLevel();
225  if (id == PID) fProperty = (*fIsotopeList)[high];
226  }
227  }
228  return fProperty;
229 
230 }
size_t entries() const
int G4int
Definition: G4Types.hh:78
G4IsomerTable & G4IsomerTable::operator= ( const G4IsomerTable right)
protected

Definition at line 117 of file G4IsomerTable.cc.

References FillIsotopeList().

118 {
119  FillIsotopeList();
120  return *this;
121 }
void FillIsotopeList()

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