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);
110G4bool 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) );
133G4LevelReader::ReadDataItem(std::istream& dataFile,
G4double& x)
135 G4bool okay = (dataFile >> buffer);
136 if (okay) x = strtod(buffer, NULL);
141void G4LevelReader::MakeNewLevel(std::vector<G4NucLevel*>* levels)
145 for(
size_t i=0; i<nLevels; ++i) { norm += wGamma[i]; }
148 if(norm <= 0.0) {
return; }
151 for(
size_t i=0; i<nLevels; ++i) { wGamma[i] *= norm; }
155 for(
size_t i=0; i<nLevels; ++i) {
156 wGamma[i] /= (1.0 + kICC[i]);
160 fHalfLifeTime *= norm*second;
165 }
else if(2 == nLevels) {
170 for(
size_t i=1; i<nLevels-1; ++i) {
171 wGamma[i] = wGamma[i]*norm + wGamma[i-1];
173 wGamma[nLevels-1] = 1.0;
177 levels->push_back(p);
G4DLLIMPORT std::ostream G4cout
void FillLevels(G4int Z, G4int A, std::vector< G4NucLevel * > *levels, const G4String &filename)