Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4LevelManager Class Reference

#include <G4LevelManager.hh>

Public Member Functions

 G4LevelManager (size_t ntrans, const std::vector< G4float > &energies, const std::vector< G4int > &spin, const std::vector< const G4NucLevel * > &levels)
 
 ~G4LevelManager ()
 
size_t NumberOfTransitions () const
 
const G4NucLevelGetLevel (size_t i) const
 
G4float LevelEnergy (size_t i) const
 
G4float MaxLevelEnergy () const
 
size_t NearestLevelIndex (G4double energy, size_t index=0) const
 
size_t NearestLowEdgeLevelIndex (G4double energy) const
 
const G4NucLevelNearestLevel (G4double energy, size_t index=0) const
 
G4float NearestLevelEnergy (G4double energy, size_t index=0) const
 
G4float NearestLowEdgeLevelEnergy (G4double energy) const
 
G4float LifeTime (size_t i) const
 
G4float LifeTimeGamma (size_t i) const
 
G4int SpinTwo (size_t i) const
 
G4int SpinParity (size_t i) const
 
G4int Parity (size_t i) const
 
G4int FloatingLevel (size_t i) const
 
const G4StringFloatingType (size_t i) const
 

Detailed Description

Definition at line 53 of file G4LevelManager.hh.

Constructor & Destructor Documentation

G4LevelManager::G4LevelManager ( size_t  ntrans,
const std::vector< G4float > &  energies,
const std::vector< G4int > &  spin,
const std::vector< const G4NucLevel * > &  levels 
)

Definition at line 49 of file G4LevelManager.cc.

53  : nTransitions(0)
54 {
55  if(0 < ntrans) {
56  nTransitions = ntrans - 1;
57  fLevelEnergy.reserve(ntrans);
58  fSpin.reserve(ntrans);
59  fLevels.reserve(ntrans);
60  for(size_t i=0; i<ntrans; ++i) {
61  fLevelEnergy.push_back(energies[i]);
62  fSpin.push_back(spin[i]);
63  fLevels.push_back(levels[i]);
64  }
65  //G4cout << "New G4LevelManager N= " << nTransitions << " "
66  //<< fLevelEnergy.size() << " <" << this << ">" << G4endl;
67  }
68 }
G4LevelManager::~G4LevelManager ( )

Definition at line 70 of file G4LevelManager.cc.

71 {
72  for(size_t i=0; i<=nTransitions; ++i) { delete fLevels[i]; }
73 }

Member Function Documentation

G4int G4LevelManager::FloatingLevel ( size_t  i) const
inline

Definition at line 223 of file G4LevelManager.hh.

224 {
225 #ifdef G4VERBOSE
226  if(i > nTransitions) { PrintError(i, "Floating"); }
227 #endif
228  return fSpin[i]/100000;
229 }
const G4String & G4LevelManager::FloatingType ( size_t  i) const

Definition at line 104 of file G4LevelManager.cc.

105 {
106 #ifdef G4VERBOSE
107  if(i > nTransitions) { PrintError(i, "Meta"); }
108 #endif
109  return fFloatingLevels[fSpin[i]/100000];
110  // return fFloatingLevels[fFloating[i]];
111 }
const G4NucLevel * G4LevelManager::GetLevel ( size_t  i) const
inline

Definition at line 132 of file G4LevelManager.hh.

133 {
134 #ifdef G4VERBOSE
135  if(i > nTransitions) { PrintError(i, "GetLevel"); }
136 #endif
137  return fLevels[i];
138 }

Here is the caller graph for this function:

G4float G4LevelManager::LevelEnergy ( size_t  i) const
inline

Definition at line 140 of file G4LevelManager.hh.

141 {
142 #ifdef G4VERBOSE
143  if(i > nTransitions) { PrintError(i, "LevelEnergy"); }
144 #endif
145  return fLevelEnergy[i];
146 }

Here is the caller graph for this function:

G4float G4LevelManager::LifeTime ( size_t  i) const
inline

Definition at line 183 of file G4LevelManager.hh.

184 {
185 #ifdef G4VERBOSE
186  if(i > nTransitions) { PrintError(i, "LifeTime"); }
187 #endif
188  return (fLevels[i]) ? fLevels[i]->GetTimeGamma() : 0.0f;
189 }

Here is the caller graph for this function:

G4float G4LevelManager::LifeTimeGamma ( size_t  i) const
inline

Definition at line 191 of file G4LevelManager.hh.

192 {
193 #ifdef G4VERBOSE
194  if(i > nTransitions) { PrintError(i, "LifeTimeGamma"); }
195 #endif
196  return (fLevels[i]) ? fLevels[i]->GetTimeGamma() : 0.0f;
197 }
G4float G4LevelManager::MaxLevelEnergy ( ) const
inline

Definition at line 148 of file G4LevelManager.hh.

149 {
150  return fLevelEnergy[nTransitions];
151 }

Here is the caller graph for this function:

const G4NucLevel * G4LevelManager::NearestLevel ( G4double  energy,
size_t  index = 0 
) const
inline

Definition at line 167 of file G4LevelManager.hh.

168 {
169  return GetLevel(NearestLevelIndex(energy, index));
170 }
const G4NucLevel * GetLevel(size_t i) const
size_t NearestLevelIndex(G4double energy, size_t index=0) const
G4double energy(const ThreeVector &p, const G4double m)

Here is the call graph for this function:

G4float G4LevelManager::NearestLevelEnergy ( G4double  energy,
size_t  index = 0 
) const
inline

Definition at line 173 of file G4LevelManager.hh.

174 {
175  return LevelEnergy(NearestLevelIndex(energy, index));
176 }
G4float LevelEnergy(size_t i) const
size_t NearestLevelIndex(G4double energy, size_t index=0) const
G4double energy(const ThreeVector &p, const G4double m)

Here is the call graph for this function:

Here is the caller graph for this function:

size_t G4LevelManager::NearestLevelIndex ( G4double  energy,
size_t  index = 0 
) const

Definition at line 76 of file G4LevelManager.cc.

77 {
78  //G4cout<< "index= " << index << " max= " << nTransitions << " exc= " << ener
79  // << " Emax= " << fLevelEnergy[nTransitions] << G4endl;
80  size_t idx = std::min(index, nTransitions);
81  G4float energy = (G4float)ener;
82  static const G4float tolerance = 1.0f-6;
83  if(0 == nTransitions || std::fabs(energy - fLevelEnergy[idx]) <= tolerance) {
84  return idx;
85  }
86  // ground state
87  if(energy <= fLevelEnergy[1]*0.5f)
88  { idx = 0; }
89  // take top level
90  else if((fLevelEnergy[nTransitions] + fLevelEnergy[nTransitions-1])*0.5f <= energy)
91  { idx = nTransitions; }
92 
93  // if shortcuts are not working, make binary search
94  else {
95  idx = std::lower_bound(fLevelEnergy.begin(), fLevelEnergy.end(), energy)
96  - fLevelEnergy.begin() - 1;
97  if(energy - fLevelEnergy[idx] > fLevelEnergy[idx+1] - energy) { ++idx; }
98  //G4cout << "E= " << energy << " " << fLevelEnergy[idx-1]
99  //<< " " << fLevelEnergy[idx] << G4endl;
100  }
101  return idx;
102 }
float G4float
Definition: G4Types.hh:77
G4double energy(const ThreeVector &p, const G4double m)
T min(const T t1, const T t2)
brief Return the smallest of the two arguments

Here is the call graph for this function:

Here is the caller graph for this function:

G4float G4LevelManager::NearestLowEdgeLevelEnergy ( G4double  energy) const
inline

Definition at line 178 of file G4LevelManager.hh.

179 {
181 }
size_t NearestLowEdgeLevelIndex(G4double energy) const
G4float LevelEnergy(size_t i) const
G4double energy(const ThreeVector &p, const G4double m)

Here is the call graph for this function:

Here is the caller graph for this function:

size_t G4LevelManager::NearestLowEdgeLevelIndex ( G4double  energy) const
inline

Definition at line 153 of file G4LevelManager.hh.

154 {
155  //G4cout<< "index= " << index << " max= " << nTransitions << " exc= " << ener
156  // << " Emax= " << fLevelEnergy[nTransitions] << G4endl;
157  size_t idx = nTransitions;
158  G4float energy = (G4float)ener;
159  if(energy < fLevelEnergy[nTransitions]) {
160  idx = std::lower_bound(fLevelEnergy.begin(), fLevelEnergy.end(), energy)
161  - fLevelEnergy.begin() - 1;
162  }
163  return idx;
164 }
float G4float
Definition: G4Types.hh:77
G4double energy(const ThreeVector &p, const G4double m)

Here is the call graph for this function:

Here is the caller graph for this function:

size_t G4LevelManager::NumberOfTransitions ( ) const
inline

Definition at line 127 of file G4LevelManager.hh.

128 {
129  return nTransitions;
130 }

Here is the caller graph for this function:

G4int G4LevelManager::Parity ( size_t  i) const
inline

Definition at line 215 of file G4LevelManager.hh.

216 {
217 #ifdef G4VERBOSE
218  if(i > nTransitions) { PrintError(i, "Parity"); }
219 #endif
220  return (fSpin[i]%100000 - 100)/2;
221 }
G4int G4LevelManager::SpinParity ( size_t  i) const
inline

Definition at line 207 of file G4LevelManager.hh.

208 {
209 #ifdef G4VERBOSE
210  if(i > nTransitions) { PrintError(i, "SpinTwo"); }
211 #endif
212  return fSpin[i]%100000 - 100;
213 }
G4int G4LevelManager::SpinTwo ( size_t  i) const
inline

Definition at line 199 of file G4LevelManager.hh.

200 {
201 #ifdef G4VERBOSE
202  if(i > nTransitions) { PrintError(i, "SpinTwo"); }
203 #endif
204  return std::abs(fSpin[i]%100000 - 100);
205 }

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