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 // G4NuclideTable class implementation 26 // G4NuclideTable class implementation 27 // 27 // 28 // Author: T.Koi, SLAC - 10 October 2013 28 // Author: T.Koi, SLAC - 10 October 2013 29 // ------------------------------------------- 29 // -------------------------------------------------------------------- 30 30 31 #include "G4NuclideTable.hh" 31 #include "G4NuclideTable.hh" 32 << 33 #include "G4NuclideTableMessenger.hh" 32 #include "G4NuclideTableMessenger.hh" 34 #include "G4PhysicalConstants.hh" << 33 35 #include "G4String.hh" << 36 #include "G4SystemOfUnits.hh" << 37 #include "G4ios.hh" 34 #include "G4ios.hh" >> 35 #include "G4String.hh" 38 #include "globals.hh" 36 #include "globals.hh" >> 37 #include "G4PhysicalConstants.hh" >> 38 #include "G4SystemOfUnits.hh" 39 39 40 #include <fstream> << 41 #include <iomanip> 40 #include <iomanip> >> 41 #include <fstream> 42 #include <sstream> 42 #include <sstream> 43 << 43 >> 44 // -------------------------------------------------------------------- 44 G4NuclideTable* G4NuclideTable::GetInstance() 45 G4NuclideTable* G4NuclideTable::GetInstance() 45 { 46 { 46 static G4NuclideTable instance; 47 static G4NuclideTable instance; 47 return &instance; 48 return &instance; 48 } 49 } 49 50 >> 51 // -------------------------------------------------------------------- 50 G4NuclideTable* G4NuclideTable::GetNuclideTabl 52 G4NuclideTable* G4NuclideTable::GetNuclideTable() 51 { 53 { 52 return GetInstance(); 54 return GetInstance(); 53 } 55 } 54 56 >> 57 // -------------------------------------------------------------------- 55 G4NuclideTable::G4NuclideTable() 58 G4NuclideTable::G4NuclideTable() 56 : G4VIsotopeTable("Isomer"), mean_life_thres << 59 : G4VIsotopeTable("Isomer"), >> 60 threshold_of_half_life(1000.0*ns), >> 61 flevelTolerance(1.0*eV) 57 { 62 { 58 fMessenger = new G4NuclideTableMessenger(thi 63 fMessenger = new G4NuclideTableMessenger(this); 59 fIsotopeList = new G4IsotopeList(); 64 fIsotopeList = new G4IsotopeList(); 60 GenerateNuclide(); 65 GenerateNuclide(); 61 } 66 } 62 67 >> 68 // -------------------------------------------------------------------- 63 G4NuclideTable::~G4NuclideTable() 69 G4NuclideTable::~G4NuclideTable() 64 { 70 { 65 for (auto& it : map_pre_load_list) { << 71 for (auto it=map_pre_load_list.begin(); it!=map_pre_load_list.end(); ++it) 66 it.second.clear(); << 72 { >> 73 it->second.clear(); 67 } 74 } 68 map_pre_load_list.clear(); 75 map_pre_load_list.clear(); 69 76 70 for (auto& it : map_full_list) { << 77 for (auto it=map_full_list.begin(); it!=map_full_list.end(); ++it) 71 it.second.clear(); << 78 { >> 79 it->second.clear(); 72 } 80 } 73 map_full_list.clear(); 81 map_full_list.clear(); 74 82 75 if (fIsotopeList != nullptr) { << 83 if (fIsotopeList != nullptr) 76 for (const auto& i : *fIsotopeList) { << 84 { 77 delete i; << 85 for (std::size_t i = 0 ; i<fIsotopeList->size(); ++i) >> 86 { >> 87 delete (*fIsotopeList)[i]; 78 } 88 } 79 fIsotopeList->clear(); 89 fIsotopeList->clear(); 80 delete fIsotopeList; 90 delete fIsotopeList; 81 fIsotopeList = nullptr; 91 fIsotopeList = nullptr; 82 } 92 } 83 delete fMessenger; 93 delete fMessenger; 84 } 94 } 85 95 >> 96 // -------------------------------------------------------------------- 86 G4IsotopeProperty* G4NuclideTable::GetIsotope( 97 G4IsotopeProperty* G4NuclideTable::GetIsotope(G4int Z, G4int A, G4double E, 87 98 G4Ions::G4FloatLevelBase flb) 88 { 99 { 89 G4IsotopeProperty* fProperty = nullptr; 100 G4IsotopeProperty* fProperty = nullptr; 90 101 91 // At first searching UserDefined 102 // At first searching UserDefined 92 if (fUserDefinedList != nullptr) { << 103 if ( fUserDefinedList ) 93 for (const auto it : *fUserDefinedList) { << 104 { 94 if (Z == it->GetAtomicNumber() && A == i << 105 for (auto it=fUserDefinedList->cbegin(); it!=fUserDefinedList->cend(); ++it) 95 G4double levelE = it->GetEnergy(); << 106 { 96 if (levelE - flevelTolerance / 2 <= E << 107 if ( Z == (*it)->GetAtomicNumber() && A == (*it)->GetAtomicMass() ) 97 if (flb == it->GetFloatLevelBase()) << 108 { 98 return it; << 109 G4double levelE = (*it)->GetEnergy(); 99 } // found << 110 if ( levelE - flevelTolerance/2 <= E && E < levelE + flevelTolerance/2 ) >> 111 { >> 112 if( flb == (*it)->GetFloatLevelBase() ) { return *it; } //found 100 } 113 } 101 } 114 } 102 } 115 } 103 } << 116 } 104 117 105 // Searching pre-load 118 // Searching pre-load 106 // Note: isomer level is properly set only f 119 // Note: isomer level is properly set only for pre_load_list 107 // 120 // 108 G4int ionCode = 1000 * Z + A; << 121 G4int ionCode = 1000*Z + A; 109 auto itf = map_pre_load_list.find(ionCode); << 122 auto itf = map_pre_load_list.find( ionCode ); 110 123 111 if (itf != map_pre_load_list.cend()) { << 124 if ( itf != map_pre_load_list.cend() ) 112 auto lower_bound_itr = itf->second.lower_b << 125 { >> 126 auto lower_bound_itr = itf -> second.lower_bound ( E - flevelTolerance/2 ); 113 G4double levelE = DBL_MAX; 127 G4double levelE = DBL_MAX; 114 128 115 while (lower_bound_itr != itf->second.cend << 129 while ( lower_bound_itr != itf -> second.cend() ) >> 130 { 116 levelE = lower_bound_itr->first; 131 levelE = lower_bound_itr->first; 117 if (levelE - flevelTolerance / 2 <= E && << 132 if ( levelE - flevelTolerance/2 <= E && E < levelE + flevelTolerance/2 ) 118 if (flb == (lower_bound_itr->second)-> << 133 { 119 return lower_bound_itr->second; // << 134 if ( flb == (lower_bound_itr->second)->GetFloatLevelBase() ) >> 135 { >> 136 return lower_bound_itr->second; // found 120 } 137 } 121 } 138 } 122 else { << 139 else >> 140 { 123 break; 141 break; 124 } << 142 } 125 ++lower_bound_itr; << 143 ++lower_bound_itr; 126 } 144 } 127 } 145 } 128 146 129 return fProperty; // not found << 147 return fProperty; // not found 130 } 148 } 131 149 132 G4double G4NuclideTable::GetTruncationError(G4 << 150 // -------------------------------------------------------------------- >> 151 G4double G4NuclideTable::GetTruncationError( G4double eex ) 133 { 152 { 134 G4double tolerance = G4NuclideTable::GetInst << 153 G4double tolerance= G4NuclideTable::GetInstance()->GetLevelTolerance(); 135 return eex - (G4long)(eex / tolerance) * tol << 154 return eex - (G4long)(eex/tolerance)*tolerance; 136 } 155 } 137 156 138 G4double G4NuclideTable::Round(G4double eex) << 157 // -------------------------------------------------------------------- >> 158 G4double G4NuclideTable::Round( G4double eex ) 139 { 159 { 140 G4double tolerance = G4NuclideTable::GetInst << 160 G4double tolerance= G4NuclideTable::GetInstance()->GetLevelTolerance(); 141 return round(eex / tolerance) * tolerance; << 161 return round(eex/tolerance)*tolerance; 142 } 162 } 143 163 144 G4long G4NuclideTable::Truncate(G4double eex) << 164 // -------------------------------------------------------------------- >> 165 G4long G4NuclideTable::Truncate( G4double eex ) 145 { 166 { 146 G4double tolerance = G4NuclideTable::GetInst << 167 G4double tolerance= G4NuclideTable::GetInstance()->GetLevelTolerance(); 147 return (G4long)(eex / tolerance); << 168 return (G4long)(eex/tolerance); 148 } 169 } 149 170 >> 171 // -------------------------------------------------------------------- 150 G4double G4NuclideTable::Tolerance() 172 G4double G4NuclideTable::Tolerance() 151 { 173 { 152 return G4NuclideTable::GetInstance()->GetLev 174 return G4NuclideTable::GetInstance()->GetLevelTolerance(); 153 } 175 } 154 176 155 G4IsotopeProperty* G4NuclideTable::GetIsotopeB << 177 // -------------------------------------------------------------------- >> 178 G4IsotopeProperty* >> 179 G4NuclideTable::GetIsotopeByIsoLvl(G4int Z, G4int A, G4int lvl) 156 { 180 { 157 if (lvl == 0) return GetIsotope(Z, A, 0.0); << 181 if(lvl==0) return GetIsotope(Z,A,0.0); 158 return nullptr; 182 return nullptr; 159 } 183 } 160 184 >> 185 // -------------------------------------------------------------------- 161 void G4NuclideTable::GenerateNuclide() 186 void G4NuclideTable::GenerateNuclide() 162 { 187 { 163 if (mean_life_threshold < minimum_mean_life_ << 188 if ( threshold_of_half_life < minimum_threshold_of_half_life ) >> 189 { 164 // Need to update full list 190 // Need to update full list 165 const char* path = G4FindDataDir("G4ENSDFS << 191 char* path = std::getenv("G4ENSDFSTATEDATA"); 166 192 167 if (path == nullptr) { << 193 if ( path == nullptr ) >> 194 { 168 G4Exception("G4NuclideTable", "PART70000 195 G4Exception("G4NuclideTable", "PART70000", FatalException, 169 "G4ENSDFSTATEDATA environmen 196 "G4ENSDFSTATEDATA environment variable must be set"); 170 return; 197 return; 171 } 198 } 172 199 173 std::ifstream ifs; 200 std::ifstream ifs; 174 G4String filename(path); 201 G4String filename(path); 175 filename += "/ENSDFSTATE.dat"; 202 filename += "/ENSDFSTATE.dat"; 176 203 177 ifs.open(filename.c_str()); << 204 ifs.open( filename.c_str() ); 178 if (!ifs.good()) { << 205 if ( !ifs.good() ) 179 G4Exception("G4NuclideTable", "PART70001 << 206 { >> 207 G4Exception("G4NuclideTable", "PART70001", FatalException, >> 208 "ENSDFSTATE.dat is not found."); 180 return; 209 return; 181 } 210 } 182 211 183 G4int ionCode = 0; << 212 G4int ionCode=0; 184 G4int iLevel = 0; << 213 G4int iLevel=0; 185 G4int ionZ; 214 G4int ionZ; 186 G4int ionA; 215 G4int ionA; 187 G4double ionE; 216 G4double ionE; 188 G4String ionFL; 217 G4String ionFL; 189 G4double ionLife; 218 G4double ionLife; 190 G4int ionJ; 219 G4int ionJ; 191 G4double ionMu; 220 G4double ionMu; 192 221 193 // Lifetimes read from ENSDFSTATE are mean << 194 ifs >> ionZ >> ionA >> ionE >> ionFL >> io 222 ifs >> ionZ >> ionA >> ionE >> ionFL >> ionLife >> ionJ >> ionMu; 195 223 196 while (ifs.good()) // Loop checking, 09.0 << 224 while ( ifs.good() ) // Loop checking, 09.08.2015, K.Kurashige 197 { 225 { 198 if (ionCode != 1000 * ionZ + ionA) { << 226 if ( ionCode != 1000*ionZ + ionA ) >> 227 { 199 iLevel = 0; 228 iLevel = 0; 200 ionCode = 1000 * ionZ + ionA; << 229 ionCode = 1000*ionZ + ionA; 201 } 230 } 202 231 203 ionE *= keV; 232 ionE *= keV; 204 G4Ions::G4FloatLevelBase flb = StripFloa << 233 G4Ions::G4FloatLevelBase flb = StripFloatLevelBase( ionFL ); 205 ionLife *= ns; 234 ionLife *= ns; 206 ionMu *= (joule / tesla); << 235 ionMu *= (joule/tesla); 207 236 208 if ((ionE == 0 && flb == G4Ions::G4Float << 237 if ( ( ionE == 0 && flb == G4Ions::G4FloatLevelBase::no_Float ) 209 || (mean_life_threshold <= ionLife & << 238 || ( threshold_of_half_life <= ionLife*std::log(2.0) >> 239 && ionLife*std::log(2.0) < minimum_threshold_of_half_life ) ) 210 { 240 { 211 if (ionE > 0) ++iLevel; << 241 if ( ionE > 0 ) ++iLevel; 212 if (iLevel > 9) iLevel = 9; << 242 if ( iLevel > 9 ) iLevel=9; 213 243 214 auto fProperty = new G4IsotopeProperty << 244 G4IsotopeProperty* fProperty = new G4IsotopeProperty(); 215 245 216 // Set Isotope Property 246 // Set Isotope Property 217 fProperty->SetAtomicNumber(ionZ); 247 fProperty->SetAtomicNumber(ionZ); 218 fProperty->SetAtomicMass(ionA); 248 fProperty->SetAtomicMass(ionA); 219 fProperty->SetIsomerLevel(iLevel); 249 fProperty->SetIsomerLevel(iLevel); 220 fProperty->SetEnergy(ionE); 250 fProperty->SetEnergy(ionE); 221 fProperty->SetiSpin(ionJ); 251 fProperty->SetiSpin(ionJ); 222 fProperty->SetLifeTime(ionLife); 252 fProperty->SetLifeTime(ionLife); 223 fProperty->SetDecayTable(nullptr); 253 fProperty->SetDecayTable(nullptr); 224 fProperty->SetMagneticMoment(ionMu); 254 fProperty->SetMagneticMoment(ionMu); 225 fProperty->SetFloatLevelBase(flb); << 255 fProperty->SetFloatLevelBase( flb ); 226 256 227 fIsotopeList->push_back(fProperty); 257 fIsotopeList->push_back(fProperty); 228 258 229 auto itf = map_full_list.find(ionCode) << 259 auto itf = map_full_list.find( ionCode ); 230 if (itf == map_full_list.cend()) { << 260 if ( itf == map_full_list.cend() ) >> 261 { 231 std::multimap<G4double, G4IsotopePro 262 std::multimap<G4double, G4IsotopeProperty*> aMultiMap; 232 itf = (map_full_list.insert(std::pai << 263 itf = ( map_full_list.insert( 233 ionCode, aMultiMap))) << 264 std::pair< G4int, std::multimap< G4double, 234 .first; << 265 G4IsotopeProperty* > > ( ionCode, aMultiMap ) ) ).first; 235 } 266 } 236 itf->second.insert(std::pair<G4double, << 267 itf -> second.insert( >> 268 std::pair< G4double, G4IsotopeProperty* >(ionE, fProperty) ); 237 } 269 } 238 << 239 ifs >> ionZ >> ionA >> ionE >> ionFL >> 270 ifs >> ionZ >> ionA >> ionE >> ionFL >> ionLife >> ionJ >> ionMu; 240 } // End while << 271 } >> 272 >> 273 minimum_threshold_of_half_life = threshold_of_half_life; 241 274 242 minimum_mean_life_threshold = mean_life_th << 243 } 275 } 244 276 245 // Clear current map 277 // Clear current map 246 for (auto& it : map_pre_load_list) { << 278 for ( auto it=map_pre_load_list.begin(); it!=map_pre_load_list.end(); ++it ) 247 it.second.clear(); << 279 { >> 280 it->second.clear(); 248 } 281 } 249 map_pre_load_list.clear(); 282 map_pre_load_list.clear(); 250 283 251 // Build map based on current threshold valu << 284 // Build map based on current threshold value 252 for (const auto& it : map_full_list) { << 285 for ( auto it = map_full_list.cbegin(); it != map_full_list.cend(); ++it ) 253 G4int ionCode = it.first; << 286 { 254 auto itf = map_pre_load_list.find(ionCode) << 287 G4int ionCode = it->first; 255 if (itf == map_pre_load_list.cend()) { << 288 auto itf = map_pre_load_list.find( ionCode ); >> 289 if ( itf == map_pre_load_list.cend() ) >> 290 { 256 std::multimap<G4double, G4IsotopePropert 291 std::multimap<G4double, G4IsotopeProperty*> aMultiMap; 257 itf = (map_pre_load_list.insert( << 292 itf = ( map_pre_load_list.insert( 258 std::pair<G4int, std::multimap< << 293 std::pair< G4int, std::multimap< G4double, 259 .first; << 294 G4IsotopeProperty* > > (ionCode, aMultiMap) ) ).first; 260 } 295 } 261 << 262 G4int iLevel = 0; 296 G4int iLevel = 0; 263 for (const auto& itt : it.second) { << 297 for ( auto itt = it->second.cbegin(); itt != it->second.cend(); ++itt ) 264 G4double exEnergy = itt.first; << 298 { 265 G4double meanLife = itt.second->GetLifeT << 299 G4double exEnergy = itt->first; 266 if (exEnergy == 0.0 || meanLife > mean_l << 300 G4double meanLife = itt->second->GetLifeTime(); 267 if (itt.first != 0.0) ++iLevel; << 301 if ( exEnergy == 0.0 || meanLife*std::log(2.0) > threshold_of_half_life ) 268 if (iLevel > 9) iLevel = 9; << 302 { 269 itt.second->SetIsomerLevel(iLevel); << 303 if ( itt->first != 0.0 ) ++iLevel; 270 itf->second.insert(std::pair<G4double, << 304 if ( iLevel > 9 ) iLevel=9; >> 305 itt->second->SetIsomerLevel( iLevel ); >> 306 itf->second.insert( >> 307 std::pair< G4double, G4IsotopeProperty* >(exEnergy, itt->second) ); 271 } 308 } 272 } 309 } 273 } 310 } 274 } 311 } 275 312 276 void G4NuclideTable::AddState(G4int ionZ, G4in << 313 // -------------------------------------------------------------------- 277 G4double ionMu) << 314 void G4NuclideTable::AddState( G4int ionZ, G4int ionA, G4double ionE, >> 315 G4double ionLife, G4int ionJ, G4double ionMu ) 278 { 316 { 279 if (G4Threading::IsMasterThread()) { << 317 if ( G4Threading::IsMasterThread() ) >> 318 { 280 G4int flbIndex = 0; 319 G4int flbIndex = 0; 281 ionE = StripFloatLevelBase(ionE, flbIndex) << 320 ionE = StripFloatLevelBase( ionE, flbIndex ); 282 AddState(ionZ, ionA, ionE, flbIndex, ionLi << 321 AddState(ionZ,ionA,ionE,flbIndex,ionLife,ionJ,ionMu); 283 } 322 } 284 } 323 } 285 324 286 void G4NuclideTable::AddState(G4int ionZ, G4in << 325 // -------------------------------------------------------------------- 287 G4double ionLife << 326 void G4NuclideTable::AddState( G4int ionZ, G4int ionA, G4double ionE, >> 327 G4int flbIndex, G4double ionLife, G4int ionJ, >> 328 G4double ionMu ) 288 { 329 { 289 if (G4Threading::IsMasterThread()) { << 330 if ( G4Threading::IsMasterThread() ) 290 if (fUserDefinedList == nullptr) fUserDefi << 331 { >> 332 if ( fUserDefinedList == nullptr ) fUserDefinedList = new G4IsotopeList(); 291 333 292 auto fProperty = new G4IsotopeProperty(); << 334 G4IsotopeProperty* fProperty = new G4IsotopeProperty(); 293 335 294 // Set Isotope Property 336 // Set Isotope Property 295 fProperty->SetAtomicNumber(ionZ); 337 fProperty->SetAtomicNumber(ionZ); 296 fProperty->SetAtomicMass(ionA); 338 fProperty->SetAtomicMass(ionA); 297 fProperty->SetIsomerLevel(9); 339 fProperty->SetIsomerLevel(9); 298 fProperty->SetEnergy(ionE); 340 fProperty->SetEnergy(ionE); 299 fProperty->SetiSpin(ionJ); 341 fProperty->SetiSpin(ionJ); 300 fProperty->SetLifeTime(ionLife); 342 fProperty->SetLifeTime(ionLife); 301 fProperty->SetDecayTable(nullptr); 343 fProperty->SetDecayTable(nullptr); 302 fProperty->SetMagneticMoment(ionMu); 344 fProperty->SetMagneticMoment(ionMu); 303 fProperty->SetFloatLevelBase(flbIndex); 345 fProperty->SetFloatLevelBase(flbIndex); 304 346 305 fUserDefinedList->push_back(fProperty); 347 fUserDefinedList->push_back(fProperty); 306 fIsotopeList->push_back(fProperty); 348 fIsotopeList->push_back(fProperty); 307 } << 349 } 308 } 350 } 309 351 310 void G4NuclideTable::AddState(G4int ionZ, G4in << 352 // -------------------------------------------------------------------- 311 G4double ionLife << 353 void G4NuclideTable::AddState( G4int ionZ, G4int ionA, G4double ionE, >> 354 G4Ions::G4FloatLevelBase flb, G4double ionLife, >> 355 G4int ionJ, G4double ionMu ) 312 { 356 { 313 if (G4Threading::IsMasterThread()) { << 357 if ( G4Threading::IsMasterThread() ) 314 if (fUserDefinedList == nullptr) fUserDefi << 358 { >> 359 if ( fUserDefinedList == nullptr ) fUserDefinedList = new G4IsotopeList(); 315 360 316 auto fProperty = new G4IsotopeProperty(); << 361 G4IsotopeProperty* fProperty = new G4IsotopeProperty(); 317 362 318 // Set Isotope Property 363 // Set Isotope Property 319 fProperty->SetAtomicNumber(ionZ); 364 fProperty->SetAtomicNumber(ionZ); 320 fProperty->SetAtomicMass(ionA); 365 fProperty->SetAtomicMass(ionA); 321 fProperty->SetIsomerLevel(9); 366 fProperty->SetIsomerLevel(9); 322 fProperty->SetEnergy(ionE); 367 fProperty->SetEnergy(ionE); 323 fProperty->SetiSpin(ionJ); 368 fProperty->SetiSpin(ionJ); 324 fProperty->SetLifeTime(ionLife); 369 fProperty->SetLifeTime(ionLife); 325 fProperty->SetDecayTable(nullptr); << 370 fProperty->SetDecayTable(0); 326 fProperty->SetMagneticMoment(ionMu); 371 fProperty->SetMagneticMoment(ionMu); 327 fProperty->SetFloatLevelBase(flb); << 372 fProperty->SetFloatLevelBase( flb ); 328 373 329 fUserDefinedList->push_back(fProperty); 374 fUserDefinedList->push_back(fProperty); 330 fIsotopeList->push_back(fProperty); 375 fIsotopeList->push_back(fProperty); 331 } 376 } 332 } 377 } 333 378 334 void G4NuclideTable::SetThresholdOfHalfLife(G4 << 379 // -------------------------------------------------------------------- 335 { << 380 void G4NuclideTable::SetThresholdOfHalfLife( G4double t ) 336 if (G4Threading::IsMasterThread()) { << 337 mean_life_threshold = t / 0.69314718; << 338 GenerateNuclide(); << 339 } << 340 } << 341 << 342 // Set the mean life threshold for nuclides << 343 // All nuclides with mean lives greater than t << 344 // for this run << 345 void G4NuclideTable::SetMeanLifeThreshold(G4do << 346 { 381 { 347 if (G4Threading::IsMasterThread()) { << 382 if ( G4Threading::IsMasterThread() ) 348 mean_life_threshold = t; << 383 { >> 384 threshold_of_half_life=t; 349 GenerateNuclide(); 385 GenerateNuclide(); 350 } 386 } 351 } 387 } 352 388 >> 389 // -------------------------------------------------------------------- 353 G4double G4NuclideTable::StripFloatLevelBase(G 390 G4double G4NuclideTable::StripFloatLevelBase(G4double E, G4int& flbIndex) 354 { 391 { 355 G4double rem = std::fmod(E / (1.0E-3 * eV), << 392 G4double rem = std::fmod(E/(1.0E-3*eV),10.0); 356 flbIndex = G4int(rem); 393 flbIndex = G4int(rem); 357 return E - rem; << 394 return E-rem; 358 } 395 } 359 396 360 G4Ions::G4FloatLevelBase G4NuclideTable::Strip << 397 // -------------------------------------------------------------------- 361 { << 398 G4Ions::G4FloatLevelBase 362 if (sFLB.empty() || 2 < sFLB.size()) { << 399 G4NuclideTable::StripFloatLevelBase( const G4String& sFLB ) 363 G4String text; << 400 { 364 text += sFLB; << 401 if ( sFLB.size() < 1 || 2 < sFLB.size() ) 365 text += " is not valid indicator of G4Ions << 402 { 366 text += "You may use a wrong version of EN << 403 G4String text; 367 text += "Please use G4ENSDFSTATE-2.0 or la << 404 text += sFLB; 368 << 405 text += " is not valid indicator of G4Ions::G4FloatLevelBase.\n"; 369 G4Exception("G4NuclideTable", "PART70002", << 406 text += "You may use a wrong version of ENSDFSTATE data.\n"; 370 } << 407 text += "Please use G4ENSDFSTATE-2.0 or later."; 371 G4Ions::G4FloatLevelBase flb = noFloat; << 408 372 if (!(sFLB == "-")) { << 409 G4Exception( "G4NuclideTable", "PART70002", FatalException, text ); 373 flb = G4Ions::FloatLevelBase(sFLB.back()); << 410 } 374 } << 411 G4Ions::G4FloatLevelBase flb = noFloat; 375 return flb; << 412 if ( !(sFLB == '-') ) >> 413 { >> 414 flb = G4Ions::FloatLevelBase( sFLB.back() ); >> 415 } >> 416 return flb; 376 } 417 } 377 418