Geant4 10.7.0
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 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 314 of file G4NuclideTable.cc.

316{
318 {
319 G4int flbIndex = 0;
320 ionE = StripFloatLevelBase( ionE, flbIndex );
321 AddState(ionZ,ionA,ionE,flbIndex,ionLife,ionJ,ionMu);
322 }
323}
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 326 of file G4NuclideTable.cc.

329{
331 {
332 if ( fUserDefinedList == nullptr ) fUserDefinedList = new G4IsotopeList();
333
334 G4IsotopeProperty* fProperty = new G4IsotopeProperty();
335
336 // Set Isotope Property
337 fProperty->SetAtomicNumber(ionZ);
338 fProperty->SetAtomicMass(ionA);
339 fProperty->SetIsomerLevel(9);
340 fProperty->SetEnergy(ionE);
341 fProperty->SetiSpin(ionJ);
342 fProperty->SetLifeTime(ionLife);
343 fProperty->SetDecayTable(nullptr);
344 fProperty->SetMagneticMoment(ionMu);
345 fProperty->SetFloatLevelBase(flbIndex);
346
347 fUserDefinedList->push_back(fProperty);
348 fIsotopeList->push_back(fProperty);
349 }
350}
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 353 of file G4NuclideTable.cc.

356{
358 {
359 if ( fUserDefinedList == nullptr ) fUserDefinedList = new G4IsotopeList();
360
361 G4IsotopeProperty* fProperty = new G4IsotopeProperty();
362
363 // Set Isotope Property
364 fProperty->SetAtomicNumber(ionZ);
365 fProperty->SetAtomicMass(ionA);
366 fProperty->SetIsomerLevel(9);
367 fProperty->SetEnergy(ionE);
368 fProperty->SetiSpin(ionJ);
369 fProperty->SetLifeTime(ionLife);
370 fProperty->SetDecayTable(0);
371 fProperty->SetMagneticMoment(ionMu);
372 fProperty->SetFloatLevelBase( flb );
373
374 fUserDefinedList->push_back(fProperty);
375 fIsotopeList->push_back(fProperty);
376 }
377}

◆ entries()

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

Definition at line 171 of file G4NuclideTable.hh.

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

Referenced by G4IonTable::PreloadNuclide().

◆ GenerateNuclide()

void G4NuclideTable::GenerateNuclide ( )

Definition at line 186 of file G4NuclideTable.cc.

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

Referenced by G4IonTable::PreloadNuclide(), 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}
double A(double temperature)
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 177 of file G4NuclideTable.hh.

178{
179 if ( fIsotopeList && idx<fIsotopeList->size()) return (*fIsotopeList)[idx];
180 else return nullptr;
181}

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 159 of file G4NuclideTable.hh.

160{
161 return flevelTolerance;
162}

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

◆ 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 165 of file G4NuclideTable.hh.

166{
167 return ( fIsotopeList ? fIsotopeList->size() : static_cast<size_t>(0) );
168}

◆ GetThresholdOfHalfLife()

G4double G4NuclideTable::GetThresholdOfHalfLife ( )
inline

Definition at line 147 of file G4NuclideTable.hh.

148{
149 return threshold_of_half_life;
150}

◆ 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 153 of file G4NuclideTable.hh.

154{
155 flevelTolerance = x;
156}

Referenced by G4NuclideTableMessenger::SetNewValue().

◆ SetThresholdOfHalfLife()

void G4NuclideTable::SetThresholdOfHalfLife ( G4double  t)

Definition at line 380 of file G4NuclideTable.cc.

381{
383 {
384 threshold_of_half_life=t;
386 }
387}

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: