Geant4 11.1.1
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

virtual ~G4NuclideTable ()
 
 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 ()
 
virtual G4IsotopePropertyGetIsotope (G4int Z, G4int A, G4double E, G4Ions::G4FloatLevelBase flb=G4Ions::G4FloatLevelBase::no_Float)
 
virtual G4IsotopePropertyGetIsotopeByIsoLvl (G4int Z, G4int A, G4int lvl=0)
 
std::size_t entries () const
 
G4IsotopePropertyGetIsotopeByIndex (std::size_t idx) const
 
- Public Member Functions inherited from G4VIsotopeTable
 G4VIsotopeTable ()
 
 G4VIsotopeTable (const G4String &)
 
 G4VIsotopeTable (const G4VIsotopeTable &)
 
G4VIsotopeTableoperator= (const G4VIsotopeTable &)
 
virtual ~G4VIsotopeTable ()
 
virtual G4IsotopePropertyGetIsotope (G4int Z, G4int A, G4double E, G4Ions::G4FloatLevelBase flb=G4Ions::G4FloatLevelBase::no_Float)=0
 
virtual G4IsotopePropertyGetIsotopeByIsoLvl (G4int Z, G4int A, G4int level=0)
 
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 56 of file G4NuclideTable.hh.

Constructor & Destructor Documentation

◆ ~G4NuclideTable()

G4NuclideTable::~G4NuclideTable ( )
virtual

Definition at line 69 of file G4NuclideTable.cc.

70{
71 for (auto it=map_pre_load_list.begin(); it!=map_pre_load_list.end(); ++it)
72 {
73 it->second.clear();
74 }
75 map_pre_load_list.clear();
76
77 for (auto it=map_full_list.begin(); it!=map_full_list.end(); ++it)
78 {
79 it->second.clear();
80 }
81 map_full_list.clear();
82
83 if (fIsotopeList != nullptr)
84 {
85 for (std::size_t i = 0 ; i<fIsotopeList->size(); ++i)
86 {
87 delete (*fIsotopeList)[i];
88 }
89 fIsotopeList->clear();
90 delete fIsotopeList;
91 fIsotopeList = nullptr;
92 }
93 delete fMessenger;
94}

◆ 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 305 of file G4NuclideTable.cc.

307{
309 {
310 G4int flbIndex = 0;
311 ionE = StripFloatLevelBase( ionE, flbIndex );
312 AddState(ionZ,ionA,ionE,flbIndex,ionLife,ionJ,ionMu);
313 }
314}
int G4int
Definition: G4Types.hh:85
void AddState(G4int, G4int, G4double, G4double, G4int ionJ=0, G4double ionMu=0.0)
G4bool IsMasterThread()
Definition: G4Threading.cc:124

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 317 of file G4NuclideTable.cc.

320{
322 {
323 if ( fUserDefinedList == nullptr ) fUserDefinedList = new G4IsotopeList();
324
325 G4IsotopeProperty* fProperty = new G4IsotopeProperty();
326
327 // Set Isotope Property
328 fProperty->SetAtomicNumber(ionZ);
329 fProperty->SetAtomicMass(ionA);
330 fProperty->SetIsomerLevel(9);
331 fProperty->SetEnergy(ionE);
332 fProperty->SetiSpin(ionJ);
333 fProperty->SetLifeTime(ionLife);
334 fProperty->SetDecayTable(nullptr);
335 fProperty->SetMagneticMoment(ionMu);
336 fProperty->SetFloatLevelBase(flbIndex);
337
338 fUserDefinedList->push_back(fProperty);
339 fIsotopeList->push_back(fProperty);
340 }
341}
void SetAtomicMass(G4int A)
void SetDecayTable(G4DecayTable *table)
void SetFloatLevelBase(G4Ions::G4FloatLevelBase flb)
void SetEnergy(G4double E)
void SetiSpin(G4int J)
void SetAtomicNumber(G4int Z)
void SetIsomerLevel(G4int level)
void SetLifeTime(G4double T)
void SetMagneticMoment(G4double M)
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 344 of file G4NuclideTable.cc.

347{
349 {
350 if ( fUserDefinedList == nullptr ) fUserDefinedList = new G4IsotopeList();
351
352 G4IsotopeProperty* fProperty = new G4IsotopeProperty();
353
354 // Set Isotope Property
355 fProperty->SetAtomicNumber(ionZ);
356 fProperty->SetAtomicMass(ionA);
357 fProperty->SetIsomerLevel(9);
358 fProperty->SetEnergy(ionE);
359 fProperty->SetiSpin(ionJ);
360 fProperty->SetLifeTime(ionLife);
361 fProperty->SetDecayTable(0);
362 fProperty->SetMagneticMoment(ionMu);
363 fProperty->SetFloatLevelBase(flb);
364
365 fUserDefinedList->push_back(fProperty);
366 fIsotopeList->push_back(fProperty);
367 }
368}

◆ entries()

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

Definition at line 178 of file G4NuclideTable.hh.

179{
180 return (fIsotopeList ? fIsotopeList->size() : std::size_t(0) );
181}

Referenced by G4IonTable::PreloadNuclide().

◆ GenerateNuclide()

void G4NuclideTable::GenerateNuclide ( )

Definition at line 186 of file G4NuclideTable.cc.

187{
188 if (mean_life_threshold < minimum_mean_life_threshold) {
189 // Need to update full list
190 const char* path = G4FindDataDir("G4ENSDFSTATEDATA");
191
192 if (path == nullptr) {
193 G4Exception("G4NuclideTable", "PART70000", FatalException,
194 "G4ENSDFSTATEDATA environment variable must be set");
195 return;
196 }
197
198 std::ifstream ifs;
199 G4String filename(path);
200 filename += "/ENSDFSTATE.dat";
201
202 ifs.open(filename.c_str() );
203 if (!ifs.good() ) {
204 G4Exception("G4NuclideTable", "PART70001", FatalException,
205 "ENSDFSTATE.dat is not found.");
206 return;
207 }
208
209 G4int ionCode = 0;
210 G4int iLevel = 0;
211 G4int ionZ;
212 G4int ionA;
213 G4double ionE;
214 G4String ionFL;
215 G4double ionLife;
216 G4int ionJ;
217 G4double ionMu;
218
219 // Lifetimes read from ENSDFSTATE are mean lives
220 ifs >> ionZ >> ionA >> ionE >> ionFL >> ionLife >> ionJ >> ionMu;
221
222 while (ifs.good() ) // Loop checking, 09.08.2015, K.Kurashige
223 {
224 if (ionCode != 1000*ionZ + ionA ) {
225 iLevel = 0;
226 ionCode = 1000*ionZ + ionA;
227 }
228
229 ionE *= keV;
230 G4Ions::G4FloatLevelBase flb = StripFloatLevelBase(ionFL);
231 ionLife *= ns;
232 ionMu *= (joule/tesla);
233
234 if ((ionE == 0 && flb == G4Ions::G4FloatLevelBase::no_Float) ||
235 (mean_life_threshold <= ionLife &&
236 ionLife < minimum_mean_life_threshold) ) {
237 if (ionE > 0) ++iLevel;
238 if (iLevel > 9) iLevel = 9;
239
240 G4IsotopeProperty* fProperty = new G4IsotopeProperty();
241
242 // Set Isotope Property
243 fProperty->SetAtomicNumber(ionZ);
244 fProperty->SetAtomicMass(ionA);
245 fProperty->SetIsomerLevel(iLevel);
246 fProperty->SetEnergy(ionE);
247 fProperty->SetiSpin(ionJ);
248 fProperty->SetLifeTime(ionLife);
249 fProperty->SetDecayTable(nullptr);
250 fProperty->SetMagneticMoment(ionMu);
251 fProperty->SetFloatLevelBase( flb );
252
253 fIsotopeList->push_back(fProperty);
254
255 auto itf = map_full_list.find(ionCode);
256 if (itf == map_full_list.cend() ) {
257 std::multimap<G4double, G4IsotopeProperty*> aMultiMap;
258 itf = (map_full_list.insert(
259 std::pair<G4int, std::multimap<G4double,
260 G4IsotopeProperty*> > (ionCode, aMultiMap) ) ).first;
261 }
262 itf->second.insert(
263 std::pair<G4double, G4IsotopeProperty*>(ionE, fProperty) );
264 }
265
266 ifs >> ionZ >> ionA >> ionE >> ionFL >> ionLife >> ionJ >> ionMu;
267 } // End while
268
269 minimum_mean_life_threshold = mean_life_threshold;
270 }
271
272 // Clear current map
273 for (auto it = map_pre_load_list.begin(); it != map_pre_load_list.end(); ++it) {
274 it->second.clear();
275 }
276 map_pre_load_list.clear();
277
278 // Build map based on current threshold value
279 for (auto it = map_full_list.cbegin(); it != map_full_list.cend(); ++it) {
280 G4int ionCode = it->first;
281 auto itf = map_pre_load_list.find(ionCode);
282 if (itf == map_pre_load_list.cend() ) {
283 std::multimap<G4double, G4IsotopeProperty*> aMultiMap;
284 itf = (map_pre_load_list.insert(
285 std::pair<G4int, std::multimap<G4double,
286 G4IsotopeProperty*> > (ionCode, aMultiMap) ) ).first;
287 }
288
289 G4int iLevel = 0;
290 for (auto itt = it->second.cbegin(); itt != it->second.cend(); ++itt) {
291 G4double exEnergy = itt->first;
292 G4double meanLife = itt->second->GetLifeTime();
293 if (exEnergy == 0.0 || meanLife > mean_life_threshold) {
294 if (itt->first != 0.0) ++iLevel;
295 if (iLevel > 9) iLevel = 9;
296 itt->second->SetIsomerLevel(iLevel);
297 itf->second.insert(
298 std::pair<G4double, G4IsotopeProperty*>(exEnergy, itt->second) );
299 }
300 }
301 }
302}
const char * G4FindDataDir(const char *)
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:59
double G4double
Definition: G4Types.hh:83
G4FloatLevelBase
Definition: G4Ions.hh:83
#define ns(x)
Definition: xmltok.c:1649

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

◆ GetInstance()

G4NuclideTable * G4NuclideTable::GetInstance ( )
static

◆ GetIsotope()

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

Implements G4VIsotopeTable.

Definition at line 97 of file G4NuclideTable.cc.

99{
100 G4IsotopeProperty* fProperty = nullptr;
101
102 // At first searching UserDefined
103 if ( fUserDefinedList )
104 {
105 for (auto it=fUserDefinedList->cbegin(); it!=fUserDefinedList->cend(); ++it)
106 {
107 if ( Z == (*it)->GetAtomicNumber() && A == (*it)->GetAtomicMass() )
108 {
109 G4double levelE = (*it)->GetEnergy();
110 if ( levelE - flevelTolerance/2 <= E && E < levelE + flevelTolerance/2 )
111 {
112 if( flb == (*it)->GetFloatLevelBase() ) { return *it; } //found
113 }
114 }
115 }
116 }
117
118 // Searching pre-load
119 // Note: isomer level is properly set only for pre_load_list
120 //
121 G4int ionCode = 1000*Z + A;
122 auto itf = map_pre_load_list.find( ionCode );
123
124 if ( itf != map_pre_load_list.cend() )
125 {
126 auto lower_bound_itr = itf -> second.lower_bound ( E - flevelTolerance/2 );
127 G4double levelE = DBL_MAX;
128
129 while ( lower_bound_itr != itf -> second.cend() )
130 {
131 levelE = lower_bound_itr->first;
132 if ( levelE - flevelTolerance/2 <= E && E < levelE + flevelTolerance/2 )
133 {
134 if ( flb == (lower_bound_itr->second)->GetFloatLevelBase() )
135 {
136 return lower_bound_itr->second; // found
137 }
138 }
139 else
140 {
141 break;
142 }
143 ++lower_bound_itr;
144 }
145 }
146
147 return fProperty; // not found
148}
const G4int Z[17]
const G4double A[17]
G4double GetEnergy() const
#define DBL_MAX
Definition: templates.hh:62

Referenced by GetIsotopeByIsoLvl().

◆ GetIsotopeByIndex()

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

Definition at line 184 of file G4NuclideTable.hh.

185{
186 if (fIsotopeList && idx<fIsotopeList->size() ) return (*fIsotopeList)[idx];
187 else return nullptr;
188}

Referenced by G4IonTable::PreloadNuclide().

◆ GetIsotopeByIsoLvl()

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

Reimplemented from G4VIsotopeTable.

Definition at line 179 of file G4NuclideTable.cc.

180{
181 if(lvl==0) return GetIsotope(Z,A,0.0);
182 return nullptr;
183}
virtual G4IsotopeProperty * GetIsotope(G4int Z, G4int A, G4double E, G4Ions::G4FloatLevelBase flb=G4Ions::G4FloatLevelBase::no_Float)

◆ GetLevelTolerance()

G4double G4NuclideTable::GetLevelTolerance ( )
inline

Definition at line 166 of file G4NuclideTable.hh.

167{
168 return flevelTolerance;
169}

Referenced by G4IonTable::FindIon(), G4IonTable::FindIonInMaster(), GetTruncationError(), Round(), Tolerance(), and Truncate().

◆ GetMeanLifeThreshold()

G4double G4NuclideTable::GetMeanLifeThreshold ( )
inline

Definition at line 154 of file G4NuclideTable.hh.

155{
156 return mean_life_threshold;
157}

◆ GetNuclideTable()

G4NuclideTable * G4NuclideTable::GetNuclideTable ( )
static

Definition at line 52 of file G4NuclideTable.cc.

53{
54 return GetInstance();
55}
static G4NuclideTable * GetInstance()

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

◆ GetSizeOfIsotopeList()

std::size_t G4NuclideTable::GetSizeOfIsotopeList ( )
inline

Definition at line 172 of file G4NuclideTable.hh.

173{
174 return (fIsotopeList ? fIsotopeList->size() : static_cast<size_t>(0) );
175}

◆ GetThresholdOfHalfLife()

G4double G4NuclideTable::GetThresholdOfHalfLife ( )
inline

Definition at line 148 of file G4NuclideTable.hh.

149{
150 return mean_life_threshold*0.69314718;
151}

◆ GetTruncationError()

G4double G4NuclideTable::GetTruncationError ( G4double  eex)
static

Definition at line 151 of file G4NuclideTable.cc.

152{
154 return eex - (G4long)(eex/tolerance)*tolerance;
155}
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 158 of file G4NuclideTable.cc.

159{
161 return round(eex/tolerance)*tolerance;
162}

◆ SetLevelTolerance()

void G4NuclideTable::SetLevelTolerance ( G4double  x)
inline

Definition at line 160 of file G4NuclideTable.hh.

161{
162 flevelTolerance = x;
163}

Referenced by G4NuclideTableMessenger::SetNewValue().

◆ SetMeanLifeThreshold()

void G4NuclideTable::SetMeanLifeThreshold ( G4double  t)

Definition at line 381 of file G4NuclideTable.cc.

382{
384 {
385 mean_life_threshold = t;
387 }
388}

Referenced by G4NuclideTableMessenger::SetNewValue().

◆ SetThresholdOfHalfLife()

void G4NuclideTable::SetThresholdOfHalfLife ( G4double  t)

Definition at line 371 of file G4NuclideTable.cc.

371 {
373 mean_life_threshold = t/0.69314718;
375 }
376}

Referenced by G4NuclideTableMessenger::SetNewValue().

◆ Tolerance()

G4double G4NuclideTable::Tolerance ( )
static

Definition at line 172 of file G4NuclideTable.cc.

173{
175}

◆ Truncate()

G4long G4NuclideTable::Truncate ( G4double  eex)
static

Definition at line 165 of file G4NuclideTable.cc.

166{
168 return (G4long)(eex/tolerance);
169}

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