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