55 "-",
"+X",
"+Y",
"+Z",
"+U",
"+V",
"+W",
"+R",
"+S",
"+T",
"+A",
"+B",
"+C"};
65 vTrans.resize(fTransMax,0);
66 vRatio.resize(fTransMax,0.0f);
67 vGammaCumProbability.resize(fTransMax,0.0f);
68 vGammaProbability.resize(fTransMax,0.0f);
69 vShellProbability.resize(fTransMax,
nullptr);
71 vEnergy.resize(fLevelMax,0.0);
72 vSpin.resize(fLevelMax,0);
73 vLevel.resize(fLevelMax,
nullptr);
76G4bool G4LevelReader::ReadData(std::istringstream& stream,
G4double& x)
79 return !stream.fail();
82G4bool G4LevelReader::ReadDataItem(std::istream& dataFile,
G4double& x)
85 for(
G4int i=0; i<nbufmax; ++i) { buffer[i] =
' '; }
88 if(dataFile.fail()) { okay =
false; }
89 else { x = std::strtod(buffer, 0); }
94G4bool G4LevelReader::ReadDataItem(std::istream& dataFile,
G4float& x)
97 for(
G4int i=0; i<nbuf1; ++i) { buff1[i] =
' '; }
100 if(dataFile.fail()) { okay =
false; }
101 else { x = std::atof(buff1); }
106G4bool G4LevelReader::ReadDataItem(std::istream& dataFile,
G4int& ix)
109 for(
G4int i=0; i<nbuf2; ++i) { buff2[i] =
' '; }
112 if(dataFile.fail()) { okay =
false; }
113 else { ix = std::atoi(buff2); }
118const std::vector<G4float>* G4LevelReader::NormalizedICCProbability(
G4int Z)
120 std::vector<G4float>* vec =
nullptr;
144 if(LL < 3) {
for(
G4int i=LL+1; i<=4; ++i) { fICC[i] = 0.0f; } }
145 if(
M < 5) {
for(
G4int i=
M+4; i<=8; ++i) { fICC[i] = 0.0f; } }
146 if(
N < 1) { fICC[9] = 0.0f; }
149 for(
G4int i=0; i<10; ++i) {
153 if(norm == 0.0f && fAlpha > 0.0f) {
154 fICC[0] = norm = 1.0f;
158 vec =
new std::vector<G4float>;
160 for(
G4int i=0; i<10; ++i) {
162 if(x > 0.995f || 9 == i) {
163 vec->push_back(1.0f);
170 G4cout <<
"# InternalConv: ";
171 std::size_t
nn = vec->size();
172 for(std::size_t i=0; i<
nn; ++i) {
G4cout <<
" " << (*vec)[i]; }
183 std::ostringstream ss;
184 ss << fDirectory <<
"/z" << Z <<
".a" <<
A;
185 std::ifstream infile(ss.str(), std::ios::in);
188 if (!infile.is_open()) {
191 ed <<
"Regular file " << ss.str() <<
" is not opened! Z="
193 G4Exception(
"G4LevelReader::LevelManager(..)",
"had014",
200 G4cout <<
"G4LevelReader: open file " << ss.str() <<
" for Z= "
203 return LevelManager(Z,
A, infile);
209 std::ifstream infile(filename, std::ios::in);
212 if (!infile.is_open()) {
215 ed <<
"External file " << filename <<
" is not opened! Z="
217 G4Exception(
"G4LevelReader::LevelManager(..)",
"had014",
224 G4cout <<
"G4LevelReader: open external file " << filename
225 <<
" for Z= " << Z <<
" A= " <<
A <<
G4endl;
227 return LevelManager(Z,
A, infile);
231G4LevelReader::LevelManager(
G4int Z,
G4int A, std::ifstream& infile)
237 infile >> i1 >> fPol;
241 G4cout <<
"### End of file Z= " << Z <<
" A= " <<
A
242 <<
" Nlevels= " << i <<
G4endl;
249 ed <<
" G4LevelReader: wrong data file for Z= " << Z <<
" A= " <<
A
250 <<
" level #" << i <<
" has index " << i1;
251 G4Exception(
"G4LevelReader::LevelManager(..)",
"had014",
257 G4cout <<
"New line: i1= " << i1 <<
" fPol= <" << fPol <<
"> " <<
G4endl;
260 if(!(ReadDataItem(infile, fEnergy) &&
261 ReadDataItem(infile, fTime) &&
262 ReadDataItem(infile, fSpin) &&
263 ReadDataItem(infile, ntrans))) {
265 G4cout <<
"### Incomplete end of file Z= " << Z <<
" A= " <<
A
266 <<
" Nlevels= " << i <<
G4endl;
270 fEnergy *= CLHEP::keV;
271 for(k=0; k<nfloting; ++k) {
272 if(fPol == fFloatingLevels[k]) {
279 if(fEnergy < vEnergy[i-1]) {
280 G4cout <<
"### G4LevelReader: broken level " << i
281 <<
" E(MeV)= " << fEnergy <<
" < " << vEnergy[i-1]
282 <<
" for isotope Z= " << Z <<
" A= "
283 <<
A <<
" level energy increased" <<
G4endl;
284 fEnergy = vEnergy[i-1];
287 vEnergy[i] = fEnergy;
288 if (fTime > 0.0) { fTime *= fTimeFactor; }
289 else if (fTime < 0.0) { fTime =
DBL_MAX; }
292 twos = std::max(twos, -100);
293 vSpin[i] = 100 + twos + k*100000;
295 G4cout <<
" Level #" << i1 <<
" E(MeV)=" << fEnergy/CLHEP::MeV
296 <<
" LTime(s)=" << fTime <<
" 2S=" << vSpin[i]
297 <<
" meta=" << vSpin[i]/100000 <<
" idx=" << i
298 <<
" ntr=" << ntrans <<
G4endl;
304 vGammaCumProbability,
308 }
else if (ntrans > 0) {
311 if(ntrans > fTransMax) {
313 vTrans.resize(fTransMax);
314 vRatio.resize(fTransMax);
315 vGammaCumProbability.resize(fTransMax);
316 vGammaProbability.resize(fTransMax);
317 vShellProbability.resize(fTransMax);
320 for(
G4int j=0; j<ntrans; ++j) {
322 if(!(ReadDataItem(infile, i2) &&
323 ReadDataItem(infile, fTransEnergy) &&
324 ReadDataItem(infile, fProb) &&
325 ReadDataItem(infile, tnum) &&
326 ReadDataItem(infile, vRatio[j]) &&
327 ReadDataItem(infile, fAlpha))) {
329 G4cout <<
"### Fail to read transition j= " << j
330 <<
" Z= " << Z <<
" A= " <<
A <<
G4endl;
335 G4cout <<
"### G4LevelReader: broken transition " << j
336 <<
" from level " << i <<
" to " << i2
337 <<
" for isotope Z= " << Z <<
" A= "
338 <<
A <<
" - use ground level" <<
G4endl;
341 vTrans[j] = i2*10000 + tnum;
342 fAlpha = std::min(std::max(fAlpha,0.f), fAlphaMax);
345 vGammaCumProbability[j] = fNorm1;
346 vGammaProbability[j] = 1.0f/x;
347 vShellProbability[j] =
nullptr;
350 G4cout <<
"### Transition #" << j <<
" to level " << i2
351 <<
" i2= " << i2 <<
" Etrans(MeV)= " << fTransEnergy*CLHEP::keV
352 <<
" fProb= " << fProb <<
" MultiP= " << tnum
353 <<
" fMpRatio= " << fRatio <<
" fAlpha= " << fAlpha
358 for(k=0; k<10; ++k) {
360 if(!ReadDataItem(infile,fICC[k])) {
363 G4cout <<
"### Fail to read conversion coeff k= " << k
364 <<
" for transition j= " << j
365 <<
" Z= " << Z <<
" A= " <<
A <<
G4endl;
367 for(kk=k; kk<10; ++kk) { fICC[kk] = 0.f; }
372 vShellProbability[j] = NormalizedICCProbability(Z);
376 if(0.0f < fNorm1) { fNorm1 = 1.0f/fNorm1; }
377 G4int nt = ntrans - 1;
378 for(k=0; k<nt; ++k) {
379 vGammaCumProbability[k] *= fNorm1;
381 G4cout <<
"Probabilities[" << k
382 <<
"]= " << vGammaCumProbability[k]
383 <<
" " << vGammaProbability[k]
384 <<
" idxTrans= " << vTrans[k]/10000
388 vGammaCumProbability[nt] = 1.0f;
390 G4cout <<
"Probabilities[" << nt <<
"]= "
391 << vGammaCumProbability[nt]
392 <<
" " << vGammaProbability[nt]
393 <<
" IdxTrans= " << vTrans[nt]/10000
397 G4cout <<
" New G4NucLevel: Ntrans= " << ntrans
398 <<
" Time(ns)= " << fTime <<
G4endl;
400 vLevel[i] =
new G4NucLevel((std::size_t)ntrans, fTime,
402 vGammaCumProbability,
410 vEnergy.resize(fLevelMax, 0.0);
411 vSpin.resize(fLevelMax, 0);
412 vLevel.resize(fLevelMax,
nullptr);
417 lman =
new G4LevelManager(Z,
A, (std::size_t)i, vEnergy, vSpin, vLevel);
419 G4cout <<
"=== Reader: new manager for Z=" << Z <<
" A=" <<
A
420 <<
" Nlevels=" << i <<
" E[0]="
421 << vEnergy[0]/CLHEP::MeV <<
" MeV E1="
422 << vEnergy[i-1]/CLHEP::MeV <<
" MeV"
const char * G4FindDataDir(const char *)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
G4GLOB_DLL std::ostream G4cout
G4bool StoreICLevelData() const
const G4LevelManager * MakeLevelManager(G4int Z, G4int A, const G4String &filename)
const G4LevelManager * CreateLevelManager(G4int Z, G4int A)
G4LevelReader(G4NuclearLevelData *)
G4DeexPrecoParameters * GetParameters()
static G4Pow * GetInstance()
G4double logZ(G4int Z) const