Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/particles/management/src/G4NuclideTable.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /particles/management/src/G4NuclideTable.cc (Version 11.3.0) and /particles/management/src/G4NuclideTable.cc (Version 10.6)


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