89 #ifdef G4MULTITHREADED
92 G4Mutex& G4ParticleTable::particleTableMutex()
97 G4int& G4ParticleTable::lockCount()
99 static G4int _instance = 0;
125 genericMuonicAtom(nullptr)
172 #ifdef G4MULTITHREADED
173 G4MUTEXLOCK(&G4ParticleTable::particleTableMutex());
174 G4ParticleTable::lockCount()++;
191 fDictionary->insert( std::pair<G4String, G4ParticleDefinition*>(
GetKey(particle), particle) );
199 #ifdef G4MULTITHREADED
279 "Illegal call of copy constructor for G4ParticleTable");
287 if (
this != &right) {
290 "Illegal call of assignment operator for G4ParticleTable");
326 G4cout <<
"G4ParticleTable::DeleteAllParticles() " <<
G4endl;
332 piter -> reset(
false);
340 delete (piter->
value());
349 G4Exception(
"G4ParticleTable::RemoveAllParticle()",
351 "No effects because readyToUse is true.");
357 G4cout <<
"G4ParticleTable::RemoveAllParticles() " <<
G4endl;
377 if ((particle == 0) || (
GetKey(particle).isNull())) {
380 "Particle witnout name can not be registered.");
383 G4cout <<
"The particle[Addr:" << particle <<
"] has no name "<<
G4endl;
398 msg +=
" has already been registered in the Particle Table ";
408 pdic->insert( std::pair<G4String, G4ParticleDefinition*>(
GetKey(particle), particle) );
409 #ifdef G4MULTITHREADED
411 {
fDictionary->insert( std::pair<G4String, G4ParticleDefinition*>(
GetKey(particle), particle) ); }
418 pedic->insert( std::pair<G4int, G4ParticleDefinition*>(code ,particle) );
419 #ifdef G4MULTITHREADED
421 {
fEncodingDictionary->insert( std::pair<G4int, G4ParticleDefinition*>(code ,particle) ); }
436 <<
" is inserted in the ParticleTable " <<
G4endl;
448 if(!particle)
return 0;
449 #ifdef G4MULTITHREADED
453 <<
" is ignored as it is invoked from a worker thread.";
462 G4String msg =
"Request of removing ";
464 msg +=
" has No effects other than Pre_Init";
472 <<
" will be removed from the ParticleTable " <<
G4endl;
498 <<
" is removed from the ParticleTable " <<
G4endl;
510 if ( (index >=0) && (index <
entries()) ) {
512 piter -> reset(
false);
515 if ( counter == index )
return piter->
value();
521 G4cout <<
" G4ParticleTable::GetParticle"
522 <<
" invalid index (=" << index <<
")" <<
G4endl;
532 if (aParticle != 0) {
542 G4PTblDictionary::iterator it =
fDictionary->find(particle_name);
546 #ifdef G4MULTITHREADED
550 G4MUTEXLOCK(&G4ParticleTable::particleTableMutex());
555 ptcl = (*its).second;
557 if(code!=0)
fEncodingDictionary->insert(std::pair<G4int, G4ParticleDefinition*>(code,ptcl) );
581 if (aPDGEncoding == 0){
584 G4cout <<
"PDGEncoding [" << aPDGEncoding <<
"] is not valid " <<
G4endl;
593 G4PTblEncodingDictionary::iterator it = pedic->find(aPDGEncoding );
594 if (it != pedic->end()) {
595 particle = (*it).second;
598 #ifdef G4MULTITHREADED
601 G4MUTEXLOCK(&G4ParticleTable::particleTableMutex());
605 particle = (*its).second;
608 fDictionary->insert( std::pair<G4String, G4ParticleDefinition*>(key,particle) );
616 G4cout <<
"CODE:" << aPDGEncoding <<
" does not exist in ParticleTable " <<
G4endl;
626 if (( particle_name ==
"ALL" ) || (particle_name ==
"all")){
642 G4cout <<
" G4ParticleTable::DumpTable : "
643 << particle_name <<
" does not exist in ParticleTable " <<
G4endl;
654 msg =
"Illegal use of G4ParticleTable : ";
655 msg +=
" Access to G4ParticleTable for finding a particle or equivalent\n";
656 msg +=
"operation occurs before G4VUserPhysicsList is instantiated and\n";
657 msg +=
"assigned to G4RunManager. Such an access is prohibited by\n";
658 msg +=
"Geant4 version 8.0. To fix this problem, please make sure that\n";
659 msg +=
"your main() instantiates G4VUserPhysicsList and set it to\n";
660 msg +=
"G4RunManager before instantiating other user classes such as\n";
661 msg +=
"G4VUserPrimaryParticleGeneratorAction.";
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
void DumpTable(const G4String &particle_name="ALL")
static G4bool IsIon(const G4ParticleDefinition *)
void DestroyWorkerG4ParticleTable()
std::ostringstream G4ExceptionDescription
static G4ParticleTable * GetParticleTable()
G4bool contains(const G4ParticleDefinition *particle) const
static G4IonTable * fIonTable
static G4ParticleMessenger * fParticleMessengerShadow
G4UImessenger * CreateMessenger()
const G4String & GetParticleName() const
const G4String & GetKey(const G4ParticleDefinition *particle) const
G4IonTable * GetIonTable() const
const G4PTblDictionary * GetDictionary() const
G4ParticleTableIterator< G4int, G4ParticleDefinition * >::Map G4PTblEncodingDictionary
G4PTblDicIterator * GetIterator() const
void reset(G4bool ifSkipIon=true)
static G4PTblEncodingDictionary * fEncodingDictionaryShadow
static G4ParticleTable * fgParticleTable
G4ParticleTableIterator< G4String, G4ParticleDefinition * >::Map G4PTblDictionary
G4ParticleTableIterator< G4String, G4ParticleDefinition * > G4PTblDicIterator
G4ParticleDefinition * GetParticle(G4int index) const
G4ParticleTable & operator=(const G4ParticleTable &)
static G4PTblDictionary * fDictionaryShadow
#define G4MUTEX_INITIALIZER
static G4ThreadLocal G4ParticleMessenger * fParticleMessenger
void RemoveAllParticles()
void DestroyWorkerG4IonTable()
void DeleteAllParticles()
#define G4MUTEXUNLOCK(mutex)
G4ParticleDefinition * Remove(G4ParticleDefinition *particle)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
G4ApplicationState GetCurrentState() const
void CheckReadiness() const
static G4PTblDicIterator * fIteratorShadow
void WorkerG4ParticleTable()
G4ParticleDefinition * Insert(G4ParticleDefinition *particle)
void Remove(const G4ParticleDefinition *particle)
void SlaveG4ParticleTable()
static G4ThreadLocal G4PTblDicIterator * fIterator
#define G4MUTEXLOCK(mutex)
const G4String & GetParticleName(G4int index) const
G4int GetPDGEncoding() const
G4GLOB_DLL std::ostream G4cout
virtual ~G4ParticleTable()
void SetVerboseLevel(G4int value)
static G4ThreadLocal G4PTblEncodingDictionary * fEncodingDictionary
void Insert(const G4ParticleDefinition *particle)
static G4ThreadLocal G4PTblDictionary * fDictionary
static G4StateManager * GetStateManager()
const G4PTblEncodingDictionary * GetEncodingDictionary() const