Geant4 11.2.2
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 nL, 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 nL, G4double E, G4int J=0)
 
G4ParticleDefinitionGetIon (G4int Z, G4int A, G4int nL, G4double E, G4Ions::G4FloatLevelBase flb, G4int J=0)
 
G4ParticleDefinitionGetIon (G4int Z, G4int A, G4int nL, G4double E, char flbChar, G4int J=0)
 
G4ParticleDefinitionGetIon (G4int encoding)
 
G4ParticleDefinitionFindIon (G4int Z, G4int A, G4int lvl=0)
 
G4ParticleDefinitionFindIon (G4int Z, G4int A, G4int nL, 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 nL, G4double E, G4int J=0)
 
G4ParticleDefinitionFindIon (G4int Z, G4int A, G4int nL, G4double E, G4Ions::G4FloatLevelBase flb, G4int J=0)
 
G4ParticleDefinitionFindIon (G4int Z, G4int A, G4int nL, G4double E, char flbChar, G4int J=0)
 
G4String GetIonName (G4int Z, G4int A, G4int lvl=0) const
 
G4String GetIonName (G4int Z, G4int A, G4double E, G4Ions::G4FloatLevelBase flb=G4Ions::G4FloatLevelBase::no_Float) const
 
G4String GetIonName (G4int Z, G4int A, G4int nL, G4double E, G4Ions::G4FloatLevelBase flb=G4Ions::G4FloatLevelBase::no_Float) const
 
G4String GetIonName (G4int Z, G4int A, G4int nL, G4int lvl) const
 
G4double GetIonMass (G4int Z, G4int A, G4int nL=0, G4int lvl=0) const
 
G4double GetNucleusMass (G4int Z, G4int A, G4int nL=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 nL, 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 nL, G4int lvl)
 
G4ParticleDefinitionFindIonInMaster (G4int Z, G4int A, G4double E, G4Ions::G4FloatLevelBase flb, G4int J=0)
 
G4ParticleDefinitionFindIonInMaster (G4int Z, G4int A, G4int nL, G4double E, G4Ions::G4FloatLevelBase flb, G4int J=0)
 
G4ParticleDefinitionCreateIon (G4int Z, G4int A, G4double E, G4Ions::G4FloatLevelBase flb)
 
G4ParticleDefinitionCreateIon (G4int Z, G4int A, G4int nL, G4double E, G4Ions::G4FloatLevelBase flb)
 
G4ParticleDefinitionCreateIon (G4int Z, G4int A, G4int lvl=0)
 
G4ParticleDefinitionCreateIon (G4int Z, G4int A, G4int nL, 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 55 of file G4IonTable.hh.

◆ G4IonListIterator

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

Definition at line 56 of file G4IonTable.hh.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
numberOfElements 

Definition at line 249 of file G4IonTable.hh.

250 {
251 numberOfElements = 118
252 };

Constructor & Destructor Documentation

◆ G4IonTable() [1/2]

G4IonTable::G4IonTable ( )

Definition at line 110 of file G4IonTable.cc.

111{
112 fIonList = new G4IonList();
113
114 // Set up the shadow pointer used by worker threads.
115 //
116 if (fIonListShadow == nullptr) {
118 }
119
120 fIsotopeTableList = new std::vector<G4VIsotopeTable*>;
121
122 // Set up the shadow pointer used by worker threads.
123 //
124 if (fIsotopeTableListShadow == nullptr) {
126 }
127
129 RegisterIsotopeTable(pNuclideTable);
130}
static G4ThreadLocal std::vector< G4VIsotopeTable * > * fIsotopeTableList
void PrepareNuclideTable()
static G4IonList * fIonListShadow
std::multimap< G4int, const G4ParticleDefinition * > G4IonList
Definition G4IonTable.hh:55
static std::vector< G4VIsotopeTable * > * fIsotopeTableListShadow
static G4ThreadLocal G4IonList * fIonList
void RegisterIsotopeTable(G4VIsotopeTable *table)

◆ ~G4IonTable()

G4IonTable::~G4IonTable ( )

Definition at line 132 of file G4IonTable.cc.

133{
134 // delete IsotopeTable if existing
135 if (fIsotopeTableList != nullptr) {
136 for (const auto fIsotopeTable : *fIsotopeTableList) {
137 if (fIsotopeTable != G4NuclideTable::GetNuclideTable()) {
138 delete fIsotopeTable;
139 }
140 }
141 fIsotopeTableList->clear();
142 delete fIsotopeTableList;
143 }
144 fIsotopeTableList = nullptr;
145
146 if (fIonList == nullptr) return;
147
148 // remove all contents in the Ion List
149 // No need to delete here because all particles are dynamic objects
150 fIonList->clear();
151 delete fIonList;
152 fIonList = nullptr;
153}
static G4NuclideTable * GetNuclideTable()

◆ G4IonTable() [2/2]

G4IonTable::G4IonTable ( const G4IonTable & )
delete

Member Function Documentation

◆ AddProcessManager()

void G4IonTable::AddProcessManager ( G4ParticleDefinition * ion)
protected

Definition at line 1213 of file G4IonTable.cc.

1214{
1215 if (ion->IsGeneralIon()) {
1216 // Check whether GenericIon has processes
1218
1219 G4ProcessManager* pman = nullptr;
1220 if (genericIon != nullptr) pman = genericIon->GetProcessManager();
1221 if ((genericIon == nullptr) || (genericIon->GetParticleDefinitionID() < 0) || (pman == nullptr))
1222 {
1223 G4String msg = "G4IonTable::AddProcessManager(): cannot create ion of ";
1224 msg += ion->GetParticleName();
1225 msg += "\n because GenericIon is not available!!";
1226 G4Exception("G4IonTable::AddProcessManager()", "PART105", FatalException, msg);
1227 return;
1228 }
1229
1231 }
1232 else {
1233 // Is this a MuonicAtom ?
1234 auto muatom = dynamic_cast<G4MuonicAtom*>(ion);
1235
1236 if (muatom != nullptr) {
1237#ifdef G4VERBOSE
1238 if (GetVerboseLevel() > 1) {
1239 G4cout << "G4IonTable::AddProcessManager(): "
1240 << "MuonicAtom dynamic_cast succeeded for " << ion->GetParticleName() << G4endl;
1241 }
1242#endif
1243 // Check whether GenericMuonicAtom has processes
1245
1246 G4ProcessManager* pman = nullptr;
1247 if (genericMA != nullptr) pman = genericMA->GetProcessManager();
1248 if ((genericMA == nullptr) || (genericMA->GetParticleDefinitionID() < 0) || (pman == nullptr))
1249 {
1250 G4String msg = "G4IonTable::AddProcessManager(): cannot create MuonicAtom ";
1251 msg += ion->GetParticleName();
1252 msg += "\n because GenericMuonicAtom is not available!!";
1253 G4Exception("G4IonTable::AddProcessManager()", "PART106", FatalException, msg);
1254 return;
1255 }
1256
1258 }
1259 else {
1260 G4String msg = "G4IonTable::AddProcessManager(): cannot create ";
1261 msg += ion->GetParticleName();
1262 msg += "\n because of unsupported particle type !!";
1263 G4Exception("G4IonTable::AddProcessManager()", "PART107", FatalException, msg);
1264 return;
1265 }
1266 }
1267 return;
1268}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
G4int GetVerboseLevel() const
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(), CreateIon(), and GetMuonicAtom().

◆ clear()

void G4IonTable::clear ( )

Definition at line 1068 of file G4IonTable.cc.

1069{
1070 if (G4ParticleTable::GetParticleTable()->GetReadiness()) {
1071 G4Exception("G4IonTable::clear()", "PART116", JustWarning,
1072 "No effects because readyToUse is true.");
1073 return;
1074 }
1075
1076#ifdef G4VERBOSE
1077 if (GetVerboseLevel() > 2) {
1078 G4cout << "G4IonTable::Clear() : number of Ion registered = ";
1079 G4cout << fIonList->size() << G4endl;
1080 }
1081#endif
1082 fIonList->clear();
1083}
@ JustWarning

Referenced by G4ParticleTable::RemoveAllParticles().

◆ Contains()

G4bool G4IonTable::Contains ( const G4ParticleDefinition * particle) const

Definition at line 1380 of file G4IonTable.cc.

1381{
1382 if (!IsIon(particle)) return false;
1383
1384 G4int Z = particle->GetAtomicNumber();
1385 G4int A = particle->GetAtomicMass();
1386 G4int LL = particle->GetQuarkContent(3); // strangeness
1388 G4bool found = false;
1389 if (encoding != 0) {
1390 for (auto i = fIonListShadow->find(encoding); i != fIonListShadow->cend(); ++i) {
1391 if (particle == i->second) {
1392 found = true;
1393 break;
1394 }
1395 }
1396 }
1397 return found;
1398}
bool G4bool
Definition G4Types.hh:86
int G4int
Definition G4Types.hh:85
const G4double A[17]
static G4bool IsIon(const G4ParticleDefinition *)
static G4int GetNucleusEncoding(G4int Z, G4int A, G4double E=0.0, G4int lvl=0)
G4int GetAtomicNumber() const
G4int GetAtomicMass() const
G4int GetQuarkContent(G4int flavor) const

Referenced by Insert().

◆ CreateAllIon()

void G4IonTable::CreateAllIon ( )

Definition at line 1324 of file G4IonTable.cc.

1325{
1327}
void PreloadNuclide()

Referenced by G4ParticleMessenger::SetNewValue().

◆ CreateAllIsomer()

void G4IonTable::CreateAllIsomer ( )

Definition at line 1329 of file G4IonTable.cc.

1330{
1332}

Referenced by G4ParticleMessenger::SetNewValue().

◆ CreateIon() [1/4]

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

Definition at line 213 of file G4IonTable.cc.

215{
216 G4ParticleDefinition* ion = nullptr;
217
218 // check whether GenericIon has processes
220 G4ProcessManager* pman = nullptr;
221 if (genericIon != nullptr) {
222 pman = genericIon->GetProcessManager();
223 }
224 if ((genericIon == nullptr) || (genericIon->GetParticleDefinitionID() < 0) || (pman == nullptr)) {
225#ifdef G4VERBOSE
226 if (GetVerboseLevel() > 1) {
227 G4cout << "G4IonTable::CreateIon() : can not create ion of "
228 << " Z =" << Z << " A = " << A << " because GenericIon is not ready !!" << G4endl;
229 }
230#endif
231 G4Exception("G4IonTable::CreateIon()", "PART105", JustWarning,
232 "Can not create ions because GenericIon is not ready");
233 return nullptr;
234 }
235
236 G4double life = 0.0;
237 G4DecayTable* decayTable = nullptr;
238 G4bool stable = true;
239 G4double mu = 0.0;
240 G4double Eex = 0.0;
241 G4int lvl = 0;
242 G4int J = 0;
243
244 const G4IsotopeProperty* fProperty = FindIsotope(Z, A, E, flb);
245 if (fProperty != nullptr) {
246 Eex = fProperty->GetEnergy();
247 lvl = fProperty->GetIsomerLevel();
248 J = fProperty->GetiSpin();
249 life = fProperty->GetLifeTime();
250 mu = fProperty->GetMagneticMoment();
251 decayTable = fProperty->GetDecayTable();
252 stable = (life <= 0.) || (decayTable == nullptr);
253 lvl = fProperty->GetIsomerLevel();
254 if (lvl < 0) lvl = 9;
255 }
256 else {
257#ifdef G4VERBOSE
258 if (GetVerboseLevel() > 1) {
260 ed << "G4IonTable::CreateIon(): G4IsotopeProperty object is not found for"
261 << " Z = " << Z << " A = " << A << " E = " << E / keV << " (keV)";
263 ed << " FloatingLevel +" << G4Ions::FloatLevelBaseChar(flb);
264 }
265 ed << ".\n"
266 << " Physics quantities such as life are not set for this ion.";
267 G4Exception("G4IonTable::CreateIon()", "PART70105", JustWarning, ed);
268 }
269#endif
270 // excitation energy
271 Eex = E;
272 // lvl is assigned to 9 temporarily
273 if (Eex > 0.0) lvl = 9;
274 }
275
276 // Eex = G4NuclideTable::Round(Eex);
277 if (Eex == 0.0) lvl = 0;
278 // ion name
279 G4String name = "";
280 /////////////if (lvl<9) name = GetIonName(Z, A, lvl);
281 if (lvl == 0 && flb == G4Ions::G4FloatLevelBase::no_Float)
282 name = GetIonName(Z, A, lvl);
283 else
284 name = GetIonName(Z, A, Eex, flb);
285
286 // PDG encoding
287 G4int encoding = GetNucleusEncoding(Z, A, E, lvl);
288
289 // PDG mass
290 G4double mass = GetNucleusMass(Z, A) + Eex;
291
292 // PDG charge is set to one of nucleus
293 G4double charge = G4double(Z) * eplus;
294
295 // create an ion
296 // spin, parity, isospin values are fixed
297
298 // Request lock for particle table accesses. Some changes are inside
299 // this critical region.
300 //
301 // clang-format off
302 ion = new G4Ions( name, mass, 0.0*MeV, charge,
303 J, +1, 0,
304 0, 0, 0,
305 "nucleus", 0, A, encoding,
306 stable, life, decayTable, false,
307 "generic", 0,
308 Eex, lvl );
309 // clang-format on
310
311 // Release lock for particle table accesses.
312 //
313 ion->SetPDGMagneticMoment(mu);
314 static_cast<G4Ions*>(ion)->SetFloatLevelBase(flb);
315
316 // No Anti particle registered
317 ion->SetAntiPDGEncoding(0);
318
319#ifdef G4VERBOSE
320 if (GetVerboseLevel() > 1) {
321 G4cout << "G4IonTable::CreateIon() : create ion of " << name << " " << Z << ", " << A
322 << " encoding=" << encoding;
323 if (E > 0.0) {
324 G4cout << " IsomerLVL=" << lvl << " excited energy=" << Eex / keV << "[keV]";
325 }
326 G4cout << G4endl;
327 }
328#endif
329
330 // Add process manager to the ion
332
333#ifdef G4MULTITHREADED
334 // Fill decay channels if this method is invoked from worker
336 if (!stable && (decayTable != nullptr)) {
337 G4int nCh = decayTable->entries();
338 for (G4int iCh = 0; iCh < nCh; ++iCh) {
339 decayTable->GetDecayChannel(iCh)->GetDaughter(0);
340 }
341 }
342 }
343#endif
344
345 return ion;
346}
std::ostringstream G4ExceptionDescription
double G4double
Definition G4Types.hh:83
G4VDecayChannel * GetDecayChannel(G4int index) const
G4int entries() const
G4double GetNucleusMass(G4int Z, G4int A, G4int nL=0, G4int lvl=0) const
G4String GetIonName(G4int Z, G4int A, G4int lvl=0) const
void AddProcessManager(G4ParticleDefinition *)
G4IsotopeProperty * FindIsotope(G4int Z, G4int A, G4double E, G4Ions::G4FloatLevelBase flb) const
static char FloatLevelBaseChar(G4Ions::G4FloatLevelBase flb)
Definition G4Ions.cc:185
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()

Referenced by CreateIon(), CreateIon(), CreateIon(), GetIon(), and GetIon().

◆ CreateIon() [2/4]

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

Definition at line 433 of file G4IonTable.cc.

434{
435 // always create an ion for any lvl
436 return CreateIon(Z, A, 0.0, G4Ions::FloatLevelBase(lvl));
437}
G4ParticleDefinition * CreateIon(G4int Z, G4int A, G4double E, G4Ions::G4FloatLevelBase flb)
static G4Ions::G4FloatLevelBase FloatLevelBase(char flbChar)
Definition G4Ions.cc:107

◆ CreateIon() [3/4]

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

Definition at line 348 of file G4IonTable.cc.

350{
351 if (LL == 0) return CreateIon(Z, A, E, flb);
352
353 // create hyper nucleus
354 G4ParticleDefinition* ion = nullptr;
355
356 // check whether GenericIon has processes
358 G4ProcessManager* pman = nullptr;
359 if (genericIon != nullptr) pman = genericIon->GetProcessManager();
360 if ((genericIon == nullptr) || (genericIon->GetParticleDefinitionID() < 0) || (pman == nullptr)) {
361#ifdef G4VERBOSE
362 if (GetVerboseLevel() > 1) {
363 G4cout << "G4IonTable::CreateIon() : can not create ion of "
364 << " Z =" << Z << " A = " << A << " because GenericIon is not ready !!" << G4endl;
365 }
366#endif
367 G4Exception("G4IonTable::CreateIon()", "PART105", JustWarning,
368 "Can not create ions because GenericIon is not ready");
369 return nullptr;
370 }
371
372 G4int J = 0;
373 G4double life = 0.0;
374 G4DecayTable* decayTable = nullptr;
375 G4bool stable = true;
376
377 // excitation energy
378 // G4double Eex = G4NuclideTable::Round(E);
379 G4double Eex = E;
380 G4double mass = GetNucleusMass(Z, A, LL) + Eex;
381 G4int lvl = 0;
382 // lvl is assigned to 9 temporarily
383 if (Eex > 0.0) lvl = 9;
384
385 // PDG encoding
386 G4int encoding = GetNucleusEncoding(Z, A, LL, E, lvl);
387
388 // PDG charge is set to one of nucleus
389 G4double charge = G4double(Z) * eplus;
390
391 // create an ion
392 // spin, parity, isospin values are fixed
393 //
394 // get ion name
395 G4String name = GetIonName(Z, A, LL, Eex, flb);
396
397 // clang-format off
398 ion = new G4Ions( name, mass, 0.0*MeV, charge,
399 J, +1, 0,
400 0, 0, 0,
401 "nucleus", 0, A, encoding,
402 stable, life, decayTable, false,
403 "generic", 0,
404 Eex, lvl );
405 // clang-format on
406
407 // Release lock for particle table accesses
408
409 G4double mu = 0.0; // magnetic moment
410 ion->SetPDGMagneticMoment(mu);
411 static_cast<G4Ions*>(ion)->SetFloatLevelBase(flb);
412
413 // No Anti particle registered
414 ion->SetAntiPDGEncoding(0);
415
416#ifdef G4VERBOSE
417 if (GetVerboseLevel() > 1) {
418 G4cout << "G4IonTable::CreateIon() : create hyper ion of " << name << " " << Z << ", " << A
419 << ", " << LL << " encoding=" << encoding;
420 if (E > 0.0) {
421 G4cout << " IsomerLVL=" << lvl << " excited energy=" << Eex / keV << "[keV]";
422 }
423 G4cout << G4endl;
424 }
425#endif
426
427 // Add process manager to the ion
429
430 return ion;
431}

◆ CreateIon() [4/4]

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

Definition at line 439 of file G4IonTable.cc.

440{
441 return (LL == 0) ? CreateIon(Z, A, 0.0, G4Ions::G4FloatLevelBase(lvl))
442 : CreateIon(Z, A, LL, 0.0, G4Ions::G4FloatLevelBase::no_Float);
443}
G4FloatLevelBase
Definition G4Ions.hh:80

◆ DestroyWorkerG4IonTable()

void G4IonTable::DestroyWorkerG4IonTable ( )

Definition at line 190 of file G4IonTable.cc.

191{
192 // delete IsotopeTable if existing
193 if (fIsotopeTableList != nullptr) {
194 for (auto fIsotopeTable : *fIsotopeTableList) {
195 if (fIsotopeTable != G4NuclideTable::GetNuclideTable()) {
196 delete fIsotopeTable;
197 }
198 }
199 fIsotopeTableList->clear();
200 delete fIsotopeTableList;
201 }
202 fIsotopeTableList = nullptr;
203
204 if (fIonList == nullptr) return;
205
206 // remove all contents in the Ion List
207 // No need to delete here because all particles are dynamic objects
208 fIonList->clear();
209 delete fIonList;
210 fIonList = nullptr;
211}

Referenced by G4ParticleTable::DestroyWorkerG4ParticleTable().

◆ DumpTable()

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

Definition at line 1175 of file G4IonTable.cc.

1176{
1177 const G4ParticleDefinition* ion;
1178 for (const auto& idx : *fIonList) {
1179 ion = idx.second;
1180 if ((particle_name == "ALL") || (particle_name == "all")) {
1181 ion->DumpTable();
1182 }
1183 else if (particle_name == ion->GetParticleName()) {
1184 ion->DumpTable();
1185 }
1186 }
1187}

◆ Entries()

G4int G4IonTable::Entries ( ) const

Definition at line 1400 of file G4IonTable.cc.

1401{
1402 return (G4int)fIonList->size();
1403}

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 596 of file G4IonTable.cc.

597{
598 return FindIon(Z, A, E, G4Ions::FloatLevelBase(flbChar), J);
599}
G4ParticleDefinition * FindIon(G4int Z, G4int A, G4int lvl=0)

◆ FindIon() [2/8]

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

Definition at line 591 of file G4IonTable.cc.

592{
594}

◆ FindIon() [3/8]

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

Definition at line 601 of file G4IonTable.cc.

603{
604 if ((A < 1) || (Z <= 0) || (J < 0) || (E < 0.0) || (A > 999)) {
605#ifdef G4VERBOSE
606 if (GetVerboseLevel() > 0) {
607 G4cout << "G4IonTable::FindIon(): illegal atomic number/mass"
608 << " or excitation level:" << G4endl << " Z =" << Z << " A = " << A
609 << " E = " << E / keV << G4endl;
610 }
611#endif
612 G4Exception("G4IonTable::FindIon()", "PART107", JustWarning, "illegal atomic number/mass");
613 return nullptr;
614 }
615 // Search ions with A, Z ,E
616 // !! J is omitted now !!
617 const G4ParticleDefinition* ion = nullptr;
618 G4bool isFound = false;
619
620 // check if light ion
621 ion = GetLightIon(Z, A);
622 if (ion != nullptr && E == 0.0) {
623 // light ion
624 isFound = true;
625 }
626 else {
627 // -- loop over all particles in Ion table
629 const G4ParticleDefinition* ion1 = nullptr;
630 for (auto i = fIonList->find(encoding); i != fIonList->cend(); ++i) {
631 ion = i->second;
632 if ((ion->GetAtomicNumber() != Z) || (ion->GetAtomicMass() != A)) break;
633 // excitation level
634 G4double anExcitaionEnergy = ((const G4Ions*)(ion))->GetExcitationEnergy();
635
636 if (std::fabs(E - anExcitaionEnergy) < pNuclideTable->GetLevelTolerance()) {
637 if (nullptr == ion1) ion1 = ion;
638 if (((const G4Ions*)(ion))->GetFloatLevelBase() == flb) {
639 isFound = true;
640 break;
641 }
642 }
643 }
644 // rerun search on ground level without check on floating
645 if (!isFound && E == 0.0 && nullptr != ion1) {
646 isFound = true;
647 ion = ion1;
648 }
649 }
650
651 if (isFound) {
652 return const_cast<G4ParticleDefinition*>(ion);
653 }
654
655 return nullptr;
656}
G4ParticleDefinition * GetLightIon(G4int Z, G4int A) const
G4double GetLevelTolerance()

◆ FindIon() [4/8]

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

Definition at line 714 of file G4IonTable.cc.

715{
716 return FindIon(Z, A, 0.0, G4Ions::FloatLevelBase(lvl), 0);
717}

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

◆ FindIon() [5/8]

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

Definition at line 664 of file G4IonTable.cc.

666{
667 return FindIon(Z, A, LL, E, G4Ions::FloatLevelBase(flbChar), J);
668}

◆ FindIon() [6/8]

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

Definition at line 658 of file G4IonTable.cc.

659{
660 return (LL == 0) ? FindIon(Z, A, E, G4Ions::G4FloatLevelBase::no_Float, J)
661 : FindIon(Z, A, LL, E, G4Ions::G4FloatLevelBase::no_Float, J);
662}

◆ FindIon() [7/8]

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

Definition at line 670 of file G4IonTable.cc.

672{
673 if (LL == 0) return FindIon(Z, A, E, flb, J);
674
675 if (A < 2 || Z < 0 || Z > A - LL || LL > A || A > 999) {
676#ifdef G4VERBOSE
677 if (GetVerboseLevel() > 0) {
678 G4cout << "G4IonTable::FindIon(): illegal atomic number/mass"
679 << " or excitation level:" << G4endl << " Z =" << Z << " A = " << A << " L = " << LL
680 << " E = " << E / keV << G4endl;
681 }
682#endif
683 G4Exception("G4IonTable::FindIon()", "PART107", JustWarning, "illegal atomic number/mass");
684 return nullptr;
685 }
686 // Search ions with A, Z ,E
687 // !! J is omitted now !!
688 const G4ParticleDefinition* ion = nullptr;
689 G4bool isFound = false;
690
691 // -- loop over all particles in Ion table
692 G4int encoding = GetNucleusEncoding(Z, A, LL, 0.0, 0);
693 for (auto i = fIonList->find(encoding); i != fIonList->cend(); ++i) {
694 ion = i->second;
695 if ((ion->GetAtomicNumber() != Z) || (ion->GetAtomicMass() != A)) break;
696 if (ion->GetQuarkContent(3) != LL) break;
697 // excitation level
698 G4double anExcitaionEnergy = ((const G4Ions*)(ion))->GetExcitationEnergy();
699 if (std::fabs(E - anExcitaionEnergy) < pNuclideTable->GetLevelTolerance()) {
700 if (((const G4Ions*)(ion))->GetFloatLevelBase() == flb) {
701 isFound = true;
702 break;
703 }
704 }
705 }
706
707 if (isFound) {
708 return const_cast<G4ParticleDefinition*>(ion);
709 }
710
711 return nullptr;
712}

◆ FindIon() [8/8]

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

Definition at line 719 of file G4IonTable.cc.

720{
721 return (LL == 0) ? FindIon(Z, A, 0.0, G4Ions::FloatLevelBase(lvl), 0)
722 : FindIon(Z, A, LL, 0.0, G4Ions::G4FloatLevelBase::no_Float, 0);
723}

◆ FindIonInMaster() [1/4]

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

Definition at line 1410 of file G4IonTable.cc.

1412{
1413 // Search ions with A, Z ,E
1414 // !! J is omitted now !!
1415 const G4ParticleDefinition* ion = nullptr;
1416 G4bool isFound = false;
1417
1418 // -- loop over all particles in Ion table
1420 for (auto i = fIonListShadow->find(encoding); i != fIonListShadow->cend(); ++i) {
1421 ion = i->second;
1422 if ((ion->GetAtomicNumber() != Z) || (ion->GetAtomicMass() != A)) break;
1423 // excitation level
1424 G4double anExcitaionEnergy = ((const G4Ions*)(ion))->GetExcitationEnergy();
1425 if (std::fabs(E - anExcitaionEnergy) < pNuclideTable->GetLevelTolerance()) {
1426 if (((const G4Ions*)(ion))->GetFloatLevelBase() == flb) {
1427 isFound = true;
1428 break;
1429 }
1430 }
1431 }
1432
1433 if (isFound) {
1434 return const_cast<G4ParticleDefinition*>(ion);
1435 }
1436
1437 return nullptr;
1438}

◆ FindIonInMaster() [2/4]

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

Definition at line 1473 of file G4IonTable.cc.

1474{
1475 // Search ions with A, Z ,E
1476 // !! J is omitted now !!
1477 const G4ParticleDefinition* ion = nullptr;
1478 G4bool isFound = false;
1479
1480 // -- loop over all particles in Ion table
1482 for (auto i = fIonListShadow->find(encoding); i != fIonListShadow->cend(); ++i) {
1483 ion = i->second;
1484 if ((ion->GetAtomicNumber() != Z) || (ion->GetAtomicMass() != A)) break;
1485 // Excitation level
1486 if (((const G4Ions*)(ion))->GetIsomerLevel() == lvl) {
1487 isFound = true;
1488 break;
1489 }
1490 }
1491
1492 if (isFound) {
1493 return const_cast<G4ParticleDefinition*>(ion);
1494 }
1495
1496 return nullptr;
1497}

Referenced by GetIon(), and GetIon().

◆ FindIonInMaster() [3/4]

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

Definition at line 1440 of file G4IonTable.cc.

1442{
1443 if (LL == 0) return FindIon(Z, A, E, flb, J);
1444
1445 // Search ions with A, Z ,E
1446 // !! J is omitted now !!
1447 const G4ParticleDefinition* ion = nullptr;
1448 G4bool isFound = false;
1449
1450 // -- loop over all particles in Ion table
1451 G4int encoding = GetNucleusEncoding(Z, A, LL, 0.0, 0);
1452 for (auto i = fIonListShadow->find(encoding); i != fIonListShadow->cend(); ++i) {
1453 ion = i->second;
1454 if ((ion->GetAtomicNumber() != Z) || (ion->GetAtomicMass() != A)) break;
1455 if (ion->GetQuarkContent(3) != LL) break;
1456 // Excitation level
1457 G4double anExcitaionEnergy = ((const G4Ions*)(ion))->GetExcitationEnergy();
1458 if (std::fabs(E - anExcitaionEnergy) < pNuclideTable->GetLevelTolerance()) {
1459 if (((const G4Ions*)(ion))->GetFloatLevelBase() == flb) {
1460 isFound = true;
1461 break;
1462 }
1463 }
1464 }
1465
1466 if (isFound) {
1467 return const_cast<G4ParticleDefinition*>(ion);
1468 }
1469
1470 return nullptr;
1471}

◆ FindIonInMaster() [4/4]

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

Definition at line 1499 of file G4IonTable.cc.

1500{
1501 if (LL == 0) return FindIon(Z, A, lvl);
1502
1503 // Search ions with A, Z ,E, lvl
1504 const G4ParticleDefinition* ion = nullptr;
1505 G4bool isFound = false;
1506
1507 // -- loop over all particles in Ion table
1509 for (auto i = fIonListShadow->find(encoding); i != fIonListShadow->cend(); ++i) {
1510 ion = i->second;
1511 if ((ion->GetAtomicNumber() != Z) || (ion->GetAtomicMass() != A)) break;
1512 if (ion->GetQuarkContent(3) != LL) break;
1513 // excitation level
1514 if (((const G4Ions*)(ion))->GetIsomerLevel() == lvl) {
1515 isFound = true;
1516 break;
1517 }
1518 }
1519
1520 if (isFound) {
1521 return const_cast<G4ParticleDefinition*>(ion);
1522 }
1523
1524 return nullptr;
1525}

◆ FindIsotope() [1/2]

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

Definition at line 1290 of file G4IonTable.cc.

1292{
1293 if (fIsotopeTableList == nullptr) return nullptr;
1294 if (fIsotopeTableList->empty()) return nullptr;
1295
1296 G4IsotopeProperty* property = nullptr;
1297
1298 for (std::size_t i = 0; i < fIsotopeTableList->size(); ++i) {
1299 G4VIsotopeTable* fIsotopeTable = (*fIsotopeTableList)[fIsotopeTableList->size() - i - 1];
1300 property = fIsotopeTable->GetIsotope(Z, A, E, flb);
1301 if (property != nullptr) break;
1302 }
1303
1304 return property;
1305}
virtual G4IsotopeProperty * GetIsotope(G4int Z, G4int A, G4double E, G4Ions::G4FloatLevelBase flb=G4Ions::G4FloatLevelBase::no_Float)=0

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

◆ FindIsotope() [2/2]

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

Definition at line 1307 of file G4IonTable.cc.

1308{
1309 if (fIsotopeTableList == nullptr) return nullptr;
1310 if (fIsotopeTableList->empty()) return nullptr;
1311
1312 G4IsotopeProperty* property = nullptr;
1313
1314 // iterate
1315 for (std::size_t i = 0; i < fIsotopeTableList->size(); ++i) {
1316 G4VIsotopeTable* fIsotopeTable = (*fIsotopeTableList)[fIsotopeTableList->size() - i - 1];
1317 property = fIsotopeTable->GetIsotope(Z, A, lvl);
1318 if (property != nullptr) break;
1319 }
1320
1321 return property;
1322}

◆ GetIon() [1/9]

G4ParticleDefinition * G4IonTable::GetIon ( G4int encoding)

Definition at line 574 of file G4IonTable.cc.

575{
576 G4int Z, A, LL, IsoLvl;
577 G4double E;
578 if (!GetNucleusByEncoding(encoding, Z, A, LL, E, IsoLvl)) {
579#ifdef G4VERBOSE
580 if (GetVerboseLevel() > 0) {
581 G4cout << "G4IonTable::GetIon() : illegal encoding"
582 << " CODE:" << encoding << G4endl;
583 }
584#endif
585 G4Exception("G4IonTable::GetIon()", "PART106", JustWarning, "illegal encoding for an ion");
586 return nullptr;
587 }
588 return GetIon(Z, A, LL, IsoLvl);
589}
static G4bool GetNucleusByEncoding(G4int encoding, G4int &Z, G4int &A, G4double &E, G4int &lvl)
G4ParticleDefinition * GetIon(G4int Z, G4int A, G4int lvl=0)

◆ GetIon() [2/9]

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

Definition at line 461 of file G4IonTable.cc.

462{
463 return GetIon(Z, A, E, G4Ions::FloatLevelBase(flbChar), J);
464}

◆ GetIon() [3/9]

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

Definition at line 456 of file G4IonTable.cc.

457{
459}

◆ GetIon() [4/9]

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

Definition at line 466 of file G4IonTable.cc.

468{
469 if ((A < 1) || (Z <= 0) || (E < 0.0) || (A > 999) || (J < 0)) {
470#ifdef G4VERBOSE
471 if (GetVerboseLevel() > 0) {
472 G4cout << "G4IonTable::GetIon() : illegal atomic number/mass"
473 << " Z =" << Z << " A = " << A << " E = " << E / keV << G4endl;
474 }
475#endif
476 return nullptr;
477 }
478 auto flb1 = flb;
479
480 // Search ions with A, Z
481 G4ParticleDefinition* ion = FindIon(Z, A, E, flb, J);
482
483 // find out ground state floating level
484 if (ion == nullptr && E == 0.0) {
485 const G4IsotopeProperty* fProperty = FindIsotope(Z, A, E, flb);
486 if (nullptr != fProperty) {
487 flb1 = fProperty->GetFloatLevelBase();
488 if (flb != flb1) {
489 ion = FindIon(Z, A, E, flb1, J);
490 }
491 }
492 }
493
494 // create ion
495#ifdef G4MULTITHREADED
496 if (ion == nullptr) {
498 G4MUTEXLOCK(&G4IonTable::ionTableMutex);
499 ion = FindIonInMaster(Z, A, E, flb1, J);
500 if (ion == nullptr) ion = CreateIon(Z, A, E, flb1);
501 InsertWorker(ion);
502 G4MUTEXUNLOCK(&G4IonTable::ionTableMutex);
503 }
504 else {
505 ion = CreateIon(Z, A, E, flb1);
506 }
507 }
508#else
509 if (ion == nullptr) ion = CreateIon(Z, A, E, flb1);
510#endif
511
512 return ion;
513}
#define G4MUTEXLOCK(mutex)
#define G4MUTEXUNLOCK(mutex)
void InsertWorker(const G4ParticleDefinition *particle)
G4ParticleDefinition * FindIonInMaster(G4int Z, G4int A, G4int lvl=0)
G4Ions::G4FloatLevelBase GetFloatLevelBase() const

◆ GetIon() [5/9]

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

Definition at line 445 of file G4IonTable.cc.

446{
447 return GetIon(Z, A, 0.0, G4Ions::G4FloatLevelBase(lvl), 0);
448}

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

◆ GetIon() [6/9]

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

Definition at line 520 of file G4IonTable.cc.

522{
523 return GetIon(Z, A, LL, E, G4Ions::FloatLevelBase(flbChar), J);
524}

◆ GetIon() [7/9]

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

Definition at line 515 of file G4IonTable.cc.

516{
517 return GetIon(Z, A, LL, E, G4Ions::G4FloatLevelBase::no_Float, J);
518}

◆ GetIon() [8/9]

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

Definition at line 526 of file G4IonTable.cc.

528{
529 if (LL == 0) return GetIon(Z, A, E, flb, J);
530
531 if (A < 2 || Z < 0 || Z > A - LL || LL > A || A > 999) {
532#ifdef G4VERBOSE
533 if (GetVerboseLevel() > 0) {
534 G4cout << "G4IonTable::GetIon() : illegal atomic number/mass"
535 << " Z =" << Z << " A = " << A << " L = " << LL << " E = " << E / keV << G4endl;
536 }
537#endif
538 return nullptr;
539 }
540 if (A == 2) {
541#ifdef G4VERBOSE
542 if (GetVerboseLevel() > 0) {
543 G4cout << "G4IonTable::GetIon() : No boud state for "
544 << " Z =" << Z << " A = " << A << " L = " << LL << " E = " << E / keV << G4endl;
545 }
546#endif
547 return nullptr;
548 }
549
550 // Search ions with A, Z
551 G4ParticleDefinition* ion = FindIon(Z, A, LL, E, flb, J);
552
553 // create ion
554#ifdef G4MULTITHREADED
555 if (ion == nullptr) {
557 G4MUTEXLOCK(&G4IonTable::ionTableMutex);
558 ion = FindIonInMaster(Z, A, LL, E, flb, J);
559 if (ion == nullptr) ion = CreateIon(Z, A, LL, E, flb);
560 InsertWorker(ion);
561 G4MUTEXUNLOCK(&G4IonTable::ionTableMutex);
562 }
563 else {
564 ion = CreateIon(Z, A, LL, E, flb);
565 }
566 }
567#else
568 if (ion == nullptr) ion = CreateIon(Z, A, LL, E, flb);
569#endif
570
571 return ion;
572}

◆ GetIon() [9/9]

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

Definition at line 450 of file G4IonTable.cc.

451{
452 return (LL == 0) ? GetIon(Z, A, 0.0, G4Ions::G4FloatLevelBase(lvl), 0)
453 : GetIon(Z, A, LL, 0.0, G4Ions::G4FloatLevelBase::no_Float, 0);
454}

◆ GetIonMass()

◆ GetIonName() [1/4]

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

Definition at line 820 of file G4IonTable.cc.

822{
823 G4String name = GetIonName(Z, A, 0);
824
825 // Excited energy or floating level
826 if (E > 0 || flb != G4Ions::G4FloatLevelBase::no_Float) {
827 std::ostringstream os;
828 os.setf(std::ios::fixed);
829 os.precision(3);
830 // Excited nucleus
831 os << '[' << E / keV;
834 }
835 os << ']';
836 name += os.str();
837 }
838
839 return name;
840}

◆ GetIonName() [2/4]

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

Definition at line 854 of file G4IonTable.cc.

855{
856 std::ostringstream os;
857
858 // Atomic number
859 if ((0 < Z) && (Z <= numberOfElements)) {
860 os << elementName[Z - 1];
861 }
862 else {
863 os << "E" << Z << "-";
864 }
865 // Atomic Mass
866 os << A;
867
868 if (lvl > 0) {
869 // Isomer level for Excited nucelus
870 os << '[' << lvl << ']';
871 }
872 G4String name = os.str();
873 return name;
874}
static const G4String elementName[numberOfElements]

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

◆ GetIonName() [3/4]

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

Definition at line 842 of file G4IonTable.cc.

844{
845 if (LL == 0) return GetIonName(Z, A, E, flb);
846 G4String name = "";
847 for (G4int i = 0; i < LL; ++i) {
848 name += "L";
849 }
850 name += GetIonName(Z, A, E, flb);
851 return name;
852}

◆ GetIonName() [4/4]

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

Definition at line 876 of file G4IonTable.cc.

877{
878 if (LL == 0) return GetIonName(Z, A, lvl);
879 G4String name = "";
880 for (G4int i = 0; i < LL; ++i) {
881 name += "L";
882 }
883 name += GetIonName(Z, A, lvl);
884 return name;
885}

◆ GetIonTable()

◆ GetIsomerMass()

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

Definition at line 1058 of file G4IonTable.cc.

1059{
1060 return GetNucleusMass(Z, A, 0, lvl);
1061}

◆ GetIsotopeTable()

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

Definition at line 1281 of file G4IonTable.cc.

1282{
1283 G4VIsotopeTable* fIsotopeTable = nullptr;
1284 if (index < fIsotopeTableList->size()) {
1285 fIsotopeTable = (*fIsotopeTableList)[index];
1286 }
1287 return fIsotopeTable;
1288}
G4int size() const

◆ GetLifeTime() [1/3]

G4double G4IonTable::GetLifeTime ( const G4ParticleDefinition * particle) const

Definition at line 1527 of file G4IonTable.cc.

1528{
1529 if ((particle->IsGeneralIon()) && (pNuclideTable == nullptr)) {
1530 G4Exception("G4IonTable::GetLifeTime()", "ParticleIon1001", FatalException,
1531 "Method is invoked before G4IonTable is initialized.");
1532 return 0.;
1533 }
1534 return particle->GetPDGLifeTime();
1535}
G4double GetPDGLifeTime() const

Referenced by GetLifeTime().

◆ GetLifeTime() [2/3]

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

Definition at line 1537 of file G4IonTable.cc.

1538{
1539 return GetLifeTime(Z, A, E, G4Ions::FloatLevelBase(flbChar));
1540}
G4double GetLifeTime(const G4ParticleDefinition *) const

◆ GetLifeTime() [3/3]

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

Definition at line 1542 of file G4IonTable.cc.

1543{
1544 G4double life = -1001.0;
1545 const G4IsotopeProperty* fProperty = FindIsotope(Z, A, E, flb);
1546 if (fProperty != nullptr) life = fProperty->GetLifeTime();
1547 return life;
1548}

◆ GetLightAntiIon()

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

Definition at line 972 of file G4IonTable.cc.

973{
974 // Returns pointer to pre-defined ions
975 const G4ParticleDefinition* ion = nullptr;
976 if ((Z <= 2)) {
977#ifndef G4MULTITHREADED
978 // In sequential use lazy-initialization
980#endif
981 if ((Z == 1) && (A == 1)) {
982 ion = antilightions::p_proton;
983 }
984 else if ((Z == 1) && (A == 2)) {
985 ion = antilightions::p_deuteron;
986 }
987 else if ((Z == 1) && (A == 3)) {
988 ion = antilightions::p_triton;
989 }
990 else if ((Z == 2) && (A == 4)) {
991 ion = antilightions::p_alpha;
992 }
993 else if ((Z == 2) && (A == 3)) {
994 ion = antilightions::p_He3;
995 }
996 }
997 return const_cast<G4ParticleDefinition*>(ion);
998}

◆ GetLightIon()

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

Definition at line 944 of file G4IonTable.cc.

945{
946 // Returns pointer to pre-defined ions
947 const G4ParticleDefinition* ion = nullptr;
948 if ((Z <= 2)) {
949#ifndef G4MULTITHREADED
950 // In sequential use lazy-initialization
952#endif
953 if ((Z == 1) && (A == 1)) {
954 ion = lightions::p_proton;
955 }
956 else if ((Z == 1) && (A == 2)) {
957 ion = lightions::p_deuteron;
958 }
959 else if ((Z == 1) && (A == 3)) {
960 ion = lightions::p_triton;
961 }
962 else if ((Z == 2) && (A == 4)) {
963 ion = lightions::p_alpha;
964 }
965 else if ((Z == 2) && (A == 3)) {
966 ion = lightions::p_He3;
967 }
968 }
969 return const_cast<G4ParticleDefinition*>(ion);
970}
void Init()
Definition G4IonTable.cc:75

Referenced by FindIon(), and GetNucleusMass().

◆ GetMuonicAtom() [1/2]

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

Definition at line 1632 of file G4IonTable.cc.

1633{
1634 // Need the cast because we need a G4Ions* to pass into the
1635 // function, but GetIon returns a G4ParticleDefinition*
1636 auto base = static_cast<G4Ions const*>(GetIon(Z, A, 0.0));
1637 return GetMuonicAtom(base);
1638}
G4ParticleDefinition * GetMuonicAtom(G4Ions const *)

◆ GetMuonicAtom() [2/2]

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

Definition at line 1550 of file G4IonTable.cc.

1551{
1552 if (base == nullptr || !IsIon(base)) {
1553 G4Exception("G4IonTable::GetMuonicAtom()", "PART987654321", FatalException,
1554 "Constructor argument is not a G4Ions");
1555 return nullptr;
1556 }
1557
1558 // We're assuming here that we get a base that is actually
1559 // constructed and unexcited ... strip excitations, Lambdas, and
1560 // isomers from the encoding
1561
1562 auto const Z = base->GetAtomicNumber();
1563 auto const A = base->GetAtomicMass();
1564 auto const baseenc = GetNucleusEncoding(Z, A);
1565 auto const encoding = baseenc + 1000000000;
1566
1567 // We have to do all the MT manipulations manually, because the
1568 // convenience functions assume a G4Ions with canonical PDG codes;
1569 // they recalculate the encoding from particle properties rather
1570 // than using the carried member function values. Thus, they will
1571 // do operations on the base ion, rather than the passed in
1572 // G4MuonicAtom
1573
1574 auto i = fIonList->find(encoding);
1575 if (i != fIonList->cend()) {
1576 return const_cast<G4ParticleDefinition*>(i->second);
1577 }
1578 // not in threadlocal list; check global list ...
1579#ifdef G4MULTITHREADED
1581 G4MUTEXLOCK(&G4IonTable::ionTableMutex);
1582 i = fIonListShadow->find(encoding);
1583 auto end = fIonListShadow->cend();
1584 G4MUTEXUNLOCK(&G4IonTable::ionTableMutex);
1585 if (i != end) {
1586 // we found it, stuff it into the threadlocal list
1587 fIonList->insert(*i);
1588 // and then return it ...
1589 return const_cast<G4ParticleDefinition*>(i->second);
1590 }
1591 }
1592#endif
1593
1594 // not found in either list; create and potentially insert
1595 auto const name = "Mu" + GetIonName(Z, A);
1596
1598
1599 // Not sure this is doing the right thing...
1600 AddProcessManager(muatom);
1601
1602 // Now, we have to push the muatom into the appropriate IonTables
1603 // first, recheck global list, in case another thread came along
1604 // before us and created this same muatom
1605
1606#ifdef G4MULTITHREADED
1608 G4MUTEXLOCK(&G4IonTable::ionTableMutex);
1609 // first, we need to make sure it hasn't been inserted by some
1610 // other thread
1611 auto j = fIonListShadow->find(encoding);
1612 if (j != fIonListShadow->cend()) {
1613 // oops ... someone else built a copy when we weren't looking;
1614 // cleanup our instantiation, and take a handle to the one in
1615 // the global list
1616 delete muatom;
1617 muatom = const_cast<G4MuonicAtom*>(static_cast<G4MuonicAtom const*>(j->second));
1618 }
1619 else {
1620 // otherwise, push onto the global list first
1621 fIonListShadow->insert(std::make_pair(encoding, muatom));
1622 }
1623 G4MUTEXUNLOCK(&G4IonTable::ionTableMutex);
1624 }
1625#endif
1626 // in either case, push onto the the threadlocal list
1627 fIonList->insert(std::make_pair(encoding, muatom));
1628
1629 return muatom;
1630}
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 765 of file G4IonTable.cc.

766{
767 if (encoding <= 0) return false; // anti particle
768
769 if (encoding == 2212) // proton
770 {
771 Z = 1;
772 A = 1;
773 E = 0.0;
774 lvl = 0;
775 return true;
776 }
777
778 encoding -= 1000000000;
779 Z = encoding / 10000;
780 encoding -= 10000 * Z;
781 A = encoding / 10;
782 lvl = encoding % 10;
783 return true;
784}

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 786 of file G4IonTable.cc.

788{
789 if (encoding <= 0) return false; // anti particle
790
791 if (encoding == 3122) // Lambda
792 {
793 Z = 1;
794 A = 1;
795 LL = 1;
796 E = 0.0;
797 lvl = 0;
798 return true;
799 }
800
801 if (encoding % 10 != 0) {
802 // !!!not supported for excitation states !!!
803 return false;
804 }
805 if (encoding < 1000000000) {
806 // anti particle
807 return false;
808 }
809
810 encoding -= 1000000000;
811 LL = encoding / 10000000;
812 encoding -= 10000000 * LL;
813 Z = encoding / 10000;
814 encoding -= 10000 * Z;
815 A = encoding / 10;
816 lvl = encoding % 10;
817 return true;
818}

◆ GetNucleusEncoding() [1/2]

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

Definition at line 725 of file G4IonTable.cc.

726{
727 // PDG code for Ions
728 // Nuclear codes are given as 10-digit numbers +-100ZZZAAAI.
729 // For a nucleus consisting of np protons and nn neutrons
730 // A = np + nn and Z = np.
731 // I gives the isomer level, with I = 0 corresponding
732 // to the ground state and I >0 to excitations
733
734 if (Z == 1 && A == 1 && E == 0.0) return 2212; // proton
735
736 G4int encoding = 1000000000;
737 encoding += Z * 10000;
738 encoding += A * 10;
739 if (lvl > 0 && lvl < 10)
740 encoding += lvl; // isomer level
741 else if (E > 0.0)
742 encoding += 9; // isomer level
743
744 return encoding;
745}

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

◆ GetNucleusEncoding() [2/2]

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

Definition at line 747 of file G4IonTable.cc.

748{
749 // Get PDG code for Hyper-Nucleus Ions
750 // Nuclear codes are given as 10-digit numbers +-10LZZZAAAI.
751 // For a nucleus consisting of np protons and nn neutrons
752 // A = np + nn +nlambda and Z = np.
753 // LL = nlambda
754 // I gives the isomer level, with I = 0 corresponding
755 // to the ground state and I >0 to excitations
756
757 G4int encoding = GetNucleusEncoding(Z, A, E, lvl);
758 if (LL == 0) return encoding;
759 encoding += LL * 10000000;
760 if (Z == 1 && A == 1 && E == 0.0) encoding = 3122; // Lambda
761
762 return encoding;
763}

◆ GetNucleusMass()

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

Definition at line 1000 of file G4IonTable.cc.

1001{
1002 if ((A < 1) || (Z < 0) || (LL < 0) || (lvl < 0) || (lvl > 9)) {
1003#ifdef G4VERBOSE
1004 if (GetVerboseLevel() > 0) {
1005 G4cout << "G4IonTable::GetNucleusMass() : illegal atomic number/mass:" << G4endl
1006 << " Z =" << Z << " A = " << A << " L = " << LL << " lvl = " << lvl << G4endl;
1007 }
1008#endif
1009 G4Exception("G4IonTable::GetNucleusMass()", "PART107", EventMustBeAborted,
1010 "illegal atomic number/mass");
1011 return -1.0;
1012 }
1013
1014 G4double mass;
1015 if (LL == 0) {
1016 // calculate nucleus mass
1017 const G4ParticleDefinition* ion = GetLightIon(Z, A);
1018
1019 if (ion != nullptr) {
1020 mass = ion->GetPDGMass();
1021 }
1022 else {
1023 // Use G4NucleiProperties::GetNuclearMass
1025 }
1026
1027 // Isomer
1028 if (lvl > 0) {
1029 // -- loop over all particles in Ion table
1031 G4bool isFound = false;
1032 for (auto i = fIonList->find(encoding); i != fIonList->cend(); ++i) {
1033 ion = i->second;
1034 if ((ion->GetAtomicNumber() != Z) || (ion->GetAtomicMass() != A)) break;
1035 // Excitation level
1036 if (((const G4Ions*)(ion))->GetIsomerLevel() == lvl) {
1037 isFound = true;
1038 break;
1039 }
1040 }
1041 if (isFound) {
1042 // Return existing isomer mass
1043 mass = ion->GetPDGMass();
1044 }
1045 else {
1046 // Find isomer from IsotopeTable
1047 const G4IsotopeProperty* fProperty = FindIsotope(Z, A, lvl);
1048 if (fProperty != nullptr) mass += fProperty->GetEnergy();
1049 }
1050 }
1051 }
1052 else {
1054 }
1055 return mass;
1056}
@ EventMustBeAborted
static G4double GetNuclearMass(G4int A, G4int Z, G4int L)
static G4double GetNuclearMass(const G4double A, const G4double Z)

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

◆ GetNumberOfElements()

G4int G4IonTable::GetNumberOfElements ( ) const
inline

Definition at line 306 of file G4IonTable.hh.

307{
308 return numberOfElements;
309}

◆ GetParticle()

G4ParticleDefinition * G4IonTable::GetParticle ( G4int index) const

Definition at line 1356 of file G4IonTable.cc.

1357{
1358 if ((index >= 0) && (index < Entries())) {
1359 auto idx = fIonList->cbegin();
1360 G4int counter = 0;
1361 while (idx != fIonList->cend()) // Loop checking, 09.08.2015, K.Kurashige
1362 {
1363 if (counter == index) {
1364 return const_cast<G4ParticleDefinition*>(idx->second);
1365 }
1366 ++counter;
1367 ++idx;
1368 }
1369 }
1370#ifdef G4VERBOSE
1371 if (GetVerboseLevel() > 1) {
1372 G4cout << " G4IonTable::GetParticle"
1373 << " invalid index (=" << index << ")"
1374 << " entries = " << Entries() << G4endl;
1375 }
1376#endif
1377 return nullptr;
1378}
G4int Entries() const

Referenced by LBE::ConstructGeneral().

◆ GetVerboseLevel()

G4int G4IonTable::GetVerboseLevel ( ) const
protected

◆ InitializeLightIons()

void G4IonTable::InitializeLightIons ( )

Definition at line 184 of file G4IonTable.cc.

185{
188}

Referenced by G4RunManagerKernel::SetupPhysics().

◆ Insert()

void G4IonTable::Insert ( const G4ParticleDefinition * particle)

Definition at line 1085 of file G4IonTable.cc.

1086{
1087 if (!IsIon(particle)) return;
1088 if (Contains(particle)) return;
1089
1090 G4int Z = particle->GetAtomicNumber();
1091 G4int A = particle->GetAtomicMass();
1092 G4int LL = particle->GetQuarkContent(3); // strangeness
1093 G4int encoding = GetNucleusEncoding(Z, A, LL); // encoding of the groud state
1094
1095 // Register the ion with its encoding of the ground state
1096 fIonListShadow->insert(std::pair<const G4int, const G4ParticleDefinition*>(encoding, particle));
1097}
G4bool Contains(const G4ParticleDefinition *particle) const

Referenced by G4ParticleTable::Insert().

◆ InsertWorker()

void G4IonTable::InsertWorker ( const G4ParticleDefinition * particle)
protected

Definition at line 1099 of file G4IonTable.cc.

1100{
1101 if (particle == nullptr) return;
1102
1103 G4int Z = particle->GetAtomicNumber();
1104 G4int A = particle->GetAtomicMass();
1105 G4int LL = particle->GetQuarkContent(3); // strangeness
1107 G4bool found = false;
1108 if (encoding != 0) {
1109 for (auto i = fIonList->find(encoding); i != fIonList->cend(); ++i) {
1110 if (particle == i->second) {
1111 found = true;
1112 break;
1113 }
1114 }
1115 }
1116 if (found) return;
1117
1118 // Register the ion with its encoding of the gronud state
1119 fIonList->insert(std::pair<const G4int, const G4ParticleDefinition*>(encoding, particle));
1120}

Referenced by GetIon(), and GetIon().

◆ IsAntiIon()

G4bool G4IonTable::IsAntiIon ( const G4ParticleDefinition * particle)
static

Definition at line 907 of file G4IonTable.cc.

908{
909 // Return true if the particle is ion
910 static const G4String anti_nucleus("anti_nucleus");
911 static const G4String anti_proton("anti_proton");
912
913 // Anti_neutron is not ion
914 if ((particle->GetAtomicMass() > 0) && (particle->GetAtomicNumber() > 0)) {
915 return particle->GetBaryonNumber() < 0;
916 }
917
918 // Particles derived from G4Ions
919 if (particle->GetParticleType() == anti_nucleus) return true;
920
921 // Anti_proton (Anti_Hydrogen nucleus)
922 if (particle->GetParticleName() == anti_proton) return true;
923
924 return false;
925}
const G4String & GetParticleType() const

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

◆ IsIon()

G4bool G4IonTable::IsIon ( const G4ParticleDefinition * particle)
static

Definition at line 887 of file G4IonTable.cc.

888{
889 // Return true if the particle is ion
890 static const G4String nucleus("nucleus");
891 static const G4String proton("proton");
892
893 // Neutron is not ion
894 if ((particle->GetAtomicMass() > 0) && (particle->GetAtomicNumber() > 0)) {
895 return particle->GetBaryonNumber() > 0;
896 }
897
898 // Particles derived from G4Ions
899 if (particle->GetParticleType() == nucleus) return true;
900
901 // Proton (Hydrogen nucleus)
902 if (particle->GetParticleName() == proton) return true;
903
904 return false;
905}

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 935 of file G4IonTable.cc.

936{
937 static const std::string names[] = {"anti_proton", "anti_alpha", "anti_deuteron", "anti_triton",
938 "anti_He3"};
939
940 // Return true if the particle is pre-defined ion
941 return std::find(names, names + 5, (particle->GetParticleName()).c_str()) != names + 5;
942}

◆ IsLightIon()

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

Definition at line 927 of file G4IonTable.cc.

928{
929 static const std::string names[] = {"proton", "alpha", "deuteron", "triton", "He3"};
930
931 // Return true if the particle is pre-defined ion
932 return std::find(names, names + 5, (particle->GetParticleName()).c_str()) != names + 5;
933}

◆ operator=()

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

◆ PreloadNuclide()

void G4IonTable::PreloadNuclide ( )

Definition at line 1339 of file G4IonTable.cc.

1340{
1341 if (isIsomerCreated || !G4Threading::IsMultithreadedApplication()) return;
1342
1343 pNuclideTable->GenerateNuclide();
1344
1345 for (std::size_t i = 0; i != pNuclideTable->entries(); ++i) {
1346 const G4IsotopeProperty* fProperty = pNuclideTable->GetIsotopeByIndex(i);
1347 G4int Z = fProperty->GetAtomicNumber();
1348 G4int A = fProperty->GetAtomicMass();
1349 G4double Eex = fProperty->GetEnergy();
1350 GetIon(Z, A, Eex);
1351 }
1352
1353 isIsomerCreated = true;
1354}
G4int GetAtomicMass() const
G4int GetAtomicNumber() const
G4IsotopeProperty * GetIsotopeByIndex(std::size_t idx) const
std::size_t entries() const
G4bool IsMultithreadedApplication()

Referenced by CreateAllIon(), and CreateAllIsomer().

◆ PrepareNuclideTable()

void G4IonTable::PrepareNuclideTable ( )

Definition at line 1334 of file G4IonTable.cc.

1335{
1336 if (pNuclideTable == nullptr) pNuclideTable = G4NuclideTable::GetNuclideTable();
1337}

Referenced by G4IonTable().

◆ RegisterIsotopeTable()

void G4IonTable::RegisterIsotopeTable ( G4VIsotopeTable * table)

Definition at line 1270 of file G4IonTable.cc.

1271{
1272 // check duplication
1273 G4String name = table->GetName();
1274 for (const auto fIsotopeTable : *fIsotopeTableList) {
1275 if (name == fIsotopeTable->GetName()) return;
1276 }
1277 // register
1278 fIsotopeTableList->push_back(table);
1279}
const G4String & GetName() const

Referenced by G4IonTable().

◆ Remove()

void G4IonTable::Remove ( const G4ParticleDefinition * particle)

Definition at line 1122 of file G4IonTable.cc.

1123{
1124 if (particle == nullptr) return;
1125#ifdef G4MULTITHREADED
1128 ed << "Request of removing " << particle->GetParticleName()
1129 << " is ignored as it is invoked from a worker thread.";
1130 G4Exception("G4IonTable::Remove()", "PART10117", JustWarning, ed);
1131 return;
1132 }
1133#endif
1134 if (G4ParticleTable::GetParticleTable()->GetReadiness()) {
1136 G4ApplicationState currentState = pStateManager->GetCurrentState();
1137 if (currentState != G4State_PreInit) {
1138 G4String msg = "Request of removing ";
1139 msg += particle->GetParticleName();
1140 msg += " has No effects other than Pre_Init";
1141 G4Exception("G4IonTable::Remove()", "PART117", JustWarning, msg);
1142 return;
1143 }
1144
1145#ifdef G4VERBOSE
1146 if (GetVerboseLevel() > 0) {
1147 G4cout << particle->GetParticleName() << " will be removed from the IonTable " << G4endl;
1148 }
1149#endif
1150 }
1151
1152 if (IsIon(particle)) {
1153 G4int Z = particle->GetAtomicNumber();
1154 G4int A = particle->GetAtomicMass();
1155 G4int LL = particle->GetQuarkContent(3); // strangeness
1157 if (encoding != 0) {
1158 for (auto i = fIonListShadow->find(encoding); i != fIonListShadow->cend(); ++i) {
1159 if (particle == i->second) {
1160 fIonListShadow->erase(i);
1161 break;
1162 }
1163 }
1164 }
1165 }
1166 else {
1167#ifdef G4VERBOSE
1168 if (GetVerboseLevel() > 1) {
1169 G4cout << "G4IonTable::Remove :" << particle->GetParticleName() << " is not ions" << G4endl;
1170 }
1171#endif
1172 }
1173}
G4ApplicationState
@ G4State_PreInit
const G4ApplicationState & GetCurrentState() const
static G4StateManager * GetStateManager()

Referenced by G4ParticleTable::Remove().

◆ size()

G4int G4IonTable::size ( ) const

Definition at line 1405 of file G4IonTable.cc.

1406{
1407 return (G4int)fIonList->size();
1408}

Referenced by GetIsotopeTable().

◆ WorkerG4IonTable()

void G4IonTable::WorkerG4IonTable ( )

Definition at line 161 of file G4IonTable.cc.

162{
163 if (fIonList == nullptr) {
164 fIonList = new G4IonList();
165 }
166 else {
167 fIonList->clear();
168 }
169
170 for (const auto& it : *fIonListShadow) {
171 fIonList->insert(it);
172 }
173
174 // Do not copy Isotope Table to Worker thread
175 //
176 if (fIsotopeTableList == nullptr) {
177 fIsotopeTableList = new std::vector<G4VIsotopeTable*>;
178 for (const auto i : *fIsotopeTableListShadow) {
179 fIsotopeTableList->push_back(i);
180 }
181 }
182}

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 1192 of file G4IonTable.hh.

1244{
1245 public:
1246 using G4IonList = std::multimap<G4int, const G4ParticleDefinition*>;
1247 using G4IonListIterator = std::multimap<G4int, const G4ParticleDefinition*>::iterator;
1248
1249 // Constructor, destructor
1250 G4IonTable();
1251 ~G4IonTable();
1252
1253 // Forbidden copy constructor and assignment operator
1254 G4IonTable(const G4IonTable&) = delete;
1255 G4IonTable& operator=(const G4IonTable&) = delete;
1256
1257 static G4IonTable* GetIonTable();
1258
1259 // Method is used by each worker thread to copy the content
1260 // from the master thread.
1261 void WorkerG4IonTable();
1262
1263 // Destructor for worker
1265
1266 // Get number of elements defined in the IonTable
1267 G4int GetNumberOfElements() const;
1268
1269 // Register Isotope table
1271
1272 // G4IonTable asks properties of isotopes to G4VIsotopeTable
1273 // by using FindIsotope(G4IsotopeProperty* property) method
1274 G4VIsotopeTable* GetIsotopeTable(std::size_t idx = 0) const;
1275
1276 // All ground state ions are created.
1277 // Stable ground states are defined in G4NuclearProperty
1278 void CreateAllIon();
1279
1280 // All excited ions with long life time (>1.0*ns) are created.
1281 // Isomers are defined in G4VIsotopeTable
1282 void CreateAllIsomer();
1283
1284 // All nuclide with a life time longer than certain value are created
1285 // prior to the event loop
1286 void PrepareNuclideTable();
1287 void PreloadNuclide();
1288
1289 // --------------------------------------------------------------
1290 // FindIon/GetIon
1291 // FindIon() methods return pointer of ion if it exists.
1292 // GetIon() methods also return pointer of ion; the designated
1293 // ion is created if it does not exist.
1294 //
1295 // !! PDGCharge in G4ParticleDefinition of ions is !!
1296 // !! electric charge of nucleus (i.e. fully ionized ions) !!
1297 // --------------------------------------------------------------
1298
1299 // Find/Get "ground state" and "excited state"
1300 //
1305 G4int J = 0);
1306 G4ParticleDefinition* GetIon(G4int Z, G4int A, G4double E, char flbChar, G4int J = 0);
1309 G4Ions::G4FloatLevelBase flb, G4int J = 0);
1310 G4ParticleDefinition* GetIon(G4int Z, G4int A, G4int nL, G4double E, char flbChar, G4int J = 0);
1311 // Z: Atomic Number
1312 // A: Atomic Mass (nn + np +nlambda)
1313 // nL: Number of Lambda
1314 // E: Excitation energy
1315 // lvl: Isomer Level 0: ground state)
1316 // flb: Floating level base (enum defined in G4Ions.hh)
1317 // flbChar: Floating level base denoted by a character
1318 // (<null>,X,Y,Z,U,V,W,R,S,T,A,B,C,D,E)
1319 // J: Total Angular momentum (in unit of 1/2) : not used
1320
1321 // The ion can be retrieved by using PDG encoding
1322 // !! Only ground state can be obtained .i.e. Isomer = 0
1324
1325 // Find/Get "excited state"
1326 //
1331 G4int J = 0);
1332 G4ParticleDefinition* FindIon(G4int Z, G4int A, G4double E, char flbChar, G4int J = 0);
1335 G4Ions::G4FloatLevelBase flb, G4int J = 0);
1336 G4ParticleDefinition* FindIon(G4int Z, G4int A, G4int nL, G4double E, char flbChar,
1337 G4int J = 0);
1338 // Z: Atomic Number
1339 // A: Atomic Mass (nn + np +nlambda)
1340 // nL: Number of Lambda
1341 // E: Excitaion energy
1342 // lvl: Isomer Level 0: ground state)
1343 // flb: Floating level base (enum defined in G4Ions.hh)
1344 // flbChar: Floating level base denoted by a character
1345 // (<null>,X,Y,Z,U,V,W,R,S,T,A,B,C,D,E)
1346 // J: Total Angular momentum (in unit of 1/2) : not used
1347
1348 // Return true if the particle is ion
1349 static G4bool IsIon(const G4ParticleDefinition*);
1350
1351 // Return true if the particle is anti_ion
1352 static G4bool IsAntiIon(const G4ParticleDefinition*);
1353
1354 // Get ion name
1355 G4String GetIonName(G4int Z, G4int A, G4int lvl = 0) const;
1360 G4String GetIonName(G4int Z, G4int A, G4int nL, G4int lvl) const;
1361
1362 // Get PDG code for Ions.
1363 // Nuclear codes are given as 10-digit numbers +-100ZZZAAAI.
1364 // For a nucleus consisting of np protons and nn neutrons
1365 // A = np + nn and Z = np.
1366 // I gives the isomer level, with I = 0 corresponding
1367 // to the ground state and I >0 to excitations
1368 static G4int GetNucleusEncoding(G4int Z, G4int A, G4double E = 0.0, G4int lvl = 0);
1369
1370 // Get PDG code for Hyper-Nucleus Ions.
1371 // Nuclear codes are given as 10-digit numbers +-10LZZZAAAI.
1372 // For a nucleus consisting of np protons and nn neutrons
1373 // A = np + nn +nlambda and Z = np.
1374 // nL = nlambda
1375 // I gives the isomer level, with I = 0 corresponding
1376 // to the ground state and I >0 to excitations
1377 static G4int GetNucleusEncoding(G4int Z, G4int A, G4int nL, G4double E = 0.0, G4int lvl = 0);
1378
1381 G4int& lvl);
1382 // Energy will not be given even for excited state!!
1383
1384 // These methods returns Nucleus (i.e. full ionized atom) mass, where
1385 // Z is Atomic Number (number of protons) and
1386 // A is Atomic Number (number of nucleons and hyperons)
1387 // nL is number of lambda (A= nn + np + nlambda)
1388 // lvl is isomer level
1389 G4double GetIonMass(G4int Z, G4int A, G4int nL = 0, G4int lvl = 0) const;
1390 G4double GetNucleusMass(G4int Z, G4int A, G4int nL = 0, G4int lvl = 0) const;
1391 G4double GetIsomerMass(G4int Z, G4int A, G4int lvl = 0) const;
1392
1393 // Returns a life time of an ion. -1 for stable ion, and -1001 for ion
1394 // that is not listed in G4NuclideTable
1398 G4double GetLifeTime(G4int Z, G4int A, G4double E, char flbChar) const;
1399
1402
1403 // Return number of ions in the table
1404 G4int Entries() const;
1405
1406 // Return the pointer of index-th ion in the table
1408
1409 // Return 'true' if the ion exists
1410 G4bool Contains(const G4ParticleDefinition* particle) const;
1411
1412 // Insert/Remove an ion in the table
1413 void Insert(const G4ParticleDefinition* particle);
1414 void Remove(const G4ParticleDefinition* particle);
1415
1416 // Erase all contents in the list (not delete just remove)
1417 void clear();
1418
1419 // Return number of ions in the table
1420 G4int size() const;
1421
1422 // Dump information of particles specified by name
1423 void DumpTable(const G4String& particle_name = "ALL") const;
1424
1425 public:
1426 // Needed for MT
1427 void InitializeLightIons();
1428
1429 // It is very important for multithreaded Geant4 to keep only one copy of
1430 // the particle table pointer and the ion table pointer. However, we try
1431 // to let each worker thread hold its own copy of the particle dictionary
1432 // and the ion list. This implementation is equivalent to make the ion
1433 // table thread private. The two shadow ponters are used by each worker
1434 // thread to copy the content from the master thread
1436 static G4ThreadLocal std::vector<G4VIsotopeTable*>* fIsotopeTableList;
1437 static G4IonList* fIonListShadow;
1438 static std::vector<G4VIsotopeTable*>* fIsotopeTableListShadow;
1439
1440 enum
1441 {
1442 numberOfElements = 118
1443 };
1445
1446#ifdef G4MULTITHREADED
1447 static G4Mutex ionTableMutex;
1448#endif
1449
1450 protected:
1454 G4Ions::G4FloatLevelBase flb, G4int J = 0);
1456 G4Ions::G4FloatLevelBase flb, G4int J = 0);
1457
1463
1464 void InsertWorker(const G4ParticleDefinition* particle);
1465
1466 // Create Ion
1467
1469 G4Ions::G4FloatLevelBase flb) const;
1471 // Ask properties of isotopes
1472
1475
1476 // Return true if the particle is pre-defined ion
1479
1480 // Add process manager to ions with name of 'ionName'
1482
1483 // Get Verbose Level defined in G4ParticleTable
1484 G4int GetVerboseLevel() const;
1485
1486 private:
1487 G4NuclideTable* pNuclideTable = nullptr;
1488
1489 // Isomer table and flag of creation
1490 G4bool isIsomerCreated = false;
1491};
1492
1493// ------------------------
1494// Inline methods
1495// ------------------------
1496
1498{
1499 return numberOfElements;
1500}
1501
1502#endif
std::mutex G4Mutex
void Remove(const G4ParticleDefinition *particle)
G4bool IsLightAntiIon(const G4ParticleDefinition *) const
void CreateAllIsomer()
G4ParticleDefinition * GetParticle(G4int index) const
G4bool IsLightIon(const G4ParticleDefinition *) const
void DestroyWorkerG4IonTable()
void DumpTable(const G4String &particle_name="ALL") const
void WorkerG4IonTable()
static G4IonTable * GetIonTable()
std::multimap< G4int, const G4ParticleDefinition * >::iterator G4IonListIterator
Definition G4IonTable.hh:56
G4IonTable & operator=(const G4IonTable &)=delete
G4int GetNumberOfElements() const
void Insert(const G4ParticleDefinition *particle)
G4double GetIonMass(G4int Z, G4int A, G4int nL=0, G4int lvl=0) const
G4double GetIsomerMass(G4int Z, G4int A, G4int lvl=0) const
static G4bool IsAntiIon(const G4ParticleDefinition *)
G4VIsotopeTable * GetIsotopeTable(std::size_t idx=0) const
void CreateAllIon()
void InitializeLightIons()
G4ParticleDefinition * GetLightAntiIon(G4int Z, G4int A) const
#define G4ThreadLocal
Definition tls.hh:77

Referenced by GetIonName().

◆ fIonList

◆ fIonListShadow

◆ fIsotopeTableList

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

◆ fIsotopeTableListShadow

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

Definition at line 247 of file G4IonTable.hh.

Referenced by G4IonTable(), and WorkerG4IonTable().


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