Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // 26 // 27 // ------------------------------------------- 27 // ------------------------------------------------------------------- 28 // 28 // 29 // GEANT4 header file 29 // GEANT4 header file 30 // 30 // 31 // File name: G4NucLevel 31 // File name: G4NucLevel 32 // 32 // 33 // Author: V.Ivanchenko (M.Kelsey 33 // Author: V.Ivanchenko (M.Kelsey reading method is used) 34 // 34 // 35 // Creation date: 4 January 2012 35 // Creation date: 4 January 2012 36 // 36 // 37 // Modifications: 37 // Modifications: 38 // 38 // 39 // ------------------------------------------- 39 // ------------------------------------------------------------------- 40 40 41 #include "G4LevelReader.hh" 41 #include "G4LevelReader.hh" 42 #include "G4NucleiProperties.hh" 42 #include "G4NucleiProperties.hh" 43 #include "G4NucLevel.hh" 43 #include "G4NucLevel.hh" 44 #include "G4NuclearLevelData.hh" 44 #include "G4NuclearLevelData.hh" 45 #include "G4DeexPrecoParameters.hh" 45 #include "G4DeexPrecoParameters.hh" 46 #include "G4SystemOfUnits.hh" 46 #include "G4SystemOfUnits.hh" 47 #include "G4Pow.hh" 47 #include "G4Pow.hh" 48 #include <fstream> 48 #include <fstream> 49 #include <sstream> 49 #include <sstream> 50 50 51 namespace 51 namespace 52 { 52 { 53 const G4int countmax = 4; << 53 G4int nfloting = 13; 54 const G4int nfloting = 13; << 54 G4String fFloatingLevels[13] = { 55 const G4double eTolarence = 2*CLHEP::eV; << 56 const G4String fFloatingLevels[13] = { << 57 "-", "+X", "+Y", "+Z", "+U", "+V", "+W", "+R 55 "-", "+X", "+Y", "+Z", "+U", "+V", "+W", "+R", "+S", "+T", "+A", "+B", "+C"}; 58 } 56 } 59 57 60 G4LevelReader::G4LevelReader(G4NuclearLevelDat 58 G4LevelReader::G4LevelReader(G4NuclearLevelData* ptr) 61 : fData(ptr) 59 : fData(ptr) 62 { 60 { 63 fAlphaMax = (G4float)1.e15; 61 fAlphaMax = (G4float)1.e15; 64 fTimeFactor = CLHEP::second/G4Pow::GetInstan 62 fTimeFactor = CLHEP::second/G4Pow::GetInstance()->logZ(2); 65 fDirectory = G4String(G4FindDataDir("G4LEVEL 63 fDirectory = G4String(G4FindDataDir("G4LEVELGAMMADATA")); 66 64 67 vTrans.resize(fTransMax,0); 65 vTrans.resize(fTransMax,0); 68 vRatio.resize(fTransMax,0.0f); 66 vRatio.resize(fTransMax,0.0f); 69 vGammaCumProbability.resize(fTransMax,0.0f); 67 vGammaCumProbability.resize(fTransMax,0.0f); 70 vGammaProbability.resize(fTransMax,0.0f); 68 vGammaProbability.resize(fTransMax,0.0f); 71 vShellProbability.resize(fTransMax,nullptr); 69 vShellProbability.resize(fTransMax,nullptr); 72 70 73 vEnergy.resize(fLevelMax,0.0); 71 vEnergy.resize(fLevelMax,0.0); 74 vSpin.resize(fLevelMax,0); 72 vSpin.resize(fLevelMax,0); 75 vLevel.resize(fLevelMax,nullptr); 73 vLevel.resize(fLevelMax,nullptr); 76 } 74 } 77 75 78 G4bool G4LevelReader::ReadData(std::istringstr 76 G4bool G4LevelReader::ReadData(std::istringstream& stream, G4double& x) 79 { 77 { 80 stream >> x; 78 stream >> x; 81 return !stream.fail(); 79 return !stream.fail(); 82 } 80 } 83 81 84 G4bool G4LevelReader::ReadDataItem(std::istrea 82 G4bool G4LevelReader::ReadDataItem(std::istream& dataFile, G4double& x) 85 { 83 { 86 x = 0.0; 84 x = 0.0; 87 for(G4int i=0; i<nbufmax; ++i) { buffer[i] = 85 for(G4int i=0; i<nbufmax; ++i) { buffer[i] = ' '; } 88 G4bool okay = true; 86 G4bool okay = true; 89 dataFile >> buffer; 87 dataFile >> buffer; 90 if(dataFile.fail()) { okay = false; } 88 if(dataFile.fail()) { okay = false; } 91 else { x = std::strtod(buffer, 0); } 89 else { x = std::strtod(buffer, 0); } >> 90 92 return okay; 91 return okay; 93 } 92 } 94 93 95 G4bool G4LevelReader::ReadDataItem(std::istrea 94 G4bool G4LevelReader::ReadDataItem(std::istream& dataFile, G4float& x) 96 { 95 { 97 x = 0.0f; 96 x = 0.0f; 98 for(G4int i=0; i<nbuf1; ++i) { buff1[i] = ' 97 for(G4int i=0; i<nbuf1; ++i) { buff1[i] = ' '; } 99 G4bool okay = true; 98 G4bool okay = true; 100 dataFile >> buff1; 99 dataFile >> buff1; 101 if(dataFile.fail()) { okay = false; } 100 if(dataFile.fail()) { okay = false; } 102 else { x = std::atof(buff1); } 101 else { x = std::atof(buff1); } 103 102 104 return okay; 103 return okay; 105 } 104 } 106 105 107 G4bool G4LevelReader::ReadDataItem(std::istrea 106 G4bool G4LevelReader::ReadDataItem(std::istream& dataFile, G4int& ix) 108 { 107 { 109 ix = 0; 108 ix = 0; 110 for(G4int i=0; i<nbuf2; ++i) { buff2[i] = ' 109 for(G4int i=0; i<nbuf2; ++i) { buff2[i] = ' '; } 111 G4bool okay = true; 110 G4bool okay = true; 112 dataFile >> buff2; 111 dataFile >> buff2; 113 if(dataFile.fail()) { okay = false; } 112 if(dataFile.fail()) { okay = false; } 114 else { ix = std::atoi(buff2); } 113 else { ix = std::atoi(buff2); } 115 114 116 return okay; 115 return okay; 117 } 116 } 118 117 119 const std::vector<G4float>* G4LevelReader::Nor 118 const std::vector<G4float>* G4LevelReader::NormalizedICCProbability(G4int Z) 120 { 119 { 121 std::vector<G4float>* vec = nullptr; 120 std::vector<G4float>* vec = nullptr; 122 G4int LL = 3; 121 G4int LL = 3; 123 G4int M = 5; 122 G4int M = 5; 124 G4int N = 1; 123 G4int N = 1; 125 if(Z <= 27) { 124 if(Z <= 27) { 126 M = N = 0; 125 M = N = 0; 127 if(Z <= 4) { 126 if(Z <= 4) { 128 LL = 1; 127 LL = 1; 129 } else if(Z <= 6) { 128 } else if(Z <= 6) { 130 LL = 2; 129 LL = 2; 131 } else if(Z <= 10) { 130 } else if(Z <= 10) { 132 } else if(Z <= 12) { 131 } else if(Z <= 12) { 133 M = 1; 132 M = 1; 134 } else if(Z <= 17) { 133 } else if(Z <= 17) { 135 M = 2; 134 M = 2; 136 } else if(Z == 18) { 135 } else if(Z == 18) { 137 M = 3; 136 M = 3; 138 } else if(Z <= 20) { 137 } else if(Z <= 20) { 139 M = 3; 138 M = 3; 140 N = 1; 139 N = 1; 141 } else { 140 } else { 142 M = 4; 141 M = 4; 143 N = 1; 142 N = 1; 144 } 143 } 145 if(LL < 3) { for(G4int i=LL+1; i<=4; ++i) 144 if(LL < 3) { for(G4int i=LL+1; i<=4; ++i) { fICC[i] = 0.0f; } } 146 if(M < 5) { for(G4int i=M+4; i<=8; ++i) 145 if(M < 5) { for(G4int i=M+4; i<=8; ++i) { fICC[i] = 0.0f; } } 147 if(N < 1) { fICC[9] = 0.0f; } 146 if(N < 1) { fICC[9] = 0.0f; } 148 } 147 } 149 G4float norm = 0.0f; 148 G4float norm = 0.0f; 150 for(G4int i=0; i<10; ++i) { 149 for(G4int i=0; i<10; ++i) { 151 norm += fICC[i]; 150 norm += fICC[i]; 152 fICC[i] = norm; 151 fICC[i] = norm; 153 } 152 } 154 if(norm == 0.0f && fAlpha > 0.0f) { 153 if(norm == 0.0f && fAlpha > 0.0f) { 155 fICC[0] = norm = 1.0f; 154 fICC[0] = norm = 1.0f; 156 } 155 } 157 if(norm > 0.0f) { 156 if(norm > 0.0f) { 158 norm = 1.0f/norm; 157 norm = 1.0f/norm; 159 vec = new std::vector<G4float>; 158 vec = new std::vector<G4float>; 160 G4float x; 159 G4float x; 161 for(G4int i=0; i<10; ++i) { 160 for(G4int i=0; i<10; ++i) { 162 x = fICC[i]*norm; 161 x = fICC[i]*norm; 163 if(x > 0.995f || 9 == i) { 162 if(x > 0.995f || 9 == i) { 164 vec->push_back(1.0f); 163 vec->push_back(1.0f); 165 break; 164 break; 166 } 165 } 167 vec->push_back(x); 166 vec->push_back(x); 168 } 167 } 169 if (fVerbose > 3) { 168 if (fVerbose > 3) { 170 G4long prec = G4cout.precision(3); 169 G4long prec = G4cout.precision(3); 171 G4cout << "# InternalConv: "; 170 G4cout << "# InternalConv: "; 172 std::size_t nn = vec->size(); 171 std::size_t nn = vec->size(); 173 for(std::size_t i=0; i<nn; ++i) { G4cout 172 for(std::size_t i=0; i<nn; ++i) { G4cout << " " << (*vec)[i]; } 174 G4cout << G4endl; 173 G4cout << G4endl; 175 G4cout.precision(prec); 174 G4cout.precision(prec); 176 } 175 } 177 } 176 } 178 return vec; 177 return vec; 179 } 178 } 180 179 181 const G4LevelManager* 180 const G4LevelManager* 182 G4LevelReader::CreateLevelManager(G4int Z, G4i 181 G4LevelReader::CreateLevelManager(G4int Z, G4int A) 183 { 182 { 184 std::ostringstream ss; 183 std::ostringstream ss; 185 ss << fDirectory << "/z" << Z << ".a" << A; 184 ss << fDirectory << "/z" << Z << ".a" << A; 186 std::ifstream infile(ss.str(), std::ios::in) 185 std::ifstream infile(ss.str(), std::ios::in); 187 186 188 // file is not opened 187 // file is not opened 189 if (!infile.is_open()) { 188 if (!infile.is_open()) { 190 if(fVerbose > 1) { 189 if(fVerbose > 1) { 191 G4ExceptionDescription ed; 190 G4ExceptionDescription ed; 192 ed << "Regular file " << ss.str() << " i 191 ed << "Regular file " << ss.str() << " is not opened! Z=" 193 << Z << " A=" << A; 192 << Z << " A=" << A; 194 G4Exception("G4LevelReader::LevelManager 193 G4Exception("G4LevelReader::LevelManager(..)","had014", 195 JustWarning, ed, "Check file path"); 194 JustWarning, ed, "Check file path"); 196 } 195 } 197 return nullptr; 196 return nullptr; 198 } 197 } 199 // file is opened 198 // file is opened 200 if (fVerbose > 1) { 199 if (fVerbose > 1) { 201 G4cout << "G4LevelReader: open file " << s 200 G4cout << "G4LevelReader: open file " << ss.str() << " for Z= " 202 << Z << " A= " << A << G4endl; 201 << Z << " A= " << A << G4endl; 203 } 202 } 204 return LevelManager(Z, A, infile); 203 return LevelManager(Z, A, infile); 205 } 204 } 206 205 207 const G4LevelManager* 206 const G4LevelManager* 208 G4LevelReader::MakeLevelManager(G4int Z, G4int 207 G4LevelReader::MakeLevelManager(G4int Z, G4int A, const G4String& filename) 209 { 208 { 210 std::ifstream infile(filename, std::ios::in) 209 std::ifstream infile(filename, std::ios::in); 211 << 210 212 // file is not opened 211 // file is not opened 213 if (!infile.is_open()) { 212 if (!infile.is_open()) { 214 if(fVerbose > 1) { 213 if(fVerbose > 1) { 215 G4ExceptionDescription ed; 214 G4ExceptionDescription ed; 216 ed << "External file " << filename << " 215 ed << "External file " << filename << " is not opened! Z=" 217 << Z << " A=" << A; 216 << Z << " A=" << A; 218 G4Exception("G4LevelReader::LevelManager 217 G4Exception("G4LevelReader::LevelManager(..)","had014", 219 FatalException, ed, "Check file path"); 218 FatalException, ed, "Check file path"); 220 } 219 } 221 return nullptr; 220 return nullptr; 222 } 221 } 223 // file is opened 222 // file is opened 224 if (fVerbose > 1) { 223 if (fVerbose > 1) { 225 G4cout << "G4LevelReader: open external fi 224 G4cout << "G4LevelReader: open external file " << filename 226 << " for Z= " << Z << " A= " << A < 225 << " for Z= " << Z << " A= " << A << G4endl; 227 } 226 } 228 return LevelManager(Z, A, infile); 227 return LevelManager(Z, A, infile); 229 } 228 } 230 229 231 const G4LevelManager* 230 const G4LevelManager* 232 G4LevelReader::LevelManager(G4int Z, G4int A, 231 G4LevelReader::LevelManager(G4int Z, G4int A, std::ifstream& infile) 233 { 232 { 234 G4bool allLevels = fData->GetParameters()->S 233 G4bool allLevels = fData->GetParameters()->StoreICLevelData(); 235 fPol = " "; 234 fPol = " "; 236 G4int i = 0; 235 G4int i = 0; 237 for (;;) { << 236 for(;;) { 238 infile >> i1 >> fPol; // Level number a 237 infile >> i1 >> fPol; // Level number and floating level 239 // normal end of file 238 // normal end of file 240 if (infile.eof()) { << 239 if(infile.eof()) { 241 if (fVerbose > 1) { << 240 if(fVerbose > 1) { 242 G4cout << "### End of file Z= " << Z << " A= 241 G4cout << "### End of file Z= " << Z << " A= " << A 243 << " Nlevels= " << i << G4endl; 242 << " Nlevels= " << i << G4endl; 244 } 243 } 245 break; 244 break; 246 } 245 } >> 246 // problematic end of file >> 247 if(i1 != i) { >> 248 G4ExceptionDescription ed; >> 249 ed << " G4LevelReader: wrong data file for Z= " << Z << " A= " << A >> 250 << " level #" << i << " has index " << i1; >> 251 G4Exception("G4LevelReader::LevelManager(..)","had014", >> 252 JustWarning, ed, "Check G4LEVELGAMMADATA"); >> 253 break; >> 254 } 247 // start reading new level data 255 // start reading new level data 248 #ifdef G4VERBOSE << 249 if(fVerbose > 2) { 256 if(fVerbose > 2) { 250 G4cout << "New line: i1= " << i1 << " f 257 G4cout << "New line: i1= " << i1 << " fPol= <" << fPol << "> " << G4endl; 251 } 258 } 252 #endif << 253 // read new level data 259 // read new level data 254 if (!(ReadDataItem(infile, fEnergy) && << 260 if(!(ReadDataItem(infile, fEnergy) && 255 ReadDataItem(infile, fTime) && << 261 ReadDataItem(infile, fTime) && 256 ReadDataItem(infile, fSpin) && << 262 ReadDataItem(infile, fSpin) && 257 ReadDataItem(infile, ntrans))) { << 263 ReadDataItem(infile, ntrans))) { 258 if (fVerbose > 1) { << 264 if(fVerbose > 1) { 259 G4cout << "### Incomplete end of file Z= " < 265 G4cout << "### Incomplete end of file Z= " << Z << " A= " << A 260 << " Nlevels= " << i << G4endl; 266 << " Nlevels= " << i << G4endl; 261 } 267 } 262 break; 268 break; 263 } 269 } 264 fEnergy *= CLHEP::keV; 270 fEnergy *= CLHEP::keV; 265 for (k=0; k<nfloting; ++k) { << 271 for(k=0; k<nfloting; ++k) { 266 if (fPol == fFloatingLevels[k]) { << 272 if(fPol == fFloatingLevels[k]) { 267 break; 273 break; 268 } 274 } 269 } 275 } 270 // if a previous level has higher energy t << 276 // if a previous level has not transitions it may be ignored 271 // data with wrong level should red anyway << 277 if(0 < i) { 272 if (0 < i) { << 278 // protection 273 if (fEnergy < vEnergy[i-1]) { << 279 if(fEnergy < vEnergy[i-1]) { 274 #ifdef G4VERBOSE << 280 G4cout << "### G4LevelReader: broken level " << i 275 ++count1; << 281 << " E(MeV)= " << fEnergy << " < " << vEnergy[i-1] 276 if (count1 < countmax && fVerbose > 0) { << 282 << " for isotope Z= " << Z << " A= " 277 G4cout << "### G4LevelReader: broken level << 283 << A << " level energy increased" << G4endl; 278 << " E(MeV)= " << fEnergy << " < " << vEn << 284 fEnergy = vEnergy[i-1]; 279 << " for isotope Z= " << Z << " A= " << 280 << A << " level energy increased" << G4en << 281 } << 282 #endif << 283 // for any case << 284 fEnergy = vEnergy[i-1] + eTolarence; << 285 } 285 } 286 } 286 } 287 vEnergy[i] = fEnergy; 287 vEnergy[i] = fEnergy; 288 if (fTime > 0.0) { fTime *= fTimeFactor; 288 if (fTime > 0.0) { fTime *= fTimeFactor; } 289 else if (fTime < 0.0) { fTime = DBL_MAX; } 289 else if (fTime < 0.0) { fTime = DBL_MAX; } 290 290 291 G4int twos = G4lrint(fSpin + fSpin); 291 G4int twos = G4lrint(fSpin + fSpin); 292 twos = std::max(twos, -100); 292 twos = std::max(twos, -100); 293 vSpin[i] = 100 + twos + k*100000; 293 vSpin[i] = 100 + twos + k*100000; 294 #ifdef G4VERBOSE << 295 if (fVerbose > 2) { 294 if (fVerbose > 2) { 296 G4cout << " Level #" << i1 << " E(MeV) 295 G4cout << " Level #" << i1 << " E(MeV)=" << fEnergy/CLHEP::MeV 297 << " LTime(s)=" << fTime << " 2S=" << 296 << " LTime(s)=" << fTime << " 2S=" << vSpin[i] 298 << " meta=" << vSpin[i]/100000 << " id 297 << " meta=" << vSpin[i]/100000 << " idx=" << i 299 << " ntr=" << ntrans << G4endl; 298 << " ntr=" << ntrans << G4endl; 300 } 299 } 301 #endif << 302 vLevel[i] = nullptr; 300 vLevel[i] = nullptr; 303 if (ntrans == 0) { 301 if (ntrans == 0) { 304 vLevel[i] = new G4NucLevel(0, fTime, vTr << 302 vLevel[i] = new G4NucLevel(0, fTime, >> 303 vTrans, 305 vGammaCumProbability, 304 vGammaCumProbability, 306 vGammaProbability, 305 vGammaProbability, 307 vRatio, 306 vRatio, 308 vShellProbability); 307 vShellProbability); 309 } else if (ntrans > 0) { 308 } else if (ntrans > 0) { 310 309 311 G4bool isTransOK = true; << 310 // there are transitions 312 if (ntrans > fTransMax) { << 311 if(ntrans > fTransMax) { 313 fTransMax = ntrans; 312 fTransMax = ntrans; 314 vTrans.resize(fTransMax); 313 vTrans.resize(fTransMax); 315 vRatio.resize(fTransMax); 314 vRatio.resize(fTransMax); 316 vGammaCumProbability.resize(fTransMax); 315 vGammaCumProbability.resize(fTransMax); 317 vGammaProbability.resize(fTransMax); 316 vGammaProbability.resize(fTransMax); 318 vShellProbability.resize(fTransMax); 317 vShellProbability.resize(fTransMax); 319 } 318 } 320 fNorm1 = 0.0f; 319 fNorm1 = 0.0f; 321 for (G4int j=0; j<ntrans; ++j) { << 320 for(G4int j=0; j<ntrans; ++j) { 322 321 323 if (!(ReadDataItem(infile, i2) && << 322 if(!(ReadDataItem(infile, i2) && 324 ReadDataItem(infile, fTransEnergy) && << 323 ReadDataItem(infile, fTransEnergy) && 325 ReadDataItem(infile, fProb) && << 324 ReadDataItem(infile, fProb) && 326 ReadDataItem(infile, tnum) && << 325 ReadDataItem(infile, tnum) && 327 ReadDataItem(infile, vRatio[j]) && << 326 ReadDataItem(infile, vRatio[j]) && 328 ReadDataItem(infile, fAlpha))) { << 327 ReadDataItem(infile, fAlpha))) { 329 #ifdef G4VERBOSE << 328 if(fVerbose > 1) { 330 ++count2; << 329 G4cout << "### Fail to read transition j= " << j 331 if (count2 < countmax && fVerbose > 0) { << 330 << " Z= " << Z << " A= " << A << G4endl; 332 G4cout << "### Fail to read transition j << 333 << " j=" << j << " i2=" << i2 << 334 << " Z=" << Z << " A=" << A << G4endl; << 335 } 331 } 336 #endif << 332 break; 337 isTransOK = false; << 338 } 333 } 339 if (i2 >= i) { << 334 if(i2 >= i) { 340 #ifdef G4VERBOSE << 335 G4cout << "### G4LevelReader: broken transition " << j 341 ++count2; << 336 << " from level " << i << " to " << i2 342 if (count2 < countmax) { << 337 << " for isotope Z= " << Z << " A= " 343 G4cout << "### G4LevelReader: broken tra << 338 << A << " - use ground level" << G4endl; 344 << " from level " << i << " to " << i2 << 339 i2 = 0; 345 << " for isotope Z= " << Z << " A= " << 346 << A << "; the transition probability s << 347 } << 348 #endif << 349 isTransOK = false; << 350 fProb = 0.0f; << 351 } 340 } 352 vTrans[j] = i2*10000 + tnum; 341 vTrans[j] = i2*10000 + tnum; 353 fAlpha = std::min(std::max(fAlpha,0.f) 342 fAlpha = std::min(std::max(fAlpha,0.f), fAlphaMax); 354 G4float x = 1.0f + fAlpha; 343 G4float x = 1.0f + fAlpha; 355 fNorm1 += x*fProb; 344 fNorm1 += x*fProb; 356 vGammaCumProbability[j] = fNorm1; 345 vGammaCumProbability[j] = fNorm1; 357 vGammaProbability[j] = 1.0f/x; 346 vGammaProbability[j] = 1.0f/x; 358 vShellProbability[j] = nullptr; 347 vShellProbability[j] = nullptr; 359 if (fVerbose > 2) { << 348 if(fVerbose > 2) { 360 G4long prec = G4cout.precision(4); 349 G4long prec = G4cout.precision(4); 361 G4cout << "### Transition #" << j << " to 350 G4cout << "### Transition #" << j << " to level " << i2 362 << " i2= " << i2 << " Etrans(MeV)= " << 351 << " i2= " << i2 << " Etrans(MeV)= " << fTransEnergy*CLHEP::keV 363 << " fProb= " << fProb << " MultiP= " << 352 << " fProb= " << fProb << " MultiP= " << tnum 364 << " fMpRatio= " << fRatio << " fAlpha= 353 << " fMpRatio= " << fRatio << " fAlpha= " << fAlpha 365 << G4endl; 354 << G4endl; 366 G4cout.precision(prec); 355 G4cout.precision(prec); 367 } 356 } 368 if (fAlpha > 0.0f) { << 357 if(fAlpha > 0.0f) { 369 for (k=0; k<10; ++k) { << 358 for(k=0; k<10; ++k) { 370 if (!ReadDataItem(infile,fICC[k])) { << 359 //infile >> fICC[k]; 371 isTransOK = false; << 360 if(!ReadDataItem(infile,fICC[k])) { 372 #ifdef G4VERBOSE << 361 //if(infile.fail()) { 373 ++count2; << 362 if(fVerbose > 1) { 374 if (count2 < countmax) { << 363 G4cout << "### Fail to read conversion coeff k= " << k 375 G4cout << "### G4LevelReader: fail to read << 376 << " for transition j= " << j 364 << " for transition j= " << j 377 << " Z= " << Z << " A= " << A << G 365 << " Z= " << Z << " A= " << A << G4endl; 378 } 366 } 379 #endif << 380 for(kk=k; kk<10; ++kk) { fICC[kk] = 0. 367 for(kk=k; kk<10; ++kk) { fICC[kk] = 0.f; } >> 368 break; 381 } 369 } 382 } 370 } 383 if (allLevels) { << 371 if(allLevels) { 384 vShellProbability[j] = NormalizedICCProb 372 vShellProbability[j] = NormalizedICCProbability(Z); 385 } 373 } 386 } 374 } 387 } 375 } 388 if (ntrans > 0) { << 376 if(0.0f < fNorm1) { fNorm1 = 1.0f/fNorm1; } 389 G4int nt = ntrans - 1; << 377 G4int nt = ntrans - 1; 390 if (fVerbose > 2) { << 378 for(k=0; k<nt; ++k) { 391 G4cout << "=== New G4NucLevel: Ntran << 379 vGammaCumProbability[k] *= fNorm1; 392 << " Time(ns)=" << fTime << 380 if(fVerbose > 3) { 393 << " IdxTrans=" << vTrans[nt]/10000 << 381 G4cout << "Probabilities[" << k 394 << " isOK=" << isTransOK << 382 << "]= " << vGammaCumProbability[k] 395 << G4endl; << 383 << " " << vGammaProbability[k] 396 } << 384 << " idxTrans= " << vTrans[k]/10000 397 if (0.0f < fNorm1) { fNorm1 = 1.0f/fNorm1; } << 385 << G4endl; 398 for (k=0; k<nt; ++k) { << 399 vGammaCumProbability[k] *= fNorm1; << 400 #ifdef G4VERBOSE << 401 if (fVerbose > 3) { << 402 G4cout << "Probabilities[" << k << 403 << "]= " << vGammaCumProbability[k] << 404 << " " << vGammaProbability[k] << 405 << " idxTrans= " << vTrans[k]/10000 << 406 << G4endl; << 407 } << 408 #endif << 409 } 386 } 410 vGammaCumProbability[nt] = 1.0f; << 411 vLevel[i] = new G4NucLevel((std::size_t)ntra << 412 vGammaCumProbability, << 413 vGammaProbability, << 414 vRatio, << 415 vShellProbability); << 416 } 387 } >> 388 vGammaCumProbability[nt] = 1.0f; >> 389 if(fVerbose > 3) { >> 390 G4cout << "Probabilities[" << nt << "]= " >> 391 << vGammaCumProbability[nt] >> 392 << " " << vGammaProbability[nt] >> 393 << " IdxTrans= " << vTrans[nt]/10000 >> 394 << G4endl; >> 395 } >> 396 if(fVerbose > 2) { >> 397 G4cout << " New G4NucLevel: Ntrans= " << ntrans >> 398 << " Time(ns)= " << fTime << G4endl; >> 399 } >> 400 vLevel[i] = new G4NucLevel((std::size_t)ntrans, fTime, >> 401 vTrans, >> 402 vGammaCumProbability, >> 403 vGammaProbability, >> 404 vRatio, >> 405 vShellProbability); 417 } 406 } 418 ++i; 407 ++i; 419 if (i == fLevelMax) { << 408 if(i == fLevelMax) { 420 fLevelMax += 10; 409 fLevelMax += 10; 421 vEnergy.resize(fLevelMax, 0.0); 410 vEnergy.resize(fLevelMax, 0.0); 422 vSpin.resize(fLevelMax, 0); 411 vSpin.resize(fLevelMax, 0); 423 vLevel.resize(fLevelMax, nullptr); 412 vLevel.resize(fLevelMax, nullptr); 424 } 413 } 425 } 414 } 426 G4LevelManager* lman = nullptr; 415 G4LevelManager* lman = nullptr; 427 if (1 <= i) { << 416 if (1 <= i) { 428 lman = new G4LevelManager(Z, A, (std::size 417 lman = new G4LevelManager(Z, A, (std::size_t)i, vEnergy, vSpin, vLevel); 429 if (fVerbose > 1) { 418 if (fVerbose > 1) { 430 G4cout << "=== Reader: new manager for Z 419 G4cout << "=== Reader: new manager for Z=" << Z << " A=" << A 431 << " Nlevels=" << i << " E[0]=" 420 << " Nlevels=" << i << " E[0]=" 432 << vEnergy[0]/CLHEP::MeV << " MeV E1= 421 << vEnergy[0]/CLHEP::MeV << " MeV E1=" 433 << vEnergy[i-1]/CLHEP::MeV << " MeV" 422 << vEnergy[i-1]/CLHEP::MeV << " MeV" 434 << " count1,2=" << count1 << ", " << co << 423 << G4endl; 435 } 424 } 436 } 425 } 437 return lman; 426 return lman; 438 } 427 } 439 428