47 : nLevels(0),nLevelMax(50),fVerbose(0),fMinProbability(1.e-10)
49 fLevelEnergy = fNewEnergy = fDeltaEnergy = fNewTime
50 = fHalfLifeTime = fProbability = fICC = fx = 0.0;
51 eGamma.resize(nLevelMax,0.0);
52 wGamma.resize(nLevelMax,0.0);
53 kICC.resize(nLevelMax,0.0);
54 for(
G4int i=0; i<30; ++i) { buffer[i] = 0; }
61 std::vector<G4NucLevel*>* levels,
64 std::ifstream inFile(filename);
65 if (!inFile.is_open()) {
67 G4cout <<
" G4LevelReader: nuclide ("
69 <<
") does not have a gamma levels file" <<
G4endl;
82 if(fNewEnergy != fLevelEnergy) {
83 if(0 < nLevels) { MakeNewLevel(levels); }
84 fLevelEnergy = fNewEnergy;
85 fHalfLifeTime = fNewTime;
90 eGamma[nLevels] = fDeltaEnergy*
keV;
91 wGamma[nLevels] =
std::max(fProbability*0.01,fMinProbability);
96 if(nLevels > nLevelMax) {
98 eGamma.resize(nLevelMax);
99 wGamma.resize(nLevelMax);
100 kICC.resize(nLevelMax);
105 MakeNewLevel(levels);
110 G4bool G4LevelReader::Read(std::ifstream& dataFile)
113 return (ReadDataItem(dataFile, fNewEnergy) &&
114 ReadDataItem(dataFile, fDeltaEnergy) &&
115 ReadDataItem(dataFile, fProbability) &&
116 ReadDataItem(dataFile, fx) &&
117 ReadDataItem(dataFile, fNewTime) &&
118 ReadDataItem(dataFile, fx) &&
119 ReadDataItem(dataFile, fICC) &&
120 ReadDataItem(dataFile, fx) &&
121 ReadDataItem(dataFile, fx) &&
122 ReadDataItem(dataFile, fx) &&
123 ReadDataItem(dataFile, fx) &&
124 ReadDataItem(dataFile, fx) &&
125 ReadDataItem(dataFile, fx) &&
126 ReadDataItem(dataFile, fx) &&
127 ReadDataItem(dataFile, fx) &&
128 ReadDataItem(dataFile, fx) &&
129 ReadDataItem(dataFile, fx) );
133 G4LevelReader::ReadDataItem(std::istream& dataFile,
G4double&
x)
139 if(dataFile.fail()) { okay =
false; }
140 else { x = strtod(buffer, NULL); }
145 void G4LevelReader::MakeNewLevel(std::vector<G4NucLevel*>* levels)
149 for(
size_t i=0; i<nLevels; ++i) { norm += wGamma[i]; }
152 if(norm <= 0.0) {
return; }
155 for(
size_t i=0; i<nLevels; ++i) { wGamma[i] *=
norm; }
159 for(
size_t i=0; i<nLevels; ++i) {
160 wGamma[i] /= (1.0 + kICC[i]);
164 fHalfLifeTime *= norm*
second;
169 }
else if(2 == nLevels) {
174 for(
size_t i=1; i<nLevels-1; ++i) {
175 wGamma[i] = wGamma[i]*norm + wGamma[i-1];
177 wGamma[nLevels-1] = 1.0;
181 levels->push_back(p);
G4GLOB_DLL std::ostream G4cout
T max(const T t1, const T t2)
brief Return the largest of the two arguments
void FillLevels(G4int Z, G4int A, std::vector< G4NucLevel * > *levels, const G4String &filename)