64 _nucleusA(A), _nucleusZ(Z), _fileName(filename), _validity(false),
65 _levels(0), _levelEnergy(0), _gammaEnergy(0), _probability(0)
67 if (A <= 0 || Z <= 0 || Z > A ) {
69 "==== G4NuclearLevelManager ==== (Z,A) <0, or Z>A");
71 for(
G4int i=0; i<30; ++i) { buffer[i] = 0; }
82 if (A <= 0 || Z <= 0 || Z > A ) {
84 "==== G4NuclearLevelManager ==== (Z,A) <0, or Z>A");
86 if (_nucleusZ != Z || _nucleusA != A)
111 for (
unsigned int i=0; i<_levels->size(); i++)
114 G4double eDiff = std::abs(e - energy);
116 if (eDiff < diff && eDiff <= eDiffMax)
146 G4bool G4NuclearLevelManager::Read(std::ifstream& dataFile)
148 G4bool goodRead = ReadDataLine(dataFile);
150 if (goodRead) ProcessDataLine();
156 G4bool G4NuclearLevelManager::ReadDataLine(std::ifstream& dataFile) {
170 return (ReadDataItem(dataFile, _levelEnergy) &&
171 ReadDataItem(dataFile, _gammaEnergy) &&
172 ReadDataItem(dataFile, _probability) &&
173 ReadDataItem(dataFile, _polarity) &&
174 ReadDataItem(dataFile, _halfLife) &&
175 ReadDataItem(dataFile, _angularMomentum) &&
176 ReadDataItem(dataFile, _totalCC) &&
177 ReadDataItem(dataFile, _kCC) &&
178 ReadDataItem(dataFile, _l1CC) &&
179 ReadDataItem(dataFile, _l2CC) &&
180 ReadDataItem(dataFile, _l3CC) &&
181 ReadDataItem(dataFile, _m1CC) &&
182 ReadDataItem(dataFile, _m2CC) &&
183 ReadDataItem(dataFile, _m3CC) &&
184 ReadDataItem(dataFile, _m4CC) &&
185 ReadDataItem(dataFile, _m5CC) &&
186 ReadDataItem(dataFile, _nPlusCC) );
190 G4NuclearLevelManager::ReadDataItem(std::istream& dataFile,
G4double&
x)
196 if(dataFile.fail()) { okay =
false; }
197 else { x = strtod(buffer, NULL); }
202 void G4NuclearLevelManager::ProcessDataLine()
204 const G4double minProbability = 1e-8;
214 if (_probability < minProbability) _probability = minProbability;
236 _nPlusCC /= _nPlusCC;
253 void G4NuclearLevelManager::ClearLevels()
258 std::for_each(_levels->begin(), _levels->end(),
DeleteLevel());
266 void G4NuclearLevelManager::MakeLevels()
274 #ifdef GAMMAFILEWARNING
275 if (_nucleusZ > 10)
G4cout <<
" G4NuclearLevelManager: nuclide ("
276 << _nucleusZ <<
"," << _nucleusA
277 <<
") does not have a gamma levels file" <<
G4endl;
289 while (Read(inFile)) {
290 thisLevel = UseLevelOrMakeNew(thisLevel);
291 AddDataToLevel(thisLevel);
295 FinishLevel(thisLevel);
302 G4PtrSort<G4NuclearLevel>(_levels);
312 if (level && _levelEnergy == level->
Energy())
return level;
314 if (level) FinishLevel(level);
317 return new G4NuclearLevel(_levelEnergy, _halfLife, _angularMomentum);
324 level->_energies.push_back(_gammaEnergy);
325 level->_weights.push_back(_probability);
326 level->_polarities.push_back(_polarity);
327 level->_kCC.push_back(_kCC);
328 level->_l1CC.push_back(_l1CC);
329 level->_l2CC.push_back(_l2CC);
330 level->_l3CC.push_back(_l3CC);
331 level->_m1CC.push_back(_m1CC);
332 level->_m2CC.push_back(_m2CC);
333 level->_m3CC.push_back(_m3CC);
334 level->_m4CC.push_back(_m4CC);
335 level->_m5CC.push_back(_m5CC);
336 level->_nPlusCC.push_back(_nPlusCC);
337 level->_totalCC.push_back(_totalCC);
342 if (!level || !_levels)
return;
345 _levels->push_back(level);
353 G4cout <<
" ==== G4NuclearLevelManager ==== (" << _nucleusZ <<
", " << _nucleusA
354 <<
") has " << nLevels <<
" levels" <<
G4endl
359 for (
G4int i=0; i<nLevels; i++)
365 _levelEnergy = right._levelEnergy;
366 _gammaEnergy = right._gammaEnergy;
367 _probability = right._probability;
368 _polarity = right._polarity;
369 _halfLife = right._halfLife;
370 _angularMomentum = right._angularMomentum;
380 _nPlusCC = right._nPlusCC;
381 _totalCC = right._totalCC;
382 _nucleusA = right._nucleusA;
383 _nucleusZ = right._nucleusZ;
384 _fileName = right._fileName;
385 _validity = right._validity;
387 if (right._levels != 0)
390 G4int n = right._levels->size();
397 G4PtrSort<G4NuclearLevel>(_levels);
G4NuclearLevelManager(G4int Z, G4int A, const G4String &filename)
const G4NuclearLevel * HighestLevel() const
G4double MinLevelEnergy() const
std::vector< G4NuclearLevel * > G4PtrLevelVector
G4GLOB_DLL std::ostream G4cout
void SetNucleus(G4int Z, G4int A, const G4String &filename)
const G4NuclearLevel * LowestLevel() const
const G4NuclearLevel * GetLevel(G4int i) const
G4int NumberOfLevels() const
const G4NuclearLevel * NearestLevel(G4double energy, G4double eDiffMax=9999.*CLHEP::GeV) const
G4double MaxLevelEnergy() const