46 G4String G4LevelManager::fFloatingLevels[] = {
47 "-",
"+X",
"+Y",
"+Z",
"+U",
"+V",
"+W",
"+R",
"+S",
"+T",
"+A",
"+B",
"+C"};
50 const std::vector<G4float>& energies,
51 const std::vector<G4int>& spin,
52 const std::vector<const G4NucLevel*>& levels)
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]);
72 for(
size_t i=0; i<=nTransitions; ++i) {
delete fLevels[i]; }
80 size_t idx =
std::min(index, nTransitions);
82 static const G4float tolerance = 1.0f-6;
83 if(0 == nTransitions || std::fabs(energy - fLevelEnergy[idx]) <= tolerance) {
87 if(energy <= fLevelEnergy[1]*0.5f)
90 else if((fLevelEnergy[nTransitions] + fLevelEnergy[nTransitions-1])*0.5f <=
energy)
91 { idx = nTransitions; }
95 idx = std::lower_bound(fLevelEnergy.begin(), fLevelEnergy.end(),
energy)
96 - fLevelEnergy.begin() - 1;
97 if(energy - fLevelEnergy[idx] > fLevelEnergy[idx+1] - energy) { ++idx; }
107 if(i > nTransitions) { PrintError(i,
"Meta"); }
109 return fFloatingLevels[fSpin[i]/100000];
114 void G4LevelManager::PrintError(
size_t idx,
const G4String& ss)
const
118 ed <<
"Index of a level " << idx <<
" > "
119 << nTransitions <<
" (number of levels)";
std::ostringstream G4ExceptionDescription
size_t NearestLevelIndex(G4double energy, size_t index=0) const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
static const char sss[MAX_N_PAR+2]
G4double energy(const ThreeVector &p, const G4double m)
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
G4LevelManager(size_t ntrans, const std::vector< G4float > &energies, const std::vector< G4int > &spin, const std::vector< const G4NucLevel * > &levels)
const G4String & FloatingType(size_t i) const