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

#include <G4IonTable.hh>

Public Types

enum  { numberOfElements = 118 }
 
using G4IonList = std::multimap< G4int, const G4ParticleDefinition * >
 
using G4IonListIterator = std::multimap< G4int, const G4ParticleDefinition * >::iterator
 

Public Member Functions

 G4IonTable ()
 
 ~G4IonTable ()
 
 G4IonTable (const G4IonTable &)=delete
 
G4IonTableoperator= (const G4IonTable &)=delete
 
void WorkerG4IonTable ()
 
void DestroyWorkerG4IonTable ()
 
G4int GetNumberOfElements () const
 
void RegisterIsotopeTable (G4VIsotopeTable *table)
 
G4VIsotopeTableGetIsotopeTable (std::size_t idx=0) const
 
void CreateAllIon ()
 
void CreateAllIsomer ()
 
void PrepareNuclideTable ()
 
void PreloadNuclide ()
 
G4ParticleDefinitionGetIon (G4int Z, G4int A, G4int lvl=0)
 
G4ParticleDefinitionGetIon (G4int Z, G4int A, G4int L, G4int lvl)
 
G4ParticleDefinitionGetIon (G4int Z, G4int A, G4double E, G4int J=0)
 
G4ParticleDefinitionGetIon (G4int Z, G4int A, G4double E, G4Ions::G4FloatLevelBase flb, G4int J=0)
 
G4ParticleDefinitionGetIon (G4int Z, G4int A, G4double E, char flbChar, G4int J=0)
 
G4ParticleDefinitionGetIon (G4int Z, G4int A, G4int L, G4double E, G4int J=0)
 
G4ParticleDefinitionGetIon (G4int Z, G4int A, G4int L, G4double E, G4Ions::G4FloatLevelBase flb, G4int J=0)
 
G4ParticleDefinitionGetIon (G4int Z, G4int A, G4int L, G4double E, char flbChar, G4int J=0)
 
G4ParticleDefinitionGetIon (G4int encoding)
 
G4ParticleDefinitionFindIon (G4int Z, G4int A, G4int lvl=0)
 
G4ParticleDefinitionFindIon (G4int Z, G4int A, G4int L, G4int lvl)
 
G4ParticleDefinitionFindIon (G4int Z, G4int A, G4double E, G4int J=0)
 
G4ParticleDefinitionFindIon (G4int Z, G4int A, G4double E, G4Ions::G4FloatLevelBase flb, G4int J=0)
 
G4ParticleDefinitionFindIon (G4int Z, G4int A, G4double E, char flbChar, G4int J=0)
 
G4ParticleDefinitionFindIon (G4int Z, G4int A, G4int L, G4double E, G4int J=0)
 
G4ParticleDefinitionFindIon (G4int Z, G4int A, G4int L, G4double E, G4Ions::G4FloatLevelBase flb, G4int J=0)
 
G4ParticleDefinitionFindIon (G4int Z, G4int A, G4int L, G4double E, char flbChar, G4int J=0)
 
const G4StringGetIonName (G4int Z, G4int A, G4int lvl=0) const
 
const G4StringGetIonName (G4int Z, G4int A, G4double E, G4Ions::G4FloatLevelBase flb=G4Ions::G4FloatLevelBase::no_Float) const
 
const G4StringGetIonName (G4int Z, G4int A, G4int L, G4double E, G4Ions::G4FloatLevelBase flb=G4Ions::G4FloatLevelBase::no_Float) const
 
const G4StringGetIonName (G4int Z, G4int A, G4int L, G4int lvl) const
 
G4double GetIonMass (G4int Z, G4int A, G4int L=0, G4int lvl=0) const
 
G4double GetNucleusMass (G4int Z, G4int A, G4int L=0, G4int lvl=0) const
 
G4double GetIsomerMass (G4int Z, G4int A, G4int lvl=0) const
 
G4double GetLifeTime (const G4ParticleDefinition *) const
 
G4double GetLifeTime (G4int Z, G4int A, G4double E, G4Ions::G4FloatLevelBase flb=G4Ions::G4FloatLevelBase::no_Float) const
 
G4double GetLifeTime (G4int Z, G4int A, G4double E, char flbChar) const
 
G4ParticleDefinitionGetMuonicAtom (G4Ions const *)
 
G4ParticleDefinitionGetMuonicAtom (G4int Z, G4int A)
 
G4int Entries () const
 
G4ParticleDefinitionGetParticle (G4int index) const
 
G4bool Contains (const G4ParticleDefinition *particle) const
 
void Insert (const G4ParticleDefinition *particle)
 
void Remove (const G4ParticleDefinition *particle)
 
void clear ()
 
G4int size () const
 
void DumpTable (const G4String &particle_name="ALL") const
 
void InitializeLightIons ()
 

Static Public Member Functions

static G4IonTableGetIonTable ()
 
static G4bool IsIon (const G4ParticleDefinition *)
 
static G4bool IsAntiIon (const G4ParticleDefinition *)
 
static G4int GetNucleusEncoding (G4int Z, G4int A, G4double E=0.0, G4int lvl=0)
 
static G4int GetNucleusEncoding (G4int Z, G4int A, G4int L, G4double E=0.0, G4int lvl=0)
 
static G4bool GetNucleusByEncoding (G4int encoding, G4int &Z, G4int &A, G4double &E, G4int &lvl)
 
static G4bool GetNucleusByEncoding (G4int encoding, G4int &Z, G4int &A, G4int &L, G4double &E, G4int &lvl)
 

Static Public Attributes

static G4ThreadLocal G4IonListfIonList = nullptr
 
static G4ThreadLocal std::vector< G4VIsotopeTable * > * fIsotopeTableList = nullptr
 
static G4IonListfIonListShadow = nullptr
 
static std::vector< G4VIsotopeTable * > * fIsotopeTableListShadow = nullptr
 
static const G4String elementName [numberOfElements]
 

Protected Member Functions

G4ParticleDefinitionFindIonInMaster (G4int Z, G4int A, G4int lvl=0)
 
G4ParticleDefinitionFindIonInMaster (G4int Z, G4int A, G4int L, G4int lvl)
 
G4ParticleDefinitionFindIonInMaster (G4int Z, G4int A, G4double E, G4Ions::G4FloatLevelBase flb, G4int J=0)
 
G4ParticleDefinitionFindIonInMaster (G4int Z, G4int A, G4int L, G4double E, G4Ions::G4FloatLevelBase flb, G4int J=0)
 
G4ParticleDefinitionCreateIon (G4int Z, G4int A, G4double E, G4Ions::G4FloatLevelBase flb)
 
G4ParticleDefinitionCreateIon (G4int Z, G4int A, G4int L, G4double E, G4Ions::G4FloatLevelBase flb)
 
G4ParticleDefinitionCreateIon (G4int Z, G4int A, G4int lvl=0)
 
G4ParticleDefinitionCreateIon (G4int Z, G4int A, G4int L, G4int lvl)
 
void InsertWorker (const G4ParticleDefinition *particle)
 
G4IsotopePropertyFindIsotope (G4int Z, G4int A, G4double E, G4Ions::G4FloatLevelBase flb) const
 
G4IsotopePropertyFindIsotope (G4int Z, G4int A, G4int lvl) const
 
G4ParticleDefinitionGetLightIon (G4int Z, G4int A) const
 
G4ParticleDefinitionGetLightAntiIon (G4int Z, G4int A) const
 
G4bool IsLightIon (const G4ParticleDefinition *) const
 
G4bool IsLightAntiIon (const G4ParticleDefinition *) const
 
void AddProcessManager (G4ParticleDefinition *)
 
G4int GetVerboseLevel () const
 

Detailed Description

Definition at line 52 of file G4IonTable.hh.

Member Typedef Documentation

◆ G4IonList

using G4IonTable::G4IonList = std::multimap<G4int, const G4ParticleDefinition*>

Definition at line 56 of file G4IonTable.hh.

◆ G4IonListIterator

using G4IonTable::G4IonListIterator = std::multimap<G4int, const G4ParticleDefinition*>::iterator

Definition at line 58 of file G4IonTable.hh.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
numberOfElements 

Definition at line 263 of file G4IonTable.hh.

263{ numberOfElements = 118};
@ numberOfElements
Definition: G4IonTable.hh:263

Constructor & Destructor Documentation

◆ G4IonTable() [1/2]

G4IonTable::G4IonTable ( )

Definition at line 113 of file G4IonTable.cc.

114{
115 fIonList = new G4IonList();
116
117 // Set up the shadow pointer used by worker threads.
118 //
119 if (fIonListShadow == nullptr)
120 {
122 }
123
124 fIsotopeTableList = new std::vector<G4VIsotopeTable*>;
125
126 // Set up the shadow pointer used by worker threads.
127 //
128 if (fIsotopeTableListShadow == nullptr)
129 {
131 }
132
134 RegisterIsotopeTable(pNuclideTable);
135}
static G4ThreadLocal std::vector< G4VIsotopeTable * > * fIsotopeTableList
Definition: G4IonTable.hh:253
void PrepareNuclideTable()
Definition: G4IonTable.cc:1875
static G4IonList * fIonListShadow
Definition: G4IonTable.hh:254
std::multimap< G4int, const G4ParticleDefinition * > G4IonList
Definition: G4IonTable.hh:57
static std::vector< G4VIsotopeTable * > * fIsotopeTableListShadow
Definition: G4IonTable.hh:255
static G4ThreadLocal G4IonList * fIonList
Definition: G4IonTable.hh:252
void RegisterIsotopeTable(G4VIsotopeTable *table)
Definition: G4IonTable.cc:1786

◆ ~G4IonTable()

G4IonTable::~G4IonTable ( )

Definition at line 140 of file G4IonTable.cc.

141{
142 // delete IsotopeTable if existing
143 if (fIsotopeTableList != nullptr )
144 {
145 for (std::size_t i=0; i<fIsotopeTableList->size(); ++i)
146 {
147 G4VIsotopeTable* fIsotopeTable= (*fIsotopeTableList)[i];
148 if( fIsotopeTable != G4NuclideTable::GetNuclideTable() )
149 {
150 delete fIsotopeTable;
151 }
152 }
153 fIsotopeTableList->clear();
154 delete fIsotopeTableList;
155 }
156 fIsotopeTableList = nullptr;
157
158 if (fIonList == nullptr) return;
159
160 // remove all contents in the Ion List
161 // No need to delete here because all particles are dynamic objects
162 fIonList->clear();
163 delete fIonList;
164 fIonList = nullptr;
165}
static G4NuclideTable * GetNuclideTable()

◆ G4IonTable() [2/2]

G4IonTable::G4IonTable ( const G4IonTable )
delete

Member Function Documentation

◆ AddProcessManager()

void G4IonTable::AddProcessManager ( G4ParticleDefinition ion)
protected

Definition at line 1711 of file G4IonTable.cc.

1712{
1713 if(ion->IsGeneralIon())
1714 {
1715 // Check whether GenericIon has processes
1716 G4ParticleDefinition* genericIon =
1718
1719 G4ProcessManager* pman = nullptr;
1720 if (genericIon != nullptr) pman = genericIon->GetProcessManager();
1721 if ((genericIon == nullptr) || (genericIon->GetParticleDefinitionID() < 0)
1722 || (pman==nullptr))
1723 {
1724 G4String msg = "G4IonTable::AddProcessManager(): cannot create ion of ";
1725 msg += ion->GetParticleName();
1726 msg += "\n because GenericIon is not available!!";
1727 G4Exception("G4IonTable::AddProcessManager()", "PART105",
1728 FatalException, msg);
1729 return;
1730 }
1731
1733 }
1734 else
1735 {
1736 // Is this a MuonicAtom ?
1737 G4MuonicAtom* muatom = dynamic_cast<G4MuonicAtom*> (ion);
1738
1739 if ( muatom != nullptr )
1740 {
1741#ifdef G4VERBOSE
1742 if (GetVerboseLevel()>1)
1743 {
1744 G4cout << "G4IonTable::AddProcessManager(): "
1745 << "MuonicAtom dynamic_cast succeeded for "
1746 << ion->GetParticleName() << G4endl;
1747 }
1748#endif
1749 // Check whether GenericMuonicAtom has processes
1750 G4ParticleDefinition* genericMA =
1752
1753 G4ProcessManager* pman = nullptr;
1754 if (genericMA != nullptr) pman = genericMA->GetProcessManager();
1755 if ((genericMA == nullptr) || (genericMA->GetParticleDefinitionID() < 0)
1756 || (pman==nullptr))
1757 {
1758 G4String msg =
1759 "G4IonTable::AddProcessManager(): cannot create MuonicAtom ";
1760 msg += ion->GetParticleName();
1761 msg += "\n because GenericMuonicAtom is not available!!";
1762 G4Exception("G4IonTable::AddProcessManager()",
1763 "PART106", FatalException, msg);
1764 return;
1765 }
1766
1768 }
1769 else
1770 {
1771 G4String msg =
1772 "G4IonTable::AddProcessManager(): cannot create ";
1773 msg += ion->GetParticleName();
1774 msg += "\n because of unsupported particle type !!";
1775 G4Exception("G4IonTable::AddProcessManager()", "PART107",
1776 FatalException, msg);
1777 return;
1778 }
1779 }
1780 return;
1781}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
G4int GetVerboseLevel() const
Definition: G4IonTable.cc:1703
G4ProcessManager * GetProcessManager() const
G4bool IsGeneralIon() const
void SetParticleDefinitionID(G4int id=-1)
G4int GetParticleDefinitionID() const
const G4String & GetParticleName() const
G4ParticleDefinition * GetGenericMuonicAtom() const
static G4ParticleTable * GetParticleTable()
G4ParticleDefinition * GetGenericIon() const

Referenced by CreateIon(), and GetMuonicAtom().

◆ clear()

void G4IonTable::clear ( )

Definition at line 1526 of file G4IonTable.cc.

1527{
1528 if (G4ParticleTable::GetParticleTable()->GetReadiness())
1529 {
1530 G4Exception("G4IonTable::clear()",
1531 "PART116", JustWarning,
1532 "No effects because readyToUse is true.");
1533 return;
1534 }
1535
1536#ifdef G4VERBOSE
1537 if (GetVerboseLevel()>2)
1538 {
1539 G4cout << "G4IonTable::Clear() : number of Ion registered = ";
1540 G4cout << fIonList->size() << G4endl;
1541 }
1542#endif
1543 fIonList->clear();
1544}
@ JustWarning

Referenced by G4ParticleTable::RemoveAllParticles().

◆ Contains()

G4bool G4IonTable::Contains ( const G4ParticleDefinition particle) const

Definition at line 1935 of file G4IonTable.cc.

1936{
1937 if (!IsIon(particle)) return false;
1938
1939 G4int Z = particle->GetAtomicNumber();
1940 G4int A = particle->GetAtomicMass();
1941 G4int LL = particle->GetQuarkContent(3); //strangeness
1943 G4bool found = false;
1944 if (encoding != 0 )
1945 {
1946 for(auto i = fIonListShadow->find(encoding);
1947 i != fIonListShadow->cend(); ++i)
1948 {
1949 if (particle == i->second )
1950 {
1951 found = true;
1952 break;
1953 }
1954 }
1955 }
1956 return found;
1957}
double A(double temperature)
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
static G4bool IsIon(const G4ParticleDefinition *)
Definition: G4IonTable.cc:1302
static G4int GetNucleusEncoding(G4int Z, G4int A, G4double E=0.0, G4int lvl=0)
Definition: G4IonTable.cc:1055
G4int GetAtomicNumber() const
G4int GetAtomicMass() const
G4int GetQuarkContent(G4int flavor) const

Referenced by Insert().

◆ CreateAllIon()

void G4IonTable::CreateAllIon ( )

Definition at line 1859 of file G4IonTable.cc.

1860{
1862}
void PreloadNuclide()
Definition: G4IonTable.cc:1884

Referenced by G4ParticleMessenger::SetNewValue().

◆ CreateAllIsomer()

void G4IonTable::CreateAllIsomer ( )

Definition at line 1867 of file G4IonTable.cc.

1868{
1870}

Referenced by G4ParticleMessenger::SetNewValue().

◆ CreateIon() [1/4]

G4ParticleDefinition * G4IonTable::CreateIon ( G4int  Z,
G4int  A,
G4double  E,
G4Ions::G4FloatLevelBase  flb 
)
protected

Definition at line 245 of file G4IonTable.cc.

247{
248 G4ParticleDefinition* ion = nullptr;
249
250 // check whether GenericIon has processes
251 G4ParticleDefinition* genericIon =
253 G4ProcessManager* pman = nullptr;
254 if (genericIon!= nullptr) { pman = genericIon->GetProcessManager(); }
255 if ((genericIon == nullptr) || (genericIon->GetParticleDefinitionID() < 0)
256 || (pman==nullptr))
257 {
258#ifdef G4VERBOSE
259 if (GetVerboseLevel()>1)
260 {
261 G4cout << "G4IonTable::CreateIon() : can not create ion of "
262 << " Z =" << Z << " A = " << A
263 << " because GenericIon is not ready !!" << G4endl;
264 }
265#endif
266 G4Exception( "G4IonTable::CreateIon()", "PART105", JustWarning,
267 "Can not create ions because GenericIon is not ready");
268 return nullptr;
269 }
270
271 G4double life = 0.0;
272 G4DecayTable* decayTable = nullptr;
273 G4bool stable = true;
274 G4double mu = 0.0;
275 G4double Eex = 0.0;
276 G4int lvl = 0;
277 G4int J = 0;
278
279 const G4IsotopeProperty* fProperty = FindIsotope(Z, A, E, flb);
280 if (fProperty != nullptr )
281 {
282 Eex = fProperty->GetEnergy();
283 lvl = fProperty->GetIsomerLevel();
284 J = fProperty->GetiSpin();
285 life = fProperty->GetLifeTime();
286 mu = fProperty->GetMagneticMoment();
287 decayTable = fProperty->GetDecayTable();
288 stable = (life <= 0.) || (decayTable == nullptr);
289 lvl = fProperty->GetIsomerLevel();
290 if (lvl <0) lvl=9;
291 }
292 else
293 {
294#ifdef G4VERBOSE
295 if (GetVerboseLevel()>1)
296 {
298 ed << "G4IonTable::CreateIon(): G4IsotopeProperty object is not found for"
299 << " Z = " << Z << " A = " << A << " E = " << E/keV << " (keV)";
301 {
302 ed << " FloatingLevel +" << G4Ions::FloatLevelBaseChar(flb);
303 }
304 ed << ".\n"
305 << " Physics quantities such as life are not set for this ion.";
306 G4Exception( "G4IonTable::CreateIon()","PART70105", JustWarning, ed);
307 }
308#endif
309 // excitation energy
310 Eex = E;
311 // lvl is assigned to 9 temporarily
312 if (Eex>0.0) lvl=9;
313 }
314
315 // Eex = G4NuclideTable::Round(Eex);
316 if (Eex==0.0) lvl=0;
317 // ion name
318 G4String name ="";
319 /////////////if (lvl<9) name = GetIonName(Z, A, lvl);
320 if (lvl==0 && flb==G4Ions::G4FloatLevelBase::no_Float)
321 name = GetIonName(Z, A, lvl);
322 else
323 name = GetIonName(Z, A, Eex, flb);
324
325 // PDG encoding
326 G4int encoding = GetNucleusEncoding(Z,A,E,lvl);
327
328 // PDG mass
329 G4double mass = GetNucleusMass(Z, A)+ Eex;
330
331 // PDG charge is set to one of nucleus
332 G4double charge = G4double(Z)*eplus;
333
334 // create an ion
335 // spin, parity, isospin values are fixed
336
337 // Request lock for particle table accesses. Some changes are inside
338 // this critical region.
339 //
340 ion = new G4Ions( name, mass, 0.0*MeV, charge,
341 J, +1, 0,
342 0, 0, 0,
343 "nucleus", 0, A, encoding,
344 stable, life, decayTable, false,
345 "generic", 0,
346 Eex, lvl );
347
348 // Release lock for particle table accesses.
349 //
350 ion->SetPDGMagneticMoment(mu);
351 static_cast<G4Ions*>(ion)->SetFloatLevelBase(flb);
352
353 // No Anti particle registered
354 ion->SetAntiPDGEncoding(0);
355
356#ifdef G4VERBOSE
357 if (GetVerboseLevel()>1)
358 {
359 G4cout << "G4IonTable::CreateIon() : create ion of " << name
360 << " " << Z << ", " << A
361 << " encoding=" << encoding;
362 if (E>0.0)
363 {
364 G4cout << " IsomerLVL=" << lvl
365 << " excited energy=" << Eex/keV << "[keV]";
366 }
367 G4cout << G4endl;
368 }
369#endif
370
371 // Add process manager to the ion
373
374#ifdef G4MULTITHREADED
375 // Fill decay channels if this method is invoked from worker
377 {
378 if(!stable && decayTable)
379 {
380 G4int nCh = decayTable->entries();
381 for(G4int iCh=0; iCh<nCh; ++iCh)
382 {
383 decayTable->GetDecayChannel(iCh)->GetDaughter(0);
384 }
385 }
386 }
387#endif
388
389 return ion;
390}
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40
double G4double
Definition: G4Types.hh:83
G4VDecayChannel * GetDecayChannel(G4int index) const
G4int entries() const
const G4String & GetIonName(G4int Z, G4int A, G4int lvl=0) const
Definition: G4IonTable.cc:1229
G4double GetNucleusMass(G4int Z, G4int A, G4int L=0, G4int lvl=0) const
Definition: G4IonTable.cc:1435
void AddProcessManager(G4ParticleDefinition *)
Definition: G4IonTable.cc:1711
G4IsotopeProperty * FindIsotope(G4int Z, G4int A, G4double E, G4Ions::G4FloatLevelBase flb) const
Definition: G4IonTable.cc:1815
Definition: G4Ions.hh:52
static char FloatLevelBaseChar(G4Ions::G4FloatLevelBase flb)
Definition: G4Ions.cc:165
G4int GetiSpin() const
G4DecayTable * GetDecayTable() const
G4double GetEnergy() const
G4int GetIsomerLevel() const
G4double GetLifeTime() const
G4double GetMagneticMoment() const
void SetPDGMagneticMoment(G4double mageticMoment)
void SetAntiPDGEncoding(G4int aEncoding)
G4ParticleDefinition * GetDaughter(G4int anIndex)
const char * name(G4int ptype)
G4bool IsWorkerThread()
Definition: G4Threading.cc:123
#define encoding
Definition: xmlparse.cc:605

Referenced by CreateIon(), and GetIon().

◆ CreateIon() [2/4]

G4ParticleDefinition * G4IonTable::CreateIon ( G4int  Z,
G4int  A,
G4int  L,
G4double  E,
G4Ions::G4FloatLevelBase  flb 
)
protected

Definition at line 396 of file G4IonTable.cc.

398{
399 if (LL==0) return CreateIon(Z,A,E,flb);
400
401 // create hyper nucleus
402 G4ParticleDefinition* ion = nullptr;
403
404 // check whether GenericIon has processes
405 G4ParticleDefinition* genericIon =
407 G4ProcessManager* pman = nullptr;
408 if (genericIon != nullptr) pman = genericIon->GetProcessManager();
409 if ((genericIon == nullptr) || (genericIon->GetParticleDefinitionID() < 0)
410 || (pman==nullptr))
411 {
412#ifdef G4VERBOSE
413 if (GetVerboseLevel()>1)
414 {
415 G4cout << "G4IonTable::CreateIon() : can not create ion of "
416 << " Z =" << Z << " A = " << A
417 << " because GenericIon is not ready !!" << G4endl;
418 }
419#endif
420 G4Exception( "G4IonTable::CreateIon()","PART105", JustWarning,
421 "Can not create ions because GenericIon is not ready");
422 return nullptr;
423 }
424
425 G4int J = 0;
426 G4double life = 0.0;
427 G4DecayTable* decayTable = nullptr;
428 G4bool stable = true;
429
430 // excitation energy
431 // G4double Eex = G4NuclideTable::Round(E);
432 G4double Eex = E;
433 G4double mass = GetNucleusMass(Z, A, LL)+ Eex;
434 G4int lvl = 0;
435 // lvl is assigned to 9 temporarily
436 if (Eex>0.0) lvl=9;
437
438 // PDG encoding
439 G4int encoding = GetNucleusEncoding(Z,A,LL,E,lvl);
440
441 // PDG charge is set to one of nucleus
442 G4double charge = G4double(Z)*eplus;
443
444 // create an ion
445 // spin, parity, isospin values are fixed
446 //
447 // get ion name
448 G4String name = GetIonName(Z, A, LL, Eex, flb);
449
450 ion = new G4Ions( name, mass, 0.0*MeV, charge,
451 J, +1, 0,
452 0, 0, 0,
453 "nucleus", 0, A, encoding,
454 stable, life, decayTable, false,
455 "generic", 0,
456 Eex, lvl );
457
458 // Release lock for particle table accesses
459
460 G4double mu = 0.0; // magnetic moment
461 ion->SetPDGMagneticMoment(mu);
462 static_cast<G4Ions*>(ion)->SetFloatLevelBase(flb);
463
464 // No Anti particle registered
465 ion->SetAntiPDGEncoding(0);
466
467#ifdef G4VERBOSE
468 if (GetVerboseLevel()>1)
469 {
470 G4cout << "G4IonTable::CreateIon() : create hyper ion of " << name
471 << " " << Z << ", " << A << ", " << LL
472 << " encoding=" << encoding;
473 if (E>0.0)
474 {
475 G4cout << " IsomerLVL=" << lvl
476 << " excited energy=" << Eex/keV << "[keV]";
477 }
478 G4cout << G4endl;
479 }
480#endif
481
482 // Add process manager to the ion
484
485 return ion;
486}
G4ParticleDefinition * CreateIon(G4int Z, G4int A, G4double E, G4Ions::G4FloatLevelBase flb)
Definition: G4IonTable.cc:245

◆ CreateIon() [3/4]

G4ParticleDefinition * G4IonTable::CreateIon ( G4int  Z,
G4int  A,
G4int  L,
G4int  lvl 
)
protected

Definition at line 503 of file G4IonTable.cc.

504{
505 if (LL==0) return CreateIon(Z,A,lvl);
506 if(lvl == 0) return CreateIon(Z,A,0.0,G4Ions::G4FloatLevelBase::no_Float);
507
508 if (lvl>0)
509 {
511 ed << "Isomer level " << lvl << " is unknown for the isotope (Z="
512 << Z << ", A=" << A << ", L=" << LL << "). Null pointer is returned.";
513 G4Exception( "G4IonTable::GetIon()","PART106", JustWarning, ed);
514 return nullptr;
515 }
516 return nullptr;
517}

◆ CreateIon() [4/4]

G4ParticleDefinition * G4IonTable::CreateIon ( G4int  Z,
G4int  A,
G4int  lvl = 0 
)
protected

Definition at line 491 of file G4IonTable.cc.

492{
493 if(lvl == 0) return CreateIon(Z,A,0.0,G4Ions::G4FloatLevelBase::no_Float);
494 G4Exception( "G4IonTable::CreateIon()","PART105", JustWarning,
495 "Ion cannot be created by an isomer level. Use excitation energy.");
496 return nullptr;
497}

◆ DestroyWorkerG4IonTable()

void G4IonTable::DestroyWorkerG4IonTable ( )

Definition at line 214 of file G4IonTable.cc.

215{
216 // delete IsotopeTable if existing
217 if (fIsotopeTableList != nullptr )
218 {
219 for (std::size_t i=0; i<fIsotopeTableList->size(); ++i)
220 {
221 G4VIsotopeTable* fIsotopeTable= (*fIsotopeTableList)[i];
222 if( fIsotopeTable != G4NuclideTable::GetNuclideTable() )
223 {
224 delete fIsotopeTable;
225 }
226 }
227 fIsotopeTableList->clear();
228 delete fIsotopeTableList;
229 }
230 fIsotopeTableList = nullptr;
231
232
233 if (fIonList == nullptr) return;
234
235 // remove all contents in the Ion List
236 // No need to delete here because all particles are dynamic objects
237 fIonList->clear();
238 delete fIonList;
239 fIonList = nullptr;
240}

Referenced by G4ParticleTable::DestroyWorkerG4ParticleTable().

◆ DumpTable()

void G4IonTable::DumpTable ( const G4String particle_name = "ALL") const

Definition at line 1666 of file G4IonTable.cc.

1667{
1668 const G4ParticleDefinition* ion;
1669 for (auto idx = fIonList->cbegin(); idx!= fIonList->cend(); ++idx)
1670 {
1671 ion = idx->second;
1672 if (( particle_name == "ALL" ) || (particle_name == "all"))
1673 {
1674 ion->DumpTable();
1675 }
1676 else if ( particle_name == ion->GetParticleName() )
1677 {
1678 ion->DumpTable();
1679 }
1680 }
1681}

◆ Entries()

G4int G4IonTable::Entries ( ) const

Definition at line 1962 of file G4IonTable.cc.

1963{
1964 return fIonList->size();
1965}

Referenced by LBE::ConstructGeneral(), and GetParticle().

◆ FindIon() [1/8]

G4ParticleDefinition * G4IonTable::FindIon ( G4int  Z,
G4int  A,
G4double  E,
char  flbChar,
G4int  J = 0 
)

Definition at line 791 of file G4IonTable.cc.

792{
793 return FindIon(Z,A,E,G4Ions::FloatLevelBase(flbChar),J);
794}
G4ParticleDefinition * FindIon(G4int Z, G4int A, G4int lvl=0)
Definition: G4IonTable.cc:935
static G4Ions::G4FloatLevelBase FloatLevelBase(char flbChar)
Definition: G4Ions.cc:103

◆ FindIon() [2/8]

G4ParticleDefinition * G4IonTable::FindIon ( G4int  Z,
G4int  A,
G4double  E,
G4int  J = 0 
)

Definition at line 783 of file G4IonTable.cc.

784{
786}

◆ FindIon() [3/8]

G4ParticleDefinition * G4IonTable::FindIon ( G4int  Z,
G4int  A,
G4double  E,
G4Ions::G4FloatLevelBase  flb,
G4int  J = 0 
)

Definition at line 799 of file G4IonTable.cc.

801{
802 if ( (A<1) || (Z<=0) || (J<0) || (E<0.0) || (A>999) )
803 {
804#ifdef G4VERBOSE
805 if (GetVerboseLevel()>0)
806 {
807 G4cout << "G4IonTable::FindIon(): illegal atomic number/mass"
808 << " or excitation level:" << G4endl
809 << " Z =" << Z << " A = " << A << " E = " << E/keV << G4endl;
810 }
811#endif
812 G4Exception("G4IonTable::FindIon()","PART107",
813 JustWarning, "illegal atomic number/mass");
814 return nullptr;
815 }
816 // Search ions with A, Z ,E
817 // !! J is omitted now !!
818 const G4ParticleDefinition* ion = nullptr;
819 G4bool isFound = false;
820
821 // check if light ion
822 ion = GetLightIon(Z,A);
823 if (ion!= nullptr && E == 0.0)
824 {
825 // light ion
826 isFound = true;
827 }
828 else
829 {
830 // -- loop over all particles in Ion table
832 for(auto i = fIonList->find(encoding); i != fIonList->cend(); ++i)
833 {
834 ion = i->second;
835 if ( (ion->GetAtomicNumber() != Z) || (ion->GetAtomicMass()!=A) ) break;
836 // excitation level
837 G4double anExcitaionEnergy= ((const G4Ions*)(ion))->GetExcitationEnergy();
838 if (std::fabs(E - anExcitaionEnergy) < pNuclideTable->GetLevelTolerance())
839 {
840 if(((const G4Ions*)(ion))->GetFloatLevelBase()==flb)
841 {
842 isFound = true;
843 break;
844 }
845 }
846 }
847 }
848
849 if ( isFound )
850 {
851 return const_cast<G4ParticleDefinition*>(ion);
852 }
853 else
854 {
855 return nullptr;
856 }
857}
G4ParticleDefinition * GetLightIon(G4int Z, G4int A) const
Definition: G4IonTable.cc:1378
G4double GetLevelTolerance()

◆ FindIon() [4/8]

G4ParticleDefinition * G4IonTable::FindIon ( G4int  Z,
G4int  A,
G4int  L,
G4double  E,
char  flbChar,
G4int  J = 0 
)

Definition at line 870 of file G4IonTable.cc.

872{
873 return FindIon(Z,A,LL,E,G4Ions::FloatLevelBase(flbChar),J);
874}

◆ FindIon() [5/8]

G4ParticleDefinition * G4IonTable::FindIon ( G4int  Z,
G4int  A,
G4int  L,
G4double  E,
G4int  J = 0 
)

Definition at line 862 of file G4IonTable.cc.

863{
865}

◆ FindIon() [6/8]

G4ParticleDefinition * G4IonTable::FindIon ( G4int  Z,
G4int  A,
G4int  L,
G4double  E,
G4Ions::G4FloatLevelBase  flb,
G4int  J = 0 
)

Definition at line 879 of file G4IonTable.cc.

881{
882 if (LL==0) return FindIon(Z,A,E,flb,J);
883
884 if (A < 2 || Z < 0 || Z > A-LL || LL>A || A>999 )
885 {
886#ifdef G4VERBOSE
887 if (GetVerboseLevel()>0)
888 {
889 G4cout << "G4IonTable::FindIon(): illegal atomic number/mass"
890 << " or excitation level:" << G4endl
891 << " Z =" << Z << " A = " << A << " L = " << LL
892 <<" E = " << E/keV << G4endl;
893 }
894#endif
895 G4Exception("G4IonTable::FindIon()", "PART107",
896 JustWarning, "illegal atomic number/mass");
897 return nullptr;
898 }
899 // Search ions with A, Z ,E
900 // !! J is omitted now !!
901 const G4ParticleDefinition* ion = nullptr;
902 G4bool isFound = false;
903
904 // -- loop over all particles in Ion table
905 G4int encoding=GetNucleusEncoding(Z, A, LL, 0.0, 0);
906 for(auto i = fIonList->find(encoding); i != fIonList->cend() ; ++i)
907 {
908 ion = i->second;
909 if ( ( ion->GetAtomicNumber() != Z) || (ion->GetAtomicMass()!=A) ) break;
910 if( ion->GetQuarkContent(3) != LL ) break;
911 // excitation level
912 G4double anExcitaionEnergy = ((const G4Ions*)(ion))->GetExcitationEnergy();
913 if (std::fabs(E - anExcitaionEnergy) < pNuclideTable->GetLevelTolerance())
914 {
915 if(((const G4Ions*)(ion))->GetFloatLevelBase()==flb)
916 {
917 isFound = true;
918 break;
919 }
920 }
921 }
922
923 if ( isFound )
924 {
925 return const_cast<G4ParticleDefinition*>(ion);
926 }
927 else
928 {
929 return nullptr;
930 }
931}

◆ FindIon() [7/8]

G4ParticleDefinition * G4IonTable::FindIon ( G4int  Z,
G4int  A,
G4int  L,
G4int  lvl 
)

Definition at line 998 of file G4IonTable.cc.

999{
1000 if (LL==0) return FindIon(Z,A,lvl);
1001
1002 if (A < 2 || Z < 0 || Z > A-LL || LL>A || A>999 )
1003 {
1004#ifdef G4VERBOSE
1005 if (GetVerboseLevel()>0)
1006 {
1007 G4cout << "G4IonTable::FindIon(): illegal atomic number/mass"
1008 << " or excitation level:" << G4endl
1009 << " Z =" << Z << " A = " << A << " L = " << LL
1010 <<" IsomerLvl = " << lvl << G4endl;
1011 }
1012#endif
1013 G4Exception( "G4IonTable::FindIon()", "PART107",
1014 JustWarning, "illegal atomic number/mass");
1015 return nullptr;
1016 }
1017
1018 // Search ions with A, Z ,E, lvl
1019 const G4ParticleDefinition* ion = nullptr;
1020 G4bool isFound = false;
1021
1022 // -- loop over all particles in Ion table
1024 for(auto i = fIonList->find(encoding); i != fIonList->cend() ; ++i)
1025 {
1026 ion = i->second;
1027 if ( (ion->GetAtomicNumber() != Z) || (ion->GetAtomicMass()!=A) ) break;
1028 if ( ion->GetQuarkContent(3) != LL) break;
1029 // excitation level
1030 if ( ((const G4Ions*)(ion))->GetIsomerLevel() == lvl)
1031 {
1032 isFound = true;
1033 break;
1034 }
1035 }
1036
1037 if ( isFound )
1038 {
1039 if(lvl==9)
1040 {
1041 G4Exception("G4IonTable::FindIon()", "PART5107", JustWarning,
1042 "Isomer level 9 may be ambiguous.");
1043 }
1044 return const_cast<G4ParticleDefinition*>(ion);
1045 }
1046 else
1047 {
1048 return nullptr;
1049 }
1050}

◆ FindIon() [8/8]

G4ParticleDefinition * G4IonTable::FindIon ( G4int  Z,
G4int  A,
G4int  lvl = 0 
)

Definition at line 935 of file G4IonTable.cc.

936{
937 if ( (A<1) || (Z<=0) || (lvl<0) || (A>999) )
938 {
939#ifdef G4VERBOSE
940 if (GetVerboseLevel()>0)
941 {
942 G4cout << "G4IonTable::FindIon(): illegal atomic number/mass"
943 << " or excitation level:" << G4endl
944 << " Z =" << Z << " A = " << A << " IsoLvl = " << lvl << G4endl;
945 }
946#endif
947 G4Exception("G4IonTable::FindIon()", "PART107",
948 JustWarning, "illegal atomic number/mass");
949 return nullptr;
950 }
951 // Search ions with A, Z ,E
952 // !! J is omitted now !!
953 const G4ParticleDefinition* ion = nullptr;
954 G4bool isFound = false;
955
956 // check if light ion
957 ion = GetLightIon(Z,A);
958 if (ion != nullptr && lvl==0)
959 {
960 // light ion
961 isFound = true;
962 }
963 else
964 {
965 // -- loop over all particles in Ion table
967 for(auto i = fIonList->find(encoding); i != fIonList->cend(); ++i)
968 {
969 ion = i->second;
970 if ( (ion->GetAtomicNumber() != Z) || (ion->GetAtomicMass()!=A) ) break;
971 // excitation level
972 if ( ((const G4Ions*)(ion))->GetIsomerLevel() == lvl)
973 {
974 isFound = true;
975 break;
976 }
977 }
978 }
979
980 if ( isFound )
981 {
982 if(lvl==9)
983 {
984 G4Exception("G4IonTable::FindIon()","PART5107", JustWarning,
985 "Isomer level 9 may be ambiguous.");
986 }
987 return const_cast<G4ParticleDefinition*>(ion);
988 }
989 else
990 {
991 return nullptr;
992 }
993}

Referenced by FindIon(), FindIonInMaster(), and GetIon().

◆ FindIonInMaster() [1/4]

G4ParticleDefinition * G4IonTable::FindIonInMaster ( G4int  Z,
G4int  A,
G4double  E,
G4Ions::G4FloatLevelBase  flb,
G4int  J = 0 
)
protected

Definition at line 1979 of file G4IonTable.cc.

1981{
1982 // Search ions with A, Z ,E
1983 // !! J is omitted now !!
1984 const G4ParticleDefinition* ion = nullptr;
1985 G4bool isFound = false;
1986
1987 // -- loop over all particles in Ion table
1989 for(auto i = fIonListShadow->find(encoding); i != fIonListShadow->cend(); ++i)
1990 {
1991 ion = i->second;
1992 if ( ( ion->GetAtomicNumber() != Z) || (ion->GetAtomicMass()!=A) ) break;
1993 // excitation level
1994 G4double anExcitaionEnergy = ((const G4Ions*)(ion))->GetExcitationEnergy();
1995 if (std::fabs(E - anExcitaionEnergy) < pNuclideTable->GetLevelTolerance() )
1996 {
1997 if(((const G4Ions*)(ion))->GetFloatLevelBase()==flb)
1998 {
1999 isFound = true;
2000 break;
2001 }
2002 }
2003 }
2004
2005 if ( isFound )
2006 {
2007 return const_cast<G4ParticleDefinition*>(ion);
2008 }
2009 else
2010 {
2011 return nullptr;
2012 }
2013}

◆ FindIonInMaster() [2/4]

G4ParticleDefinition * G4IonTable::FindIonInMaster ( G4int  Z,
G4int  A,
G4int  L,
G4double  E,
G4Ions::G4FloatLevelBase  flb,
G4int  J = 0 
)
protected

Definition at line 2019 of file G4IonTable.cc.

2021{
2022 if (LL==0) return FindIon(Z,A,E,flb,J);
2023
2024 // Search ions with A, Z ,E
2025 // !! J is omitted now !!
2026 const G4ParticleDefinition* ion = nullptr;
2027 G4bool isFound = false;
2028
2029 // -- loop over all particles in Ion table
2030 G4int encoding = GetNucleusEncoding(Z, A, LL, 0.0, 0);
2031 for(auto i = fIonListShadow->find(encoding); i != fIonListShadow->cend(); ++i)
2032 {
2033 ion = i->second;
2034 if ( ( ion->GetAtomicNumber() != Z) || (ion->GetAtomicMass()!=A) ) break;
2035 if( ion->GetQuarkContent(3) != LL) break;
2036 // Excitation level
2037 G4double anExcitaionEnergy = ((const G4Ions*)(ion))->GetExcitationEnergy();
2038 if (std::fabs(E - anExcitaionEnergy) < pNuclideTable->GetLevelTolerance() )
2039 {
2040 if(((const G4Ions*)(ion))->GetFloatLevelBase()==flb)
2041 {
2042 isFound = true;
2043 break;
2044 }
2045 }
2046 }
2047
2048 if ( isFound )
2049 {
2050 return const_cast<G4ParticleDefinition*>(ion);
2051 }
2052 else
2053 {
2054 return nullptr;
2055 }
2056}

◆ FindIonInMaster() [3/4]

G4ParticleDefinition * G4IonTable::FindIonInMaster ( G4int  Z,
G4int  A,
G4int  L,
G4int  lvl 
)
protected

Definition at line 2096 of file G4IonTable.cc.

2097{
2098 if (LL==0) return FindIon(Z,A,lvl);
2099
2100 // Search ions with A, Z ,E, lvl
2101 const G4ParticleDefinition* ion = nullptr;
2102 G4bool isFound = false;
2103
2104 // -- loop over all particles in Ion table
2106 for(auto i = fIonListShadow->find(encoding); i != fIonListShadow->cend(); ++i)
2107 {
2108 ion = i->second;
2109 if ( ( ion->GetAtomicNumber() != Z) || (ion->GetAtomicMass()!=A) ) break;
2110 if ( ion->GetQuarkContent(3) != LL) break;
2111 // excitation level
2112 if ( ((const G4Ions*)(ion))->GetIsomerLevel() == lvl)
2113 {
2114 isFound = true;
2115 break;
2116 }
2117 }
2118
2119 if ( isFound )
2120 {
2121 return const_cast<G4ParticleDefinition*>(ion);
2122 }
2123 else
2124 {
2125 return nullptr;
2126 }
2127}

◆ FindIonInMaster() [4/4]

G4ParticleDefinition * G4IonTable::FindIonInMaster ( G4int  Z,
G4int  A,
G4int  lvl = 0 
)
protected

Definition at line 2061 of file G4IonTable.cc.

2062{
2063 // Search ions with A, Z ,E
2064 // !! J is omitted now !!
2065 const G4ParticleDefinition* ion = nullptr;
2066 G4bool isFound = false;
2067
2068 // -- loop over all particles in Ion table
2070 for(auto i = fIonListShadow->find(encoding); i != fIonListShadow->cend(); ++i)
2071 {
2072 ion = i->second;
2073 if ( ( ion->GetAtomicNumber() != Z) || (ion->GetAtomicMass()!=A) ) break;
2074 // Excitation level
2075 if ( ((const G4Ions*)(ion))->GetIsomerLevel() == lvl)
2076 {
2077 isFound = true;
2078 break;
2079 }
2080 }
2081
2082 if ( isFound )
2083 {
2084 return const_cast<G4ParticleDefinition*>(ion);
2085 }
2086 else
2087 {
2088 return nullptr;
2089 }
2090}

Referenced by GetIon().

◆ FindIsotope() [1/2]

G4IsotopeProperty * G4IonTable::FindIsotope ( G4int  Z,
G4int  A,
G4double  E,
G4Ions::G4FloatLevelBase  flb 
) const
protected

Definition at line 1815 of file G4IonTable.cc.

1817{
1818 if (fIsotopeTableList == nullptr) return nullptr;
1819 if (fIsotopeTableList->size() == 0) return nullptr;
1820
1821 G4IsotopeProperty* property = nullptr;
1822
1823 for (std::size_t i=0; i<fIsotopeTableList->size(); ++i)
1824 {
1825 G4VIsotopeTable* fIsotopeTable
1826 = (*fIsotopeTableList)[fIsotopeTableList->size()-i-1];
1827 property = fIsotopeTable->GetIsotope(Z,A,E,flb);
1828 if(property) break;
1829 }
1830
1831 return property;
1832}
virtual G4IsotopeProperty * GetIsotope(G4int Z, G4int A, G4double E, G4Ions::G4FloatLevelBase flb=G4Ions::G4FloatLevelBase::no_Float)=0

Referenced by CreateIon(), GetLifeTime(), and GetNucleusMass().

◆ FindIsotope() [2/2]

G4IsotopeProperty * G4IonTable::FindIsotope ( G4int  Z,
G4int  A,
G4int  lvl 
) const
protected

Definition at line 1837 of file G4IonTable.cc.

1838{
1839 if (fIsotopeTableList == nullptr) return nullptr;
1840 if (fIsotopeTableList->size()==0) return nullptr;
1841
1842 G4IsotopeProperty* property = nullptr;
1843
1844 // iterate
1845 for (std::size_t i=0; i<fIsotopeTableList->size(); ++i)
1846 {
1847 G4VIsotopeTable* fIsotopeTable
1848 = (*fIsotopeTableList)[fIsotopeTableList->size()-i-1];
1849 property = fIsotopeTable->GetIsotope(Z,A,lvl);
1850 if(property) break;
1851 }
1852
1853 return property;
1854}

◆ GetIon() [1/9]

G4ParticleDefinition * G4IonTable::GetIon ( G4int  encoding)

Definition at line 759 of file G4IonTable.cc.

760{
761 G4int Z, A, LL, IsoLvl;
762 G4double E;
763 if (!GetNucleusByEncoding(encoding,Z,A,LL,E,IsoLvl))
764 {
765#ifdef G4VERBOSE
766 if (GetVerboseLevel()>0)
767 {
768 G4cout << "G4IonTable::GetIon() : illegal encoding"
769 << " CODE:" << encoding << G4endl;
770 }
771#endif
772 G4Exception( "G4IonTable::GetIon()","PART106",
773 JustWarning, "illegal encoding for an ion");
774 return nullptr;
775 }
776 return GetIon( Z, A, LL, IsoLvl);
777}
static G4bool GetNucleusByEncoding(G4int encoding, G4int &Z, G4int &A, G4double &E, G4int &lvl)
Definition: G4IonTable.cc:1100
G4ParticleDefinition * GetIon(G4int Z, G4int A, G4int lvl=0)
Definition: G4IonTable.cc:522

◆ GetIon() [2/9]

G4ParticleDefinition * G4IonTable::GetIon ( G4int  Z,
G4int  A,
G4double  E,
char  flbChar,
G4int  J = 0 
)

Definition at line 632 of file G4IonTable.cc.

633{
634 return GetIon(Z,A,E,G4Ions::FloatLevelBase(flbChar),J);
635}

◆ GetIon() [3/9]

G4ParticleDefinition * G4IonTable::GetIon ( G4int  Z,
G4int  A,
G4double  E,
G4int  J = 0 
)

Definition at line 624 of file G4IonTable.cc.

625{
627}

◆ GetIon() [4/9]

G4ParticleDefinition * G4IonTable::GetIon ( G4int  Z,
G4int  A,
G4double  E,
G4Ions::G4FloatLevelBase  flb,
G4int  J = 0 
)

Definition at line 639 of file G4IonTable.cc.

641{
642 if ( (A<1) || (Z<=0) || (E<0.0) || (A>999) || (J<0) )
643 {
644#ifdef G4VERBOSE
645 if (GetVerboseLevel()>0)
646 {
647 G4cout << "G4IonTable::GetIon() : illegal atomic number/mass"
648 << " Z =" << Z << " A = " << A << " E = " << E/keV << G4endl;
649 }
650#endif
651 return nullptr;
652 }
653
654 // Search ions with A, Z
655 G4ParticleDefinition* ion = FindIon(Z,A,E,flb,J);
656
657 // create ion
658#ifdef G4MULTITHREADED
659 if(ion == nullptr )
660 {
662 {
663 G4MUTEXLOCK(&G4IonTable::ionTableMutex);
664 ion = FindIonInMaster(Z,A,E,flb,J);
665 if(ion == nullptr) ion = CreateIon(Z,A,E,flb);
666 InsertWorker(ion);
667 G4MUTEXUNLOCK(&G4IonTable::ionTableMutex);
668 }
669 else
670 {
671 ion = CreateIon(Z,A,E,flb);
672 }
673 }
674#else
675 if (ion == nullptr) ion = CreateIon(Z,A,E,flb);
676#endif
677
678 return ion;
679}
#define G4MUTEXLOCK(mutex)
Definition: G4Threading.hh:251
#define G4MUTEXUNLOCK(mutex)
Definition: G4Threading.hh:254
void InsertWorker(const G4ParticleDefinition *particle)
Definition: G4IonTable.cc:1565
G4ParticleDefinition * FindIonInMaster(G4int Z, G4int A, G4int lvl=0)
Definition: G4IonTable.cc:2061

◆ GetIon() [5/9]

G4ParticleDefinition * G4IonTable::GetIon ( G4int  Z,
G4int  A,
G4int  L,
G4double  E,
char  flbChar,
G4int  J = 0 
)

Definition at line 692 of file G4IonTable.cc.

694{
695 return GetIon(Z,A,LL,E,G4Ions::FloatLevelBase(flbChar),J);
696}

◆ GetIon() [6/9]

G4ParticleDefinition * G4IonTable::GetIon ( G4int  Z,
G4int  A,
G4int  L,
G4double  E,
G4int  J = 0 
)

Definition at line 684 of file G4IonTable.cc.

685{
686 return GetIon(Z,A,LL,E,G4Ions::G4FloatLevelBase::no_Float,J);
687}

◆ GetIon() [7/9]

G4ParticleDefinition * G4IonTable::GetIon ( G4int  Z,
G4int  A,
G4int  L,
G4double  E,
G4Ions::G4FloatLevelBase  flb,
G4int  J = 0 
)

Definition at line 701 of file G4IonTable.cc.

703{
704 if (LL==0) return GetIon(Z,A,E,flb,J);
705
706 if (A < 2 || Z < 0 || Z > A-LL || LL>A || A>999 )
707 {
708#ifdef G4VERBOSE
709 if (GetVerboseLevel()>0)
710 {
711 G4cout << "G4IonTable::GetIon() : illegal atomic number/mass"
712 << " Z =" << Z << " A = " << A << " L = " << LL
713 <<" E = " << E/keV << G4endl;
714 }
715#endif
716 return nullptr;
717 }
718 else if( A==2 )
719 {
720#ifdef G4VERBOSE
721 if (GetVerboseLevel()>0)
722 {
723 G4cout << "G4IonTable::GetIon() : No boud state for "
724 << " Z =" << Z << " A = " << A << " L = " << LL
725 << " E = " << E/keV << G4endl;
726 }
727#endif
728 return nullptr;
729 }
730
731 // Search ions with A, Z
732 G4ParticleDefinition* ion = FindIon(Z,A,LL,E,flb,J);
733
734 // create ion
735#ifdef G4MULTITHREADED
736 if(ion == nullptr ){
738 {
739 G4MUTEXLOCK(&G4IonTable::ionTableMutex);
740 ion = FindIonInMaster(Z,A,LL,E,flb,J);
741 if(ion == nullptr) ion = CreateIon(Z,A,LL,E,flb);
742 InsertWorker(ion);
743 G4MUTEXUNLOCK(&G4IonTable::ionTableMutex);
744 }
745 else
746 {
747 ion = CreateIon(Z,A,LL,E,flb);
748 }
749 }
750#else
751 if(ion == nullptr) ion = CreateIon(Z,A,LL,E,flb);
752#endif
753
754 return ion;
755}

◆ GetIon() [8/9]

G4ParticleDefinition * G4IonTable::GetIon ( G4int  Z,
G4int  A,
G4int  L,
G4int  lvl 
)

Definition at line 563 of file G4IonTable.cc.

564{
565 if (LL==0) return GetIon(Z,A,lvl);
566
567 if (A < 2 || Z < 0 || Z > A-LL || LL>A || A>999 )
568 {
569#ifdef G4VERBOSE
570 if (GetVerboseLevel()>0)
571 {
572 G4cout << "G4IonTable::GetIon() : illegal atomic number/mass"
573 << " Z =" << Z << " A = " << A << " L = " << LL
574 <<" IsomerLvl = " << lvl << G4endl;
575 }
576#endif
577 return nullptr;
578 }
579 else if( A==2 )
580 {
581#ifdef G4VERBOSE
582 if (GetVerboseLevel()>0)
583 {
584 G4cout << "G4IonTable::GetIon() : No boud state for "
585 << " Z =" << Z << " A = " << A << " L = " << LL
586 <<" IsomerLvl = " << lvl << G4endl;
587 }
588#endif
589 return nullptr;
590 }
591
592 // Search ions with A, Z
593 G4ParticleDefinition* ion = FindIon(Z,A,LL,lvl);
594
595 // create ion
596 if (ion == nullptr)
597 {
598 if (lvl==0)
599 {
600#ifdef G4MULTITHREADED
602 {
603 G4MUTEXLOCK(&G4IonTable::ionTableMutex);
604 ion = FindIonInMaster(Z,A,LL,lvl);
605 if(ion == nullptr) ion = CreateIon(Z, A, LL, lvl);
606 InsertWorker(ion);
607 G4MUTEXUNLOCK(&G4IonTable::ionTableMutex);
608 }
609 else
610 {
611 ion = CreateIon(Z, A, LL, lvl);
612 }
613#else
614 ion = CreateIon(Z, A, LL, lvl);
615#endif
616 }
617 }
618
619 return ion;
620}

◆ GetIon() [9/9]

G4ParticleDefinition * G4IonTable::GetIon ( G4int  Z,
G4int  A,
G4int  lvl = 0 
)

Definition at line 522 of file G4IonTable.cc.

523{
524 if ( (A<1) || (Z<=0) || (lvl<0) || (A>999) )
525 {
526#ifdef G4VERBOSE
527 if (GetVerboseLevel()>0)
528 {
529 G4cout << "G4IonTable::GetIon() : illegal atomic number/mass"
530 << " Z =" << Z << " A = " << A << " Lvl = " << lvl << G4endl;
531 }
532#endif
533 return nullptr;
534 }
535 if ( lvl == 0 ) return GetIon(Z,A,0.0);
536
537 // Search ions with A, Z, lvl
538 G4ParticleDefinition* ion = FindIon(Z,A,lvl);
539
540 // create ion
541#ifdef G4MULTITHREADED
542 if (ion == nullptr )
543 {
545 {
546 G4MUTEXLOCK(&G4IonTable::ionTableMutex);
547 ion = FindIonInMaster(Z,A,lvl);
548 if(ion != nullptr ) InsertWorker(ion);
549 G4MUTEXUNLOCK(&G4IonTable::ionTableMutex);
550 }
551 }
552#endif
553 if (ion == nullptr )
554 {
555 G4Exception( "G4IonTable::GetIon()","PART105", JustWarning,
556 "Ion cannot be created by an isomer level. Use excitation energy.");
557 }
558 return ion;
559}

Referenced by G4ParticleHPFinalState::adjust_final_state(), G4ParticleHPChannelList::ApplyYourself(), G4LENDElastic::ApplyYourself(), G4LENDFission::ApplyYourself(), G4LENDModel::ApplyYourself(), G4QMDReaction::ApplyYourself(), G4NeutronRadCapture::ApplyYourself(), G4ChargeExchange::ApplyYourself(), G4HadronElastic::ApplyYourself(), G4INCLXXInterface::ApplyYourself(), G4LMsdGenerator::ApplyYourself(), G4ParticleHPCaptureFS::ApplyYourself(), G4ParticleHPFissionFS::ApplyYourself(), G4ParticleHPInelasticBaseFS::BaseApply(), G4ExcitationHandler::BreakItUp(), G4Radioactivation::CalculateChainsFromParent(), G4RadioactiveDecay::CalculateChainsFromParent(), G4ParticleHPInelasticCompFS::CompositeApply(), G4DNARuddIonisationExtendedModel::CrossSectionPerVolume(), G4Radioactivation::DecayIt(), G4RadioactiveDecay::DecayIt(), G4ITDecay::DecayIt(), G4EmCalculator::FindIon(), G4AlphaDecay::G4AlphaDecay(), G4BetaMinusDecay::G4BetaMinusDecay(), G4BetaPlusDecay::G4BetaPlusDecay(), G4ECDecay::G4ECDecay(), G4ITDecay::G4ITDecay(), G4NeutronDecay::G4NeutronDecay(), G4ProtonDecay::G4ProtonDecay(), G4SFDecay::G4SFDecay(), G4TritonDecay::G4TritonDecay(), G4DiffuseElastic::GetInvCoulombElasticXsc(), G4NuclNuclDiffuseElastic::GetInvCoulombElasticXsc(), G4DiffuseElastic::GetInvElasticSumXsc(), G4NuclNuclDiffuseElastic::GetInvElasticSumXsc(), G4DiffuseElastic::GetInvElasticXsc(), G4NuclNuclDiffuseElastic::GetInvElasticXsc(), GetIon(), GetMuonicAtom(), G4FissionProductYieldDist::GetParticleDefinition(), G4DNARuddIonisationExtendedModel::Initialise(), G4InuclNuclei::makeDefinition(), PreloadNuclide(), G4ParticleHPIsotropic::Sample(), G4eSingleCoulombScatteringModel::SampleSecondaries(), G4IonCoulombScatteringModel::SampleSecondaries(), G4eCoulombScatteringModel::SampleSecondaries(), G4hCoulombScatteringModel::SampleSecondaries(), G4BetheHeitler5DModel::SampleSecondaries(), and G4QuasiElasticChannel::Scatter().

◆ GetIonMass()

◆ GetIonName() [1/4]

const G4String & G4IonTable::GetIonName ( G4int  Z,
G4int  A,
G4double  E,
G4Ions::G4FloatLevelBase  flb = G4Ions::G4FloatLevelBase::no_Float 
) const

Definition at line 1162 of file G4IonTable.cc.

1164{
1165 static G4ThreadLocal G4String* pname = nullptr;
1166 if ( pname == nullptr )
1167 {
1168 pname = new G4String("");
1170 }
1171 G4String& name = *pname;
1172
1173 static G4ThreadLocal std::ostringstream* os = nullptr;
1174 if ( os == nullptr )
1175 {
1176 os = new std::ostringstream();
1178 os->setf(std::ios::fixed);
1179 os->precision(3);
1180 }
1181
1182 name = GetIonName(Z, A);
1183
1184 // Excited energy
1185 if ( E>0 || flb!=G4Ions::G4FloatLevelBase::no_Float)
1186 {
1187 os->str("");
1188 std::ostringstream& oo = *os;
1189
1190 // Excited nucleus
1191 oo<<'['<<E/keV;
1193 {
1195 }
1196 oo<< ']';
1197 name += os->str();
1198 }
1199
1200 return name;
1201}
void Register(T *inst)
Definition: G4AutoDelete.hh:65
#define G4ThreadLocal
Definition: tls.hh:77

◆ GetIonName() [2/4]

const G4String & G4IonTable::GetIonName ( G4int  Z,
G4int  A,
G4int  L,
G4double  E,
G4Ions::G4FloatLevelBase  flb = G4Ions::G4FloatLevelBase::no_Float 
) const

Definition at line 1206 of file G4IonTable.cc.

1208{
1209 if (LL==0) return GetIonName(Z, A, E, flb);
1210 static G4ThreadLocal G4String* pname = nullptr;
1211 if (pname == nullptr)
1212 {
1213 pname = new G4String("");
1215 }
1216 G4String& name = *pname;
1217 name = "";
1218 for (G4int i=0; i<LL; ++i)
1219 {
1220 name +="L";
1221 }
1222 name += GetIonName(Z, A, E, flb);
1223 return name;
1224}

◆ GetIonName() [3/4]

const G4String & G4IonTable::GetIonName ( G4int  Z,
G4int  A,
G4int  L,
G4int  lvl 
) const

Definition at line 1281 of file G4IonTable.cc.

1282{
1283 if (LL==0) return GetIonName(Z, A, lvl);
1284 static G4ThreadLocal G4String* pname = nullptr;
1285 if ( pname == nullptr )
1286 {
1287 pname = new G4String("");
1289 }
1290 G4String &name = *pname;
1291 for (G4int i=0; i<LL; ++i)
1292 {
1293 name +="L";
1294 }
1295 name += GetIonName(Z, A, lvl);
1296 return name;
1297}

◆ GetIonName() [4/4]

const G4String & G4IonTable::GetIonName ( G4int  Z,
G4int  A,
G4int  lvl = 0 
) const

Definition at line 1229 of file G4IonTable.cc.

1230{
1231 static G4ThreadLocal G4String* pname = nullptr;
1232 if ( pname == nullptr )
1233 {
1234 pname = new G4String("");
1236 }
1237 G4String& name = *pname;
1238
1239 static G4ThreadLocal std::ostringstream* os = nullptr;
1240 if ( os == nullptr )
1241 {
1242 os = new std::ostringstream();
1244 os->setf(std::ios::fixed);
1245 }
1246
1247 if ( (0< Z) && (Z <=numberOfElements) )
1248 {
1249 name = elementName[Z-1];
1250 }
1251 else if (Z > numberOfElements)
1252 {
1253 os->str("");
1254 os->operator<<(Z);
1255 name = "E" + os->str() + "-";
1256 }
1257 else
1258 {
1259 name = "?";
1260 return name;
1261 }
1262 // Atomic Mass
1263 os->str("");
1264 os->operator<<(A);
1265
1266 if ( lvl>0 )
1267 {
1268 std::ostringstream& oo = *os;
1269 // Isomer level for Excited nucelus
1270 oo<<'['<<lvl << ']';
1271 }
1272 name += os->str();
1273
1274 return name;
1275}
static const G4String elementName[numberOfElements]
Definition: G4IonTable.hh:264

Referenced by G4INCLXXInterface::ApplyYourself(), CreateIon(), GetIonName(), G4LENDManager::GetLENDTarget(), and GetMuonicAtom().

◆ GetIonTable()

◆ GetIsomerMass()

G4double G4IonTable::GetIsomerMass ( G4int  Z,
G4int  A,
G4int  lvl = 0 
) const

Definition at line 1509 of file G4IonTable.cc.

1510{
1511 return GetNucleusMass(Z,A,0,lvl);
1512}

◆ GetIsotopeTable()

G4VIsotopeTable * G4IonTable::GetIsotopeTable ( std::size_t  idx = 0) const

Definition at line 1802 of file G4IonTable.cc.

1803{
1804 G4VIsotopeTable* fIsotopeTable = nullptr;
1805 if ( index < fIsotopeTableList->size() )
1806 {
1807 fIsotopeTable = (*fIsotopeTableList)[index];
1808 }
1809 return fIsotopeTable;
1810}
G4int size() const
Definition: G4IonTable.cc:1970

◆ GetLifeTime() [1/3]

G4double G4IonTable::GetLifeTime ( const G4ParticleDefinition particle) const

Definition at line 2132 of file G4IonTable.cc.

2133{
2134 if((particle->IsGeneralIon()) && (pNuclideTable == nullptr))
2135 {
2136 G4Exception("G4IonTable::GetLifeTime()", "ParticleIon1001", FatalException,
2137 "Method is invoked before G4IonTable is initialized.");
2138 return 0.;
2139 }
2140 return particle->GetPDGLifeTime();
2141}
G4double GetPDGLifeTime() const

Referenced by GetLifeTime().

◆ GetLifeTime() [2/3]

G4double G4IonTable::GetLifeTime ( G4int  Z,
G4int  A,
G4double  E,
char  flbChar 
) const

Definition at line 2147 of file G4IonTable.cc.

2148{
2149 return GetLifeTime(Z,A,E,G4Ions::FloatLevelBase(flbChar));
2150}
G4double GetLifeTime(const G4ParticleDefinition *) const
Definition: G4IonTable.cc:2132

◆ GetLifeTime() [3/3]

G4double G4IonTable::GetLifeTime ( G4int  Z,
G4int  A,
G4double  E,
G4Ions::G4FloatLevelBase  flb = G4Ions::G4FloatLevelBase::no_Float 
) const

Definition at line 2155 of file G4IonTable.cc.

2157{
2158 G4double life = -1001.0;
2159 const G4IsotopeProperty* fProperty = FindIsotope(Z, A, E, flb);
2160 if( fProperty != nullptr ) life = fProperty->GetLifeTime();
2161 return life;
2162}

◆ GetLightAntiIon()

G4ParticleDefinition * G4IonTable::GetLightAntiIon ( G4int  Z,
G4int  A 
) const
protected

Definition at line 1406 of file G4IonTable.cc.

1407{
1408 // Returns pointer to pre-defined ions
1409 const G4ParticleDefinition* ion = nullptr;
1410 if ( (Z<=2) )
1411 {
1412#ifndef G4MULTITHREADED
1413 // In sequential use lazy-initialization
1415#endif
1416 if ( (Z==1)&&(A==1) ) {
1417 ion = antilightions::p_proton;
1418 } else if ( (Z==1)&&(A==2) ) {
1419 ion = antilightions::p_deuteron;
1420 } else if ( (Z==1)&&(A==3) ) {
1421 ion = antilightions::p_triton;
1422 } else if ( (Z==2)&&(A==4) ) {
1423 ion = antilightions::p_alpha;
1424 } else if ( (Z==2)&&(A==3) ) {
1425 ion = antilightions::p_He3;
1426 }
1427 }
1428 return const_cast<G4ParticleDefinition*>(ion);
1429}

◆ GetLightIon()

G4ParticleDefinition * G4IonTable::GetLightIon ( G4int  Z,
G4int  A 
) const
protected

Definition at line 1378 of file G4IonTable.cc.

1379{
1380 // Returns pointer to pre-defined ions
1381 const G4ParticleDefinition* ion = nullptr;
1382 if ( (Z<=2) )
1383 {
1384#ifndef G4MULTITHREADED
1385 // In sequential use lazy-initialization
1387#endif
1388 if ( (Z==1)&&(A==1) ) {
1389 ion = lightions::p_proton;
1390 } else if ( (Z==1)&&(A==2) ) {
1391 ion = lightions::p_deuteron;
1392 } else if ( (Z==1)&&(A==3) ) {
1393 ion = lightions::p_triton;
1394 } else if ( (Z==2)&&(A==4) ) {
1395 ion = lightions::p_alpha;
1396 } else if ( (Z==2)&&(A==3) ) {
1397 ion = lightions::p_He3;
1398 }
1399 }
1400 return const_cast<G4ParticleDefinition*>(ion);
1401}
void Init()
Definition: G4IonTable.cc:77

Referenced by FindIon(), and GetNucleusMass().

◆ GetMuonicAtom() [1/2]

G4ParticleDefinition * G4IonTable::GetMuonicAtom ( G4int  Z,
G4int  A 
)

Definition at line 2261 of file G4IonTable.cc.

2262{
2263 // Need the cast because we need a G4Ions* to pass into the
2264 // function, but GetIon returns a G4ParticleDefinition*
2265 auto base = static_cast<G4Ions const*>(GetIon(Z,A, 0.0));
2266 return GetMuonicAtom(base);
2267}
G4ParticleDefinition * GetMuonicAtom(G4Ions const *)
Definition: G4IonTable.cc:2167

◆ GetMuonicAtom() [2/2]

G4ParticleDefinition * G4IonTable::GetMuonicAtom ( G4Ions const *  base)

Definition at line 2167 of file G4IonTable.cc.

2168{
2169 if (base==nullptr || !IsIon(base))
2170 {
2171 G4Exception("G4IonTable::GetMuonicAtom()", "PART987654321",
2172 FatalException, "Constructor argument is not a G4Ions");
2173 return nullptr;
2174 }
2175
2176 // We're assuming here that we get a base that is actually
2177 // constructed and unexcited ... strip excitations, Lambdas, and
2178 // isomers from the encoding
2179
2180 auto const Z = base->GetAtomicNumber();
2181 auto const A = base->GetAtomicMass();
2182 auto const baseenc = GetNucleusEncoding(Z,A);
2183 auto const encoding = baseenc+1000000000;
2184
2185 // We have to do all the MT manipulations manually, because the
2186 // convenience functions assume a G4Ions with canonical PDG codes;
2187 // they recalculate the encoding from particle properties rather
2188 // than using the carried member function values. Thus, they will
2189 // do operations on the base ion, rather than the passed in
2190 // G4MuonicAtom
2191
2192 auto i = fIonList->find(encoding);
2193 if(i!=fIonList->cend())
2194 {
2195 return const_cast<G4ParticleDefinition*>(i->second);
2196 }
2197 // not in threadlocal list; check global list ...
2198#ifdef G4MULTITHREADED
2200 {
2201 G4MUTEXLOCK(&G4IonTable::ionTableMutex);
2202 i = fIonListShadow->find(encoding);
2203 auto end = fIonListShadow->cend();
2204 G4MUTEXUNLOCK(&G4IonTable::ionTableMutex);
2205 if(i!=end)
2206 {
2207 // we found it, stuff it into the threadlocal list
2208 fIonList->insert(*i);
2209 // and then return it ...
2210 return const_cast<G4ParticleDefinition*>(i->second);
2211 }
2212 }
2213#endif
2214
2215 // not found in either list; create and potentially insert
2216 auto const name = "Mu"+GetIonName(Z,A);
2217
2218 G4MuonicAtom* muatom =
2220
2221 // Not sure this is doing the right thing...
2222 AddProcessManager(muatom);
2223
2224 // Now, we have to push the muatom into the appropriate IonTables
2225 // first, recheck global list, in case another thread came along
2226 // before us and created this same muatom
2227
2228#ifdef G4MULTITHREADED
2230 {
2231 G4MUTEXLOCK(&G4IonTable::ionTableMutex);
2232 // first, we need to make sure it hasn't been inserted by some
2233 // other thread
2234 auto j = fIonListShadow->find(encoding);
2235 if( j!= fIonListShadow->cend() )
2236 {
2237 // oops ... someone else built a copy when we weren't looking;
2238 // cleanup our instantiation, and take a handle to the one in
2239 // the global list
2240 delete muatom;
2241 muatom = const_cast<G4MuonicAtom*>
2242 (static_cast<G4MuonicAtom const*>(j->second));
2243 }
2244 else
2245 {
2246 // otherwise, push onto the global list first
2247 fIonListShadow->insert(std::make_pair(encoding, muatom));
2248 }
2249 G4MUTEXUNLOCK(&G4IonTable::ionTableMutex);
2250 }
2251#endif
2252 // in either case, push onto the the threadlocal list
2253 fIonList->insert(std::make_pair(encoding,muatom));
2254
2255 return muatom;
2256}
static G4MuonicAtom * ConstructMuonicAtom(const G4String &name, G4int encoding, G4Ions const *baseion)

Referenced by G4MuonMinusAtomicCapture::AtRestDoIt(), and GetMuonicAtom().

◆ GetNucleusByEncoding() [1/2]

G4bool G4IonTable::GetNucleusByEncoding ( G4int  encoding,
G4int Z,
G4int A,
G4double E,
G4int lvl 
)
static

Definition at line 1100 of file G4IonTable.cc.

1103{
1104 if (encoding <= 0) return false; // anti particle
1105
1106 if (encoding == 2212) // proton
1107 {
1108 Z = 1; A = 1;
1109 E = 0.0; lvl =0;
1110 return true;
1111 }
1112
1113 encoding -= 1000000000;
1114 Z = encoding/10000;
1115 encoding -= 10000*Z;
1116 A = encoding/10;
1117 lvl = encoding % 10;
1118 return true;
1119}

Referenced by GetIon().

◆ GetNucleusByEncoding() [2/2]

G4bool G4IonTable::GetNucleusByEncoding ( G4int  encoding,
G4int Z,
G4int A,
G4int L,
G4double E,
G4int lvl 
)
static

Definition at line 1124 of file G4IonTable.cc.

1128{
1129 if (encoding <= 0) return false; // anti particle
1130
1131 if (encoding == 3122) // Lambda
1132 {
1133 Z = 1; A = 1; LL = 1;
1134 E = 0.0; lvl =0;
1135 return true;
1136 }
1137
1138 if (encoding % 10 != 0)
1139 {
1140 // !!!not supported for excitation states !!!
1141 return false;
1142 }
1143 if (encoding < 1000000000)
1144 {
1145 // anti particle
1146 return false;
1147 }
1148
1149 encoding -= 1000000000;
1150 LL = encoding/10000000;
1151 encoding -= 10000000*LL;
1152 Z = encoding/10000;
1153 encoding -= 10000*Z;
1154 A = encoding/10;
1155 lvl = encoding % 10;
1156 return true;
1157}

◆ GetNucleusEncoding() [1/2]

G4int G4IonTable::GetNucleusEncoding ( G4int  Z,
G4int  A,
G4double  E = 0.0,
G4int  lvl = 0 
)
static

Definition at line 1055 of file G4IonTable.cc.

1056{
1057 // PDG code for Ions
1058 // Nuclear codes are given as 10-digit numbers +-100ZZZAAAI.
1059 // For a nucleus consisting of np protons and nn neutrons
1060 // A = np + nn and Z = np.
1061 // I gives the isomer level, with I = 0 corresponding
1062 // to the ground state and I >0 to excitations
1063
1064 if ( Z==1 && A==1 && E==0.0 ) return 2212; // proton
1065
1066 G4int encoding = 1000000000;
1067 encoding += Z * 10000;
1068 encoding += A *10;
1069 if (lvl>0&&lvl<10) encoding +=lvl; //isomer level
1070 else if (E>0.0) encoding += 9; //isomer level
1071
1072 return encoding;
1073}

Referenced by Contains(), CreateIon(), FindIon(), FindIonInMaster(), GetMuonicAtom(), G4LENDManager::GetNucleusEncoding(), GetNucleusEncoding(), GetNucleusMass(), Insert(), InsertWorker(), G4InuclNuclei::makeNuclearFragment(), and Remove().

◆ GetNucleusEncoding() [2/2]

G4int G4IonTable::GetNucleusEncoding ( G4int  Z,
G4int  A,
G4int  L,
G4double  E = 0.0,
G4int  lvl = 0 
)
static

Definition at line 1078 of file G4IonTable.cc.

1080{
1081 // Get PDG code for Hyper-Nucleus Ions
1082 // Nuclear codes are given as 10-digit numbers +-10LZZZAAAI.
1083 // For a nucleus consisting of np protons and nn neutrons
1084 // A = np + nn +nlambda and Z = np.
1085 // LL = nlambda
1086 // I gives the isomer level, with I = 0 corresponding
1087 // to the ground state and I >0 to excitations
1088
1089 G4int encoding = GetNucleusEncoding(Z, A, E, lvl);
1090 if (LL==0) return encoding;
1091 encoding += LL* 10000000;
1092 if ( Z==1 && A==1 && E==0.0 ) encoding = 3122; // Lambda
1093
1094 return encoding;
1095}

◆ GetNucleusMass()

G4double G4IonTable::GetNucleusMass ( G4int  Z,
G4int  A,
G4int  L = 0,
G4int  lvl = 0 
) const

Definition at line 1435 of file G4IonTable.cc.

1436{
1437 if ( (A<1) || (Z<0) || (LL<0) || (lvl<0) || (lvl>9) )
1438 {
1439#ifdef G4VERBOSE
1440 if (GetVerboseLevel()>0)
1441 {
1442 G4cout << "G4IonTable::GetNucleusMass() : illegal atomic number/mass:"
1443 << G4endl
1444 << " Z =" << Z << " A = " << A
1445 << " L = " << LL << " lvl = " << lvl << G4endl;
1446 }
1447#endif
1448 G4Exception("G4IonTable::GetNucleusMass()","PART107",
1449 EventMustBeAborted, "illegal atomic number/mass");
1450 return -1.0;
1451 }
1452
1453 G4double mass;
1454 if (LL == 0)
1455 {
1456 // calculate nucleus mass
1457 const G4ParticleDefinition* ion=GetLightIon(Z, A);
1458
1459 if (ion != nullptr)
1460 {
1461 mass = ion->GetPDGMass();
1462 }
1463 else
1464 {
1465 // Use G4NucleiProperties::GetNuclearMass
1467 }
1468
1469 // Isomer
1470 if ( lvl>0 )
1471 {
1472 // -- loop over all particles in Ion table
1474 G4bool isFound = false;
1475 for(auto i = fIonList->find(encoding);i != fIonList->cend() ; ++i)
1476 {
1477 ion = i->second;
1478 if ( ( ion->GetAtomicNumber()!=Z) || (ion->GetAtomicMass()!=A) ) break;
1479 // Excitation level
1480 if ( ((const G4Ions*)(ion))->GetIsomerLevel() == lvl)
1481 {
1482 isFound = true;
1483 break;
1484 }
1485 }
1486 if (isFound)
1487 {
1488 // Return existing isomer mass
1489 mass = ion->GetPDGMass();
1490 }
1491 else
1492 {
1493 // Find isomer from IsotopeTable
1494 const G4IsotopeProperty* fProperty = FindIsotope(Z, A, lvl);
1495 if (fProperty != nullptr ) mass += fProperty->GetEnergy();
1496 }
1497 }
1498 }
1499 else
1500 {
1502 }
1503 return mass;
1504}
@ EventMustBeAborted
static G4double GetNuclearMass(G4int A, G4int Z, G4int L)
static G4double GetNuclearMass(const G4double A, const G4double Z)

Referenced by CreateIon(), GetIonMass(), and GetIsomerMass().

◆ GetNumberOfElements()

G4int G4IonTable::GetNumberOfElements ( ) const
inline

Definition at line 321 of file G4IonTable.hh.

322{
323 return numberOfElements;
324}

◆ GetParticle()

G4ParticleDefinition * G4IonTable::GetParticle ( G4int  index) const

Definition at line 1905 of file G4IonTable.cc.

1906{
1907 if ( (index >=0) && (index < Entries()) )
1908 {
1909 auto idx = fIonList->cbegin();
1910 G4int counter = 0;
1911 while( idx != fIonList->cend() ) // Loop checking, 09.08.2015, K.Kurashige
1912 {
1913 if ( counter == index )
1914 {
1915 return const_cast<G4ParticleDefinition*>(idx->second);
1916 }
1917 ++counter;
1918 ++idx;
1919 }
1920 }
1921#ifdef G4VERBOSE
1922 if (GetVerboseLevel()>1)
1923 {
1924 G4cout << " G4IonTable::GetParticle"
1925 << " invalid index (=" << index << ")"
1926 << " entries = " << Entries() << G4endl;
1927 }
1928#endif
1929 return nullptr;
1930}
G4int Entries() const
Definition: G4IonTable.cc:1962

Referenced by LBE::ConstructGeneral().

◆ GetVerboseLevel()

G4int G4IonTable::GetVerboseLevel ( ) const
protected

Definition at line 1703 of file G4IonTable.cc.

1704{
1706}
G4int GetVerboseLevel() const

Referenced by AddProcessManager(), clear(), CreateIon(), FindIon(), GetIon(), GetNucleusMass(), GetParticle(), and Remove().

◆ InitializeLightIons()

void G4IonTable::InitializeLightIons ( )

Definition at line 205 of file G4IonTable.cc.

206{
209}

Referenced by G4RunManagerKernel::SetupPhysics().

◆ Insert()

void G4IonTable::Insert ( const G4ParticleDefinition particle)

Definition at line 1548 of file G4IonTable.cc.

1549{
1550 if (!IsIon(particle)) return;
1551 if (Contains(particle)) return;
1552
1553 G4int Z = particle->GetAtomicNumber();
1554 G4int A = particle->GetAtomicMass();
1555 G4int LL = particle->GetQuarkContent(3); //strangeness
1556 G4int encoding=GetNucleusEncoding(Z, A, LL); // encoding of the groud state
1557
1558 // Register the ion with its encoding of the ground state
1559 fIonListShadow->insert( std::pair<const G4int,
1560 const G4ParticleDefinition*>(encoding, particle) );
1561}
G4bool Contains(const G4ParticleDefinition *particle) const
Definition: G4IonTable.cc:1935

Referenced by G4ParticleTable::Insert().

◆ InsertWorker()

void G4IonTable::InsertWorker ( const G4ParticleDefinition particle)
protected

Definition at line 1565 of file G4IonTable.cc.

1566{
1567 if(!particle) return;
1568
1569 G4int Z = particle->GetAtomicNumber();
1570 G4int A = particle->GetAtomicMass();
1571 G4int LL = particle->GetQuarkContent(3); //strangeness
1573 G4bool found = false;
1574 if (encoding !=0 )
1575 {
1576 for(auto i = fIonList->find(encoding); i != fIonList->cend(); ++i)
1577 {
1578 if (particle == i->second)
1579 {
1580 found = true;
1581 break;
1582 }
1583 }
1584 }
1585 if(found) return;
1586
1587 // Register the ion with its encoding of the gronud state
1588 fIonList->insert( std::pair<const G4int,
1589 const G4ParticleDefinition*>(encoding, particle) );
1590}

Referenced by GetIon().

◆ IsAntiIon()

G4bool G4IonTable::IsAntiIon ( const G4ParticleDefinition particle)
static

Definition at line 1328 of file G4IonTable.cc.

1329{
1330 // Return true if the particle is ion
1331 static const G4String anti_nucleus("anti_nucleus");
1332 static const G4String anti_proton("anti_proton");
1333
1334 // Anti_neutron is not ion
1335 if ( (particle->GetAtomicMass()>0)
1336 && (particle->GetAtomicNumber()>0) )
1337 {
1338 if (particle->GetBaryonNumber()<0) return true;
1339 else return false;
1340 }
1341
1342 // Particles derived from G4Ions
1343 if (particle->GetParticleType() == anti_nucleus) return true;
1344
1345 // Anti_proton (Anti_Hydrogen nucleus)
1346 if (particle->GetParticleName() == anti_proton) return true;
1347
1348 return false;
1349}
const G4String & GetParticleType() const

Referenced by G4ParticleDefinition::DumpTable(), and G4ParticleDefinition::G4ParticleDefinition().

◆ IsIon()

G4bool G4IonTable::IsIon ( const G4ParticleDefinition particle)
static

Definition at line 1302 of file G4IonTable.cc.

1303{
1304 // Return true if the particle is ion
1305 static const G4String nucleus("nucleus");
1306 static const G4String proton("proton");
1307
1308 // Neutron is not ion
1309 if ( (particle->GetAtomicMass()>0)
1310 && (particle->GetAtomicNumber()>0) )
1311 {
1312 if (particle->GetBaryonNumber()>0) return true;
1313 else return false;
1314 }
1315
1316 // Particles derived from G4Ions
1317 if (particle->GetParticleType() == nucleus) return true;
1318
1319 // Proton (Hydrogen nucleus)
1320 if (particle->GetParticleName() == proton) return true;
1321
1322 return false;
1323}

Referenced by G4DynamicParticle::AllocateElectronOccupancy(), Contains(), G4ParticleDefinition::DumpTable(), G4ParticleDefinition::G4ParticleDefinition(), GetMuonicAtom(), Insert(), G4ParticleTable::Insert(), Remove(), and G4ParticleTable::Remove().

◆ IsLightAntiIon()

G4bool G4IonTable::IsLightAntiIon ( const G4ParticleDefinition particle) const
protected

Definition at line 1366 of file G4IonTable.cc.

1367{
1368 static const std::string names[]
1369 = { "anti_proton", "anti_alpha", "anti_deuteron", "anti_triton", "anti_He3"};
1370
1371 // Return true if the particle is pre-defined ion
1372 return std::find(names, names+5, particle->GetParticleName())!=names+5;
1373}

◆ IsLightIon()

G4bool G4IonTable::IsLightIon ( const G4ParticleDefinition particle) const
protected

Definition at line 1354 of file G4IonTable.cc.

1355{
1356 static const std::string names[]
1357 = { "proton", "alpha", "deuteron", "triton", "He3"};
1358
1359 // Return true if the particle is pre-defined ion
1360 return std::find(names, names+5, particle->GetParticleName())!=names+5;
1361}

◆ operator=()

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

◆ PreloadNuclide()

void G4IonTable::PreloadNuclide ( )

Definition at line 1884 of file G4IonTable.cc.

1885{
1886 if ( isIsomerCreated || !G4Threading::IsMultithreadedApplication() ) return;
1887
1888 pNuclideTable->GenerateNuclide();
1889
1890 for ( std::size_t i=0 ; i!=pNuclideTable->entries(); ++i )
1891 {
1892 const G4IsotopeProperty* fProperty = pNuclideTable->GetIsotopeByIndex( i );
1893 G4int Z = fProperty->GetAtomicNumber();
1894 G4int A = fProperty->GetAtomicMass();
1895 G4double Eex = fProperty->GetEnergy();
1896 GetIon(Z,A,Eex);
1897 }
1898
1899 isIsomerCreated = true;
1900}
G4int GetAtomicMass() const
G4int GetAtomicNumber() const
G4IsotopeProperty * GetIsotopeByIndex(std::size_t idx) const
std::size_t entries() const
G4bool IsMultithreadedApplication()
Definition: G4Threading.cc:130

Referenced by CreateAllIon(), and CreateAllIsomer().

◆ PrepareNuclideTable()

void G4IonTable::PrepareNuclideTable ( )

Definition at line 1875 of file G4IonTable.cc.

1876{
1877 if (pNuclideTable == nullptr)
1878 pNuclideTable = G4NuclideTable::GetNuclideTable();
1879}

Referenced by G4IonTable().

◆ RegisterIsotopeTable()

void G4IonTable::RegisterIsotopeTable ( G4VIsotopeTable table)

Definition at line 1786 of file G4IonTable.cc.

1787{
1788 //check duplication
1789 G4String name = table->GetName();
1790 for (std::size_t i=0; i<fIsotopeTableList->size(); ++i)
1791 {
1792 G4VIsotopeTable* fIsotopeTable= (*fIsotopeTableList)[i];
1793 if (name == fIsotopeTable->GetName()) return;
1794 }
1795 // register
1796 fIsotopeTableList->push_back(table);
1797}
const G4String & GetName() const

Referenced by G4IonTable().

◆ Remove()

void G4IonTable::Remove ( const G4ParticleDefinition particle)

Definition at line 1594 of file G4IonTable.cc.

1595{
1596 if(particle == nullptr) return;
1597#ifdef G4MULTITHREADED
1599 {
1601 ed << "Request of removing " << particle->GetParticleName()
1602 << " is ignored as it is invoked from a worker thread.";
1603 G4Exception("G4IonTable::Remove()", "PART10117", JustWarning, ed);
1604 return;
1605 }
1606#endif
1607 if (G4ParticleTable::GetParticleTable()->GetReadiness())
1608 {
1610 G4ApplicationState currentState = pStateManager->GetCurrentState();
1611 if (currentState != G4State_PreInit)
1612 {
1613 G4String msg = "Request of removing ";
1614 msg += particle->GetParticleName();
1615 msg += " has No effects other than Pre_Init";
1616 G4Exception("G4IonTable::Remove()",
1617 "PART117", JustWarning, msg);
1618 return;
1619 }
1620 else
1621 {
1622#ifdef G4VERBOSE
1623 if (GetVerboseLevel()>0)
1624 {
1625 G4cout << particle->GetParticleName()
1626 << " will be removed from the IonTable " << G4endl;
1627 }
1628#endif
1629 }
1630 }
1631
1632 if (IsIon(particle))
1633 {
1634 G4int Z = particle->GetAtomicNumber();
1635 G4int A = particle->GetAtomicMass();
1636 G4int LL = particle->GetQuarkContent(3); // strangeness
1638 if (encoding !=0 )
1639 {
1640 for(auto i = fIonListShadow->find(encoding);
1641 i != fIonListShadow->cend() ; ++i)
1642 {
1643 if (particle == i->second)
1644 {
1645 fIonListShadow->erase(i);
1646 break;
1647 }
1648 }
1649 }
1650 }
1651 else
1652 {
1653#ifdef G4VERBOSE
1654 if (GetVerboseLevel()>1)
1655 {
1656 G4cout << "G4IonTable::Remove :" << particle->GetParticleName()
1657 << " is not ions" << G4endl;
1658 }
1659#endif
1660 }
1661}
G4ApplicationState
@ G4State_PreInit
const G4ApplicationState & GetCurrentState() const
static G4StateManager * GetStateManager()

Referenced by G4ParticleTable::Remove().

◆ size()

G4int G4IonTable::size ( ) const

Definition at line 1970 of file G4IonTable.cc.

1971{
1972 return fIonList->size();
1973}

Referenced by GetIsotopeTable().

◆ WorkerG4IonTable()

void G4IonTable::WorkerG4IonTable ( )

Definition at line 180 of file G4IonTable.cc.

181{
182 if( fIonList == nullptr ) { fIonList = new G4IonList(); }
183 else { fIonList->clear(); }
184
185 for (auto it = fIonListShadow->cbegin(); it != fIonListShadow->cend(); ++it )
186 {
187 fIonList->insert(*it);
188 }
189
190 // Do not copy Isotope Table to Worker thread
191 //
192 if( fIsotopeTableList == nullptr )
193 {
194 fIsotopeTableList = new std::vector<G4VIsotopeTable*>;
195 for (std::size_t i = 0; i < fIsotopeTableListShadow->size(); ++i)
196 {
198 }
199 }
200}

Referenced by G4ParticleTable::WorkerG4ParticleTable().

Member Data Documentation

◆ elementName

const G4String G4IonTable::elementName
static
Initial value:
=
{
"H", "He",
"Li", "Be", "B", "C", "N", "O", "F", "Ne",
"Na", "Mg", "Al", "Si", "P", "S", "Cl", "Ar",
"K", "Ca", "Sc", "Ti", "V", "Cr", "Mn", "Fe", "Co", "Ni", "Cu", "Zn", "Ga", "Ge", "As", "Se", "Br", "Kr",
"Rb", "Sr", "Y", "Zr", "Nb", "Mo","Tc", "Ru", "Rh", "Pd", "Ag", "Cd", "In", "Sn", "Sb", "Te", "I", "Xe",
"Cs", "Ba",
"La", "Ce", "Pr", "Nd", "Pm", "Sm", "Eu", "Gd", "Tb", "Dy", "Ho", "Er", "Tm", "Yb", "Lu",
"Hf", "Ta", "W", "Re", "Os", "Ir", "Pt", "Au", "Hg", "Tl", "Pb", "Bi", "Po", "At", "Rn",
"Fr", "Ra",
"Ac", "Th", "Pa", "U", "Np", "Pu", "Am", "Cm", "Bk", "Cf", "Es", "Fm", "Md", "No", "Lr",
"Rf", "Db", "Sg", "Bh", "Hs", "Mt", "Ds", "Rg", "Cn", "Nh", "Fl", "Mc", "Lv", "Ts", "Og"
}

Definition at line 264 of file G4IonTable.hh.

Referenced by GetIonName().

◆ fIonList

◆ fIonListShadow

G4IonTable::G4IonList * G4IonTable::fIonListShadow = nullptr
static

◆ fIsotopeTableList

G4ThreadLocal std::vector< G4VIsotopeTable * > * G4IonTable::fIsotopeTableList = nullptr
static

◆ fIsotopeTableListShadow

std::vector< G4VIsotopeTable * > * G4IonTable::fIsotopeTableListShadow = nullptr
static

Definition at line 255 of file G4IonTable.hh.

Referenced by G4IonTable(), and WorkerG4IonTable().


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