52G4String G4LevelReader::fFloatingLevels[] = {
53 "-",
"+X",
"+Y",
"+Z",
"+U",
"+V",
"+W",
"+R",
"+S",
"+T",
"+A",
"+B",
"+C"};
56 : fData(ptr),fVerbose(1),fLevelMax(632),fTransMax(145)
63 fDirectory = directory;
66 "Environment variable G4LEVELGAMMADATA is not defined");
70 for(
G4int i=0; i<10; ++i) { fICC[i] = 0.0f; }
71 for(
G4int i=0; i<nbufmax; ++i) { buffer[i] =
' '; }
72 for(
G4int i=0; i<nbuf1; ++i) { buff1[i] =
' '; }
73 for(
G4int i=0; i<nbuf2; ++i) { buff2[i] =
' '; }
74 bufp[0] = bufp[1] = bufp[2] =
' ';
76 fEnergy = fCurrEnergy = fTrEnergy = fTime = 0.0;
77 fProb = fSpin = fAlpha = fRatio = fNorm1 = 0.0f;
79 ntrans = i1 = i2 = k = kk = tnum = 0;
82 vTrans.resize(fTransMax,0);
83 vRatio.resize(fTransMax,0.0f);
84 vGammaCumProbability.resize(fTransMax,0.0f);
85 vGammaProbability.resize(fTransMax,0.0f);
86 vShellProbability.resize(fTransMax,
nullptr);
88 vEnergy.resize(fLevelMax,0.0);
89 vSpin.resize(fLevelMax,0);
90 vLevel.resize(fLevelMax,
nullptr);
93G4bool G4LevelReader::ReadData(std::istringstream& stream,
G4double& x)
96 return stream.fail() ? false :
true;
99G4bool G4LevelReader::ReadDataItem(std::istream& dataFile,
G4double& x)
102 for(
G4int i=0; i<nbufmax; ++i) { buffer[i] =
' '; }
105 if(dataFile.fail()) { okay =
false; }
106 else { x = strtod(buffer, 0); }
111G4bool G4LevelReader::ReadDataItem(std::istream& dataFile,
G4float& x)
114 for(
G4int i=0; i<nbuf1; ++i) { buff1[i] =
' '; }
117 if(dataFile.fail()) { okay =
false; }
118 else { x = atof(buff1); }
123G4bool G4LevelReader::ReadDataItem(std::istream& dataFile,
G4int& ix)
126 for(
G4int i=0; i<nbuf2; ++i) { buff2[i] =
' '; }
129 if(dataFile.fail()) { okay =
false; }
130 else { ix = atoi(buff2); }
135G4bool G4LevelReader::ReadDataItem(std::istream& dataFile,
G4String& x)
138 bufp[0] = bufp[1] =
' ';
140 if(dataFile.fail()) { okay =
false; }
146const std::vector<G4float>* G4LevelReader::NormalizedICCProbability(
G4int Z)
148 std::vector<G4float>* vec =
nullptr;
172 if(LL < 3) {
for(
G4int i=LL+1; i<=4; ++i) { fICC[i] = 0.0f; } }
173 if(
M < 5) {
for(
G4int i=
M+4; i<=8; ++i) { fICC[i] = 0.0f; } }
174 if(
N < 1) { fICC[9] = 0.0f; }
177 for(
G4int i=0; i<10; ++i) {
181 if(norm == 0.0f && fAlpha > 0.0f) {
182 fICC[0] = norm = 1.0f;
186 vec =
new std::vector<G4float>;
188 for(
G4int i=0; i<10; ++i) {
190 if(x > 0.995f || 9 == i) {
191 vec->push_back(1.0f);
198 G4cout <<
"# InternalConv: ";
199 std::size_t
nn = vec->size();
200 for(std::size_t i=0; i<
nn; ++i) {
G4cout <<
" " << (*vec)[i]; }
211 std::ostringstream ss;
212 ss << fDirectory <<
"/z" <<
Z <<
".a" <<
A;
213 std::ifstream infile(ss.str(), std::ios::in);
215 return LevelManager(
Z,
A, 0, infile);
221 std::ifstream infile(filename, std::ios::in);
222 if (!infile.is_open()) {
224 ed <<
"User file for Z= " <<
Z <<
" A= " <<
A
225 <<
" is not opened!";
226 G4Exception(
"G4LevelReader::MakeLevelManager(..)",
"had014",
230 return LevelManager(
Z,
A, 0, infile);
235 std::ifstream& infile)
238 if (!infile.is_open()) {
241 ed <<
" for Z= " <<
Z <<
" A= " <<
A
242 <<
" is not opened!";
243 G4Exception(
"G4LevelReader::LevelManager(..)",
"had014",
249 G4cout <<
"G4LevelReader: open file for Z= "
255 G4int nlevels = (0 == nlev) ? fLevelMax : nlev;
257 G4cout <<
"## New isotope Z= " <<
Z <<
" A= " <<
A;
258 if(nlevels < fLevelMax) {
G4cout <<
" Nlevels= " << nlevels; }
261 if(nlevels > fLevelMax) {
263 vEnergy.resize(fLevelMax,0.0);
264 vSpin.resize(fLevelMax,0);
265 vLevel.resize(fLevelMax,
nullptr);
273 for(i=0; i<nlevels; ++i) {
274 infile >> i1 >> fPol;
278 G4cout <<
"### End of file Z= " <<
Z <<
" A= " <<
A
279 <<
" Nlevels= " << i <<
G4endl;
285 ed <<
" G4LevelReader: wrong data file for Z= " <<
Z <<
" A= " <<
A
286 <<
" level #" << i <<
" has index " << i1 <<
G4endl;
287 G4Exception(
"G4LevelReader::LevelManager(..)",
"had014",
292 if(!(ReadDataItem(infile,ener) &&
293 ReadDataItem(infile,fTime) &&
294 ReadDataItem(infile,fSpin) &&
295 ReadDataItem(infile,ntrans))) {
297 G4cout <<
"### End of file Z= " <<
Z <<
" A= " <<
A
298 <<
" Nlevels= " << i <<
G4endl;
303 for(k=0; k<nfloting; ++k) {
304 if(fPol == fFloatingLevels[k]) {
311 if(ener < vEnergy[i-1]) {
312 G4cout <<
"### G4LevelReader: broken level " << i
313 <<
" E(MeV)= " << ener <<
" < " << vEnergy[i-1]
314 <<
" for isotope Z= " <<
Z <<
" A= "
315 <<
A <<
" level energy increased" <<
G4endl;
320 if(fTime > 0.0f) { fTime *= fTimeFactor; }
321 if(fSpin > 48.0f) { fSpin = 0.0f; }
323 vSpin[i] = 100 + twos + k*100000;
325 G4cout <<
" Level #" << i1 <<
" E(MeV)= " << ener/CLHEP::MeV
326 <<
" LTime(s)= " << fTime <<
" 2S= " << vSpin[i]
327 <<
" meta= " << vSpin[i]/100000 <<
" idx= " << i
328 <<
" ntr= " << ntrans <<
G4endl;
331 if(ntrans == 0 && fTime < 0.0) {
334 vGammaCumProbability,
338 }
else if(ntrans > 0) {
341 if(ntrans > fTransMax) {
343 vTrans.resize(fTransMax);
344 vRatio.resize(fTransMax);
345 vGammaCumProbability.resize(fTransMax);
346 vGammaProbability.resize(fTransMax);
347 vShellProbability.resize(fTransMax);
350 for(
G4int j=0; j<ntrans; ++j) {
352 if(!(ReadDataItem(infile,i2) &&
353 ReadDataItem(infile,tener) &&
354 ReadDataItem(infile,fProb) &&
355 ReadDataItem(infile,tnum) &&
356 ReadDataItem(infile,vRatio[j]) &&
357 ReadDataItem(infile,fAlpha))) {
361 G4cout <<
"### Fail to read transition j= " << j
362 <<
" Z= " <<
Z <<
" A= " <<
A <<
G4endl;
367 G4cout <<
"### G4LevelReader: broken transition " << j
368 <<
" from level " << i <<
" to " << i2
369 <<
" for isotope Z= " <<
Z <<
" A= "
370 <<
A <<
" - use ground level" <<
G4endl;
373 vTrans[j] = i2*10000 + tnum;
374 fAlpha = std::min(std::max(fAlpha,0.f), fAlphaMax);
377 vGammaCumProbability[j] = fNorm1;
378 vGammaProbability[j] = 1.0f/x;
379 vShellProbability[j] =
nullptr;
382 G4cout <<
"### Transition #" << j <<
" to level " << i2
383 <<
" i2= " << i2 <<
" Etrans(MeV)= " << tener*CLHEP::keV
384 <<
" fProb= " << fProb <<
" MultiP= " << tnum
385 <<
" fMpRatio= " << fRatio <<
" fAlpha= " << fAlpha
390 for(k=0; k<10; ++k) {
392 if(!ReadDataItem(infile,fICC[k])) {
395 G4cout <<
"### Fail to read conversion coeff k= " << k
396 <<
" for transition j= " << j
397 <<
" Z= " <<
Z <<
" A= " <<
A <<
G4endl;
399 for(kk=k; kk<10; ++kk) { fICC[kk] = 0.f; }
404 vShellProbability[j] = NormalizedICCProbability(
Z);
405 if(!vShellProbability[j]) { vGammaProbability[j] = 1.0f; }
409 if(0.0f < fNorm1) { fNorm1 = 1.0f/fNorm1; }
410 G4int nt = ntrans - 1;
411 for(k=0; k<nt; ++k) {
412 vGammaCumProbability[k] *= fNorm1;
414 G4cout <<
"Probabilities[" << k
415 <<
"]= " << vGammaCumProbability[k]
416 <<
" " << vGammaProbability[k]
417 <<
" idxTrans= " << vTrans[k]/10000
421 vGammaCumProbability[nt] = 1.0f;
423 G4cout <<
"Probabilities[" << nt <<
"]= "
424 << vGammaCumProbability[nt]
425 <<
" " << vGammaProbability[nt]
426 <<
" IdxTrans= " << vTrans[nt]/10000
430 G4cout <<
" New G4NucLevel: Ntrans= " << ntrans
431 <<
" Time(ns)= " << fTime <<
G4endl;
433 vLevel[i] =
new G4NucLevel((std::size_t)ntrans, fTime,
435 vGammaCumProbability,
445 G4cout <<
"=== Reader: new manager for Z= " <<
Z <<
" A= " <<
A
446 <<
" Nlevels= " << i <<
" E[0]= "
447 << vEnergy[0]/CLHEP::MeV <<
" MeV E1= "
448 << 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