88 #ifdef G4MULTITHREADED
91 G4Mutex& G4ParticleTable::particleTableMutex()
96 G4int& G4ParticleTable::lockCount()
98 static G4int _instance = 0;
124 genericMuonicAtom(nullptr)
167 #ifdef G4MULTITHREADED
168 G4MUTEXLOCK(&G4ParticleTable::particleTableMutex());
169 G4ParticleTable::lockCount()++;
186 fDictionary->insert( std::pair<G4String, G4ParticleDefinition*>(
GetKey(particle), particle) );
194 #ifdef G4MULTITHREADED
272 "Illegal call of copy constructor for G4ParticleTable");
281 if (
this != &right) {
284 "Illegal call of assignment operator for G4ParticleTable");
318 G4cout <<
"G4ParticleTable::DeleteAllParticles() " <<
G4endl;
324 piter -> reset(
false);
332 delete (piter->
value());
341 G4Exception(
"G4ParticleTable::RemoveAllParticle()",
343 "No effects because readyToUse is true.");
349 G4cout <<
"G4ParticleTable::RemoveAllParticles() " <<
G4endl;
369 if ((particle ==
nullptr) || (
GetKey(particle).isNull())) {
372 "Particle witnout name can not be registered.");
375 G4cout <<
"The particle[Addr:" << particle <<
"] has no name "<<
G4endl;
390 msg +=
" has already been registered in the Particle Table ";
400 pdic->insert( std::pair<G4String, G4ParticleDefinition*>(
GetKey(particle), particle) );
401 #ifdef G4MULTITHREADED
403 {
fDictionary->insert( std::pair<G4String, G4ParticleDefinition*>(
GetKey(particle), particle) ); }
410 pedic->insert( std::pair<G4int, G4ParticleDefinition*>(code ,particle) );
411 #ifdef G4MULTITHREADED
413 {
fEncodingDictionary->insert( std::pair<G4int, G4ParticleDefinition*>(code ,particle) ); }
428 <<
" is inserted in the ParticleTable " <<
G4endl;
440 if( particle ==
nullptr)
return nullptr;
441 #ifdef G4MULTITHREADED
445 <<
" is ignored as it is invoked from a worker thread.";
454 G4String msg =
"Request of removing ";
456 msg +=
" has No effects other than Pre_Init";
464 <<
" will be removed from the ParticleTable " <<
G4endl;
490 <<
" is removed from the ParticleTable " <<
G4endl;
502 if ( (index >=0) && (index <
entries()) ) {
504 piter -> reset(
false);
507 if ( counter == index )
return piter->
value();
513 G4cout <<
" G4ParticleTable::GetParticle"
514 <<
" invalid index (=" << index <<
")" <<
G4endl;
524 if (aParticle !=
nullptr) {
534 G4PTblDictionary::iterator
it =
fDictionary->find(particle_name);
538 #ifdef G4MULTITHREADED
542 G4MUTEXLOCK(&G4ParticleTable::particleTableMutex());
547 ptcl = (*its).second;
549 if(code!=0)
fEncodingDictionary->insert(std::pair<G4int, G4ParticleDefinition*>(code,ptcl) );
573 if (aPDGEncoding == 0){
576 G4cout <<
"PDGEncoding [" << aPDGEncoding <<
"] is not valid " <<
G4endl;
585 G4PTblEncodingDictionary::iterator
it = pedic->find(aPDGEncoding );
586 if (it != pedic->end()) {
587 particle = (*it).second;
590 #ifdef G4MULTITHREADED
593 G4MUTEXLOCK(&G4ParticleTable::particleTableMutex());
596 particle = (*its).second;
599 fDictionary->insert( std::pair<G4String, G4ParticleDefinition*>(key,particle) );
607 G4cout <<
"CODE:" << aPDGEncoding <<
" does not exist in ParticleTable " <<
G4endl;
617 if (( particle_name ==
"ALL" ) || (particle_name ==
"all")){
627 if ( ptr !=
nullptr) {
632 G4cout <<
" G4ParticleTable::DumpTable : "
633 << particle_name <<
" does not exist in ParticleTable " <<
G4endl;
644 msg =
"Illegal use of G4ParticleTable : ";
645 msg +=
" Access to G4ParticleTable for finding a particle or equivalent\n";
646 msg +=
"operation occurs before G4VUserPhysicsList is instantiated and\n";
647 msg +=
"assigned to G4RunManager. Such an access is prohibited by\n";
648 msg +=
"Geant4 version 8.0. To fix this problem, please make sure that\n";
649 msg +=
"your main() instantiates G4VUserPhysicsList and set it to\n";
650 msg +=
"G4RunManager before instantiating other user classes such as\n";
651 msg +=
"G4VUserPrimaryParticleGeneratorAction.";