68 _nucleusA(A), _nucleusZ(Z), _fileName(filename), _validity(false),
69 _levels(0), _levelEnergy(0), _gammaEnergy(0), _probability(0)
71 if (A <= 0 || Z <= 0 || Z > A )
72 throw G4HadronicException(__FILE__, __LINE__,
"==== G4NuclearLevelManager ==== (Z,A) <0, or Z>A");
84 if (A <= 0 || Z <= 0 || Z > A )
85 throw G4HadronicException(__FILE__, __LINE__,
"==== G4NuclearLevelManager ==== (Z,A) <0, or Z>A");
87 if (_nucleusZ != Z || _nucleusA != A)
113 for (
unsigned int i=0; i<_levels->size(); i++)
116 G4double eDiff = std::abs(e - energy);
118 if (eDiff < diff && eDiff <= eDiffMax)
153 G4bool G4NuclearLevelManager::Read(std::ifstream& dataFile)
155 G4bool goodRead = ReadDataLine(dataFile);
157 if (goodRead) ProcessDataLine();
163 G4bool G4NuclearLevelManager::ReadDataLine(std::ifstream& dataFile) {
177 return (ReadDataItem(dataFile, _levelEnergy) &&
178 ReadDataItem(dataFile, _gammaEnergy) &&
179 ReadDataItem(dataFile, _probability) &&
180 ReadDataItem(dataFile, _polarity) &&
181 ReadDataItem(dataFile, _halfLife) &&
182 ReadDataItem(dataFile, _angularMomentum) &&
183 ReadDataItem(dataFile, _totalCC) &&
184 ReadDataItem(dataFile, _kCC) &&
185 ReadDataItem(dataFile, _l1CC) &&
186 ReadDataItem(dataFile, _l2CC) &&
187 ReadDataItem(dataFile, _l3CC) &&
188 ReadDataItem(dataFile, _m1CC) &&
189 ReadDataItem(dataFile, _m2CC) &&
190 ReadDataItem(dataFile, _m3CC) &&
191 ReadDataItem(dataFile, _m4CC) &&
192 ReadDataItem(dataFile, _m5CC) &&
193 ReadDataItem(dataFile, _nPlusCC) );
197 G4NuclearLevelManager::ReadDataItem(std::istream& dataFile,
G4double&
x)
199 G4bool okay = (dataFile >> buffer);
200 if (okay) x = strtod(buffer, NULL);
205 void G4NuclearLevelManager::ProcessDataLine()
217 if (_probability < minProbability) _probability = minProbability;
239 _nPlusCC /= _nPlusCC;
257 void G4NuclearLevelManager::ClearLevels()
262 std::for_each(_levels->begin(), _levels->end(),
DeleteLevel());
270 void G4NuclearLevelManager::MakeLevels()
278 #ifdef GAMMAFILEWARNING
279 if (_nucleusZ > 10)
G4cout <<
" G4NuclearLevelManager: nuclide ("
280 << _nucleusZ <<
"," << _nucleusA
281 <<
") does not have a gamma levels file" <<
G4endl;
293 while (Read(inFile)) {
294 thisLevel = UseLevelOrMakeNew(thisLevel);
295 AddDataToLevel(thisLevel);
299 FinishLevel(thisLevel);
306 G4PtrSort<G4NuclearLevel>(_levels);
316 if (level && _levelEnergy == level->
Energy())
return level;
318 if (level) FinishLevel(level);
321 return new G4NuclearLevel(_levelEnergy, _halfLife, _angularMomentum);
328 level->_energies.push_back(_gammaEnergy);
329 level->_weights.push_back(_probability);
330 level->_polarities.push_back(_polarity);
331 level->_kCC.push_back(_kCC);
332 level->_l1CC.push_back(_l1CC);
333 level->_l2CC.push_back(_l2CC);
334 level->_l3CC.push_back(_l3CC);
335 level->_m1CC.push_back(_m1CC);
336 level->_m2CC.push_back(_m2CC);
337 level->_m3CC.push_back(_m3CC);
338 level->_m4CC.push_back(_m4CC);
339 level->_m5CC.push_back(_m5CC);
340 level->_nPlusCC.push_back(_nPlusCC);
341 level->_totalCC.push_back(_totalCC);
346 if (!level || !_levels)
return;
349 _levels->push_back(level);
357 G4cout <<
" ==== G4NuclearLevelManager ==== (" << _nucleusZ <<
", " << _nucleusA
358 <<
") has " << nLevels <<
" levels" <<
G4endl
363 for (
G4int i=0; i<nLevels; i++)
369 _levelEnergy = right._levelEnergy;
370 _gammaEnergy = right._gammaEnergy;
371 _probability = right._probability;
372 _polarity = right._polarity;
373 _halfLife = right._halfLife;
374 _angularMomentum = right._angularMomentum;
384 _nPlusCC = right._nPlusCC;
385 _totalCC = right._totalCC;
386 _nucleusA = right._nucleusA;
387 _nucleusZ = right._nucleusZ;
388 _fileName = right._fileName;
389 _validity = right._validity;
391 if (right._levels != 0)
394 G4int n = right._levels->size();
401 G4PtrSort<G4NuclearLevel>(_levels);
407 for (
G4int i=0; i<30; ++i) {
408 buffer[i] = right.buffer[i];