Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4NuclideTable Class Reference

#include <G4NuclideTable.hh>

+ Inheritance diagram for G4NuclideTable:

Public Types

using G4IsotopeList = std::vector<G4IsotopeProperty*>
 

Public Member Functions

 ~G4NuclideTable () override
 
 G4NuclideTable (const G4NuclideTable &)=delete
 
G4NuclideTableoperator= (const G4NuclideTable &)=delete
 
void GenerateNuclide ()
 
void SetThresholdOfHalfLife (G4double)
 
G4double GetThresholdOfHalfLife ()
 
void SetMeanLifeThreshold (G4double)
 
G4double GetMeanLifeThreshold ()
 
void SetLevelTolerance (G4double x)
 
G4double GetLevelTolerance ()
 
void AddState (G4int, G4int, G4double, G4double, G4int ionJ=0, G4double ionMu=0.0)
 
void AddState (G4int, G4int, G4double, G4int, G4double, G4int ionJ=0, G4double ionMu=0.0)
 
void AddState (G4int, G4int, G4double, G4Ions::G4FloatLevelBase, G4double, G4int ionJ=0, G4double ionMu=0.0)
 
std::size_t GetSizeOfIsotopeList ()
 
G4IsotopePropertyGetIsotope (G4int Z, G4int A, G4double E, G4Ions::G4FloatLevelBase flb=G4Ions::G4FloatLevelBase::no_Float) override
 
G4IsotopePropertyGetIsotopeByIsoLvl (G4int Z, G4int A, G4int lvl=0) override
 
std::size_t entries () const
 
G4IsotopePropertyGetIsotopeByIndex (std::size_t idx) const
 
- Public Member Functions inherited from G4VIsotopeTable
 G4VIsotopeTable ()=default
 
 G4VIsotopeTable (const G4String &)
 
 G4VIsotopeTable (const G4VIsotopeTable &)=default
 
G4VIsotopeTableoperator= (const G4VIsotopeTable &)
 
virtual ~G4VIsotopeTable ()=default
 
G4int GetVerboseLevel () const
 
void SetVerboseLevel (G4int level)
 
void DumpTable (G4int Zmin=1, G4int Zmax=118)
 
const G4StringGetName () const
 

Static Public Member Functions

static G4NuclideTableGetInstance ()
 
static G4NuclideTableGetNuclideTable ()
 
static G4double GetTruncationError (G4double eex)
 
static G4double Round (G4double eex)
 
static G4long Truncate (G4double eex)
 
static G4double Tolerance ()
 

Detailed Description

Definition at line 52 of file G4NuclideTable.hh.

Member Typedef Documentation

◆ G4IsotopeList

Definition at line 55 of file G4NuclideTable.hh.

Constructor & Destructor Documentation

◆ ~G4NuclideTable()

G4NuclideTable::~G4NuclideTable ( )
override

Definition at line 63 of file G4NuclideTable.cc.

64{
65 for (auto& it : map_pre_load_list) {
66 it.second.clear();
67 }
68 map_pre_load_list.clear();
69
70 for (auto& it : map_full_list) {
71 it.second.clear();
72 }
73 map_full_list.clear();
74
75 if (fIsotopeList != nullptr) {
76 for (const auto& i : *fIsotopeList) {
77 delete i;
78 }
79 fIsotopeList->clear();
80 delete fIsotopeList;
81 fIsotopeList = nullptr;
82 }
83 delete fMessenger;
84}

◆ G4NuclideTable()

G4NuclideTable::G4NuclideTable ( const G4NuclideTable & )
delete

Member Function Documentation

◆ AddState() [1/3]

void G4NuclideTable::AddState ( G4int ionZ,
G4int ionA,
G4double ionE,
G4double ionLife,
G4int ionJ = 0,
G4double ionMu = 0.0 )

Definition at line 276 of file G4NuclideTable.cc.

278{
280 G4int flbIndex = 0;
281 ionE = StripFloatLevelBase(ionE, flbIndex);
282 AddState(ionZ, ionA, ionE, flbIndex, ionLife, ionJ, ionMu);
283 }
284}
int G4int
Definition G4Types.hh:85
void AddState(G4int, G4int, G4double, G4double, G4int ionJ=0, G4double ionMu=0.0)
G4bool IsMasterThread()

Referenced by AddState().

◆ AddState() [2/3]

void G4NuclideTable::AddState ( G4int ionZ,
G4int ionA,
G4double ionE,
G4int flbIndex,
G4double ionLife,
G4int ionJ = 0,
G4double ionMu = 0.0 )

Definition at line 286 of file G4NuclideTable.cc.

288{
290 if (fUserDefinedList == nullptr) fUserDefinedList = new G4IsotopeList();
291
292 auto fProperty = new G4IsotopeProperty();
293
294 // Set Isotope Property
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
305 fUserDefinedList->push_back(fProperty);
306 fIsotopeList->push_back(fProperty);
307 }
308}
std::vector< G4IsotopeProperty * > G4IsotopeList

◆ AddState() [3/3]

void G4NuclideTable::AddState ( G4int ionZ,
G4int ionA,
G4double ionE,
G4Ions::G4FloatLevelBase flb,
G4double ionLife,
G4int ionJ = 0,
G4double ionMu = 0.0 )

Definition at line 310 of file G4NuclideTable.cc.

312{
314 if (fUserDefinedList == nullptr) fUserDefinedList = new G4IsotopeList();
315
316 auto fProperty = new G4IsotopeProperty();
317
318 // Set Isotope Property
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
329 fUserDefinedList->push_back(fProperty);
330 fIsotopeList->push_back(fProperty);
331 }
332}

◆ entries()

std::size_t G4NuclideTable::entries ( ) const
inline

Definition at line 176 of file G4NuclideTable.hh.

177{
178 return (fIsotopeList != nullptr ? fIsotopeList->size() : std::size_t(0));
179}

Referenced by G4IonTable::PreloadNuclide().

◆ GenerateNuclide()

void G4NuclideTable::GenerateNuclide ( )

Definition at line 161 of file G4NuclideTable.cc.

162{
163 if (mean_life_threshold < minimum_mean_life_threshold) {
164 // Need to update full list
165 const char* path = G4FindDataDir("G4ENSDFSTATEDATA");
166
167 if (path == nullptr) {
168 G4Exception("G4NuclideTable", "PART70000", FatalException,
169 "G4ENSDFSTATEDATA environment variable must be set");
170 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", FatalException, "ENSDFSTATE.dat is not found.");
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 lives
194 ifs >> ionZ >> ionA >> ionE >> ionFL >> ionLife >> ionJ >> ionMu;
195
196 while (ifs.good()) // Loop checking, 09.08.2015, K.Kurashige
197 {
198 if (ionCode != 1000 * ionZ + ionA) {
199 iLevel = 0;
200 ionCode = 1000 * ionZ + ionA;
201 }
202
203 ionE *= keV;
204 G4Ions::G4FloatLevelBase flb = StripFloatLevelBase(ionFL);
205 ionLife *= ns;
206 ionMu *= (joule / tesla);
207
208 if ((ionE == 0 && flb == G4Ions::G4FloatLevelBase::no_Float)
209 || (mean_life_threshold <= ionLife && ionLife < minimum_mean_life_threshold))
210 {
211 if (ionE > 0) ++iLevel;
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, G4IsotopeProperty*> aMultiMap;
232 itf = (map_full_list.insert(std::pair<G4int, std::multimap<G4double, G4IsotopeProperty*>>(
233 ionCode, aMultiMap)))
234 .first;
235 }
236 itf->second.insert(std::pair<G4double, G4IsotopeProperty*>(ionE, fProperty));
237 }
238
239 ifs >> ionZ >> ionA >> ionE >> ionFL >> ionLife >> ionJ >> ionMu;
240 } // End while
241
242 minimum_mean_life_threshold = mean_life_threshold;
243 }
244
245 // Clear current map
246 for (auto& it : map_pre_load_list) {
247 it.second.clear();
248 }
249 map_pre_load_list.clear();
250
251 // Build map based on current threshold value
252 for (const auto& it : map_full_list) {
253 G4int ionCode = it.first;
254 auto itf = map_pre_load_list.find(ionCode);
255 if (itf == map_pre_load_list.cend()) {
256 std::multimap<G4double, G4IsotopeProperty*> aMultiMap;
257 itf = (map_pre_load_list.insert(
258 std::pair<G4int, std::multimap<G4double, G4IsotopeProperty*>>(ionCode, aMultiMap)))
259 .first;
260 }
261
262 G4int iLevel = 0;
263 for (const auto& itt : it.second) {
264 G4double exEnergy = itt.first;
265 G4double meanLife = itt.second->GetLifeTime();
266 if (exEnergy == 0.0 || meanLife > mean_life_threshold) {
267 if (itt.first != 0.0) ++iLevel;
268 if (iLevel > 9) iLevel = 9;
269 itt.second->SetIsomerLevel(iLevel);
270 itf->second.insert(std::pair<G4double, G4IsotopeProperty*>(exEnergy, itt.second));
271 }
272 }
273 }
274}
const char * G4FindDataDir(const char *)
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
double G4double
Definition G4Types.hh:83
G4FloatLevelBase
Definition G4Ions.hh:80
#define ns(x)
Definition xmltok.c:1649

Referenced by G4IonTable::PreloadNuclide(), SetMeanLifeThreshold(), and SetThresholdOfHalfLife().

◆ GetInstance()

◆ GetIsotope()

G4IsotopeProperty * G4NuclideTable::GetIsotope ( G4int Z,
G4int A,
G4double E,
G4Ions::G4FloatLevelBase flb = G4Ions::G4FloatLevelBase::no_Float )
overridevirtual

Implements G4VIsotopeTable.

Definition at line 86 of file G4NuclideTable.cc.

88{
89 G4IsotopeProperty* fProperty = nullptr;
90
91 // At first searching UserDefined
92 if (fUserDefinedList != nullptr) {
93 for (const auto it : *fUserDefinedList) {
94 if (Z == it->GetAtomicNumber() && A == it->GetAtomicMass()) {
95 G4double levelE = it->GetEnergy();
96 if (levelE - flevelTolerance / 2 <= E && E < levelE + flevelTolerance / 2) {
97 if (flb == it->GetFloatLevelBase()) {
98 return it;
99 } // found
100 }
101 }
102 }
103 }
104
105 // Searching pre-load
106 // Note: isomer level is properly set only for pre_load_list
107 //
108 G4int ionCode = 1000 * Z + A;
109 auto itf = map_pre_load_list.find(ionCode);
110
111 if (itf != map_pre_load_list.cend()) {
112 auto lower_bound_itr = itf->second.lower_bound(E - flevelTolerance / 2);
113 G4double levelE = DBL_MAX;
114
115 while (lower_bound_itr != itf->second.cend()) {
116 levelE = lower_bound_itr->first;
117 if (levelE - flevelTolerance / 2 <= E && E < levelE + flevelTolerance / 2) {
118 if (flb == (lower_bound_itr->second)->GetFloatLevelBase() || E == 0.0) {
119 return lower_bound_itr->second; // found
120 }
121 }
122 else {
123 break;
124 }
125 ++lower_bound_itr;
126 }
127 }
128
129 return fProperty; // not found
130}
const G4double A[17]
#define DBL_MAX
Definition templates.hh:62

Referenced by GetIsotopeByIsoLvl().

◆ GetIsotopeByIndex()

G4IsotopeProperty * G4NuclideTable::GetIsotopeByIndex ( std::size_t idx) const
inline

Definition at line 181 of file G4NuclideTable.hh.

182{
183 if ((fIsotopeList != nullptr) && idx < fIsotopeList->size()) return (*fIsotopeList)[idx];
184 return nullptr;
185}

Referenced by G4IonTable::PreloadNuclide().

◆ GetIsotopeByIsoLvl()

G4IsotopeProperty * G4NuclideTable::GetIsotopeByIsoLvl ( G4int Z,
G4int A,
G4int lvl = 0 )
overridevirtual

Reimplemented from G4VIsotopeTable.

Definition at line 155 of file G4NuclideTable.cc.

156{
157 if (lvl == 0) return GetIsotope(Z, A, 0.0);
158 return nullptr;
159}
G4IsotopeProperty * GetIsotope(G4int Z, G4int A, G4double E, G4Ions::G4FloatLevelBase flb=G4Ions::G4FloatLevelBase::no_Float) override

◆ GetLevelTolerance()

G4double G4NuclideTable::GetLevelTolerance ( )
inline

◆ GetMeanLifeThreshold()

G4double G4NuclideTable::GetMeanLifeThreshold ( )
inline

Definition at line 156 of file G4NuclideTable.hh.

157{
158 return mean_life_threshold;
159}

Referenced by G4RadioactiveDecay::StreamInfo().

◆ GetNuclideTable()

G4NuclideTable * G4NuclideTable::GetNuclideTable ( )
static

Definition at line 50 of file G4NuclideTable.cc.

51{
52 return GetInstance();
53}
static G4NuclideTable * GetInstance()

Referenced by G4IonTable::DestroyWorkerG4IonTable(), G4IonTable::PrepareNuclideTable(), and G4IonTable::~G4IonTable().

◆ GetSizeOfIsotopeList()

std::size_t G4NuclideTable::GetSizeOfIsotopeList ( )
inline

Definition at line 171 of file G4NuclideTable.hh.

172{
173 return (fIsotopeList != nullptr ? fIsotopeList->size() : static_cast<size_t>(0));
174}

◆ GetThresholdOfHalfLife()

G4double G4NuclideTable::GetThresholdOfHalfLife ( )
inline

Definition at line 151 of file G4NuclideTable.hh.

152{
153 return mean_life_threshold * 0.69314718;
154}

◆ GetTruncationError()

G4double G4NuclideTable::GetTruncationError ( G4double eex)
static

Definition at line 132 of file G4NuclideTable.cc.

133{
135 return eex - (G4long)(eex / tolerance) * tolerance;
136}
long G4long
Definition G4Types.hh:87
G4double GetLevelTolerance()

◆ operator=()

G4NuclideTable & G4NuclideTable::operator= ( const G4NuclideTable & )
delete

◆ Round()

G4double G4NuclideTable::Round ( G4double eex)
static

Definition at line 138 of file G4NuclideTable.cc.

139{
141 return round(eex / tolerance) * tolerance;
142}

◆ SetLevelTolerance()

void G4NuclideTable::SetLevelTolerance ( G4double x)
inline

Definition at line 161 of file G4NuclideTable.hh.

162{
163 flevelTolerance = x;
164}

Referenced by G4NuclideTableMessenger::SetNewValue().

◆ SetMeanLifeThreshold()

void G4NuclideTable::SetMeanLifeThreshold ( G4double t)

Definition at line 345 of file G4NuclideTable.cc.

346{
348 mean_life_threshold = t;
350 }
351}

Referenced by G4NuclideTableMessenger::SetNewValue().

◆ SetThresholdOfHalfLife()

void G4NuclideTable::SetThresholdOfHalfLife ( G4double t)

Definition at line 334 of file G4NuclideTable.cc.

335{
337 mean_life_threshold = t / 0.69314718;
339 }
340}

Referenced by G4NuclideTableMessenger::SetNewValue().

◆ Tolerance()

G4double G4NuclideTable::Tolerance ( )
static

Definition at line 150 of file G4NuclideTable.cc.

151{
153}

◆ Truncate()

G4long G4NuclideTable::Truncate ( G4double eex)
static

Definition at line 144 of file G4NuclideTable.cc.

145{
147 return (G4long)(eex / tolerance);
148}

The documentation for this class was generated from the following files: