88 #ifdef G4MULTITHREADED
92 G4int G4ParticleTable::lockCount = 0;
162 #ifdef G4MULTITHREADED
164 G4ParticleTable::lockCount++;
181 fDictionary->insert( std::pair<G4String, G4ParticleDefinition*>(
GetKey(particle), particle) );
189 #ifdef G4MULTITHREADED
268 "Illegal call of copy constructor for G4ParticleTable");
276 if (
this != &right) {
279 "Illegal call of assignment operator for G4ParticleTable");
315 G4cout <<
"G4ParticleTable::DeleteAllParticles() " <<
G4endl;
321 piter -> reset(
false);
329 delete (piter->
value());
338 G4Exception(
"G4ParticleTable::RemoveAllParticle()",
340 "No effects because readyToUse is true.");
346 G4cout <<
"G4ParticleTable::RemoveAllParticles() " <<
G4endl;
366 if ((particle == 0) || (
GetKey(particle).isNull())) {
369 "Particle witnout name can not be registered.");
372 G4cout <<
"The particle[Addr:" << particle <<
"] has no name "<<
G4endl;
387 msg +=
" has already been registered in the Particle Table ";
397 pdic->insert( std::pair<G4String, G4ParticleDefinition*>(
GetKey(particle), particle) );
398 #ifdef G4MULTITHREADED
400 {
fDictionary->insert( std::pair<G4String, G4ParticleDefinition*>(
GetKey(particle), particle) ); }
407 pedic->insert( std::pair<G4int, G4ParticleDefinition*>(code ,particle) );
408 #ifdef G4MULTITHREADED
410 {
fEncodingDictionary->insert( std::pair<G4int, G4ParticleDefinition*>(code ,particle) ); }
425 <<
" is inserted in the ParticleTable " <<
G4endl;
437 if(!particle)
return 0;
438 #ifdef G4MULTITHREADED
442 <<
" is ignored as it is invoked from a worker thread.";
451 G4String msg =
"Request of removing ";
453 msg +=
" has No effects other than Pre_Init";
461 <<
" will be removed from the ParticleTable " <<
G4endl;
487 <<
" is removed from the ParticleTable " <<
G4endl;
499 if ( (index >=0) && (index <
entries()) ) {
501 piter -> reset(
false);
504 if ( counter == index )
return piter->
value();
510 G4cout <<
" G4ParticleTable::GetParticle"
511 <<
" invalid index (=" << index <<
")" <<
G4endl;
521 if (aParticle != 0) {
531 G4PTblDictionary::iterator it =
fDictionary->find(particle_name);
535 #ifdef G4MULTITHREADED
544 ptcl = (*its).second;
546 if(code!=0)
fEncodingDictionary->insert(std::pair<G4int, G4ParticleDefinition*>(code,ptcl) );
570 if (aPDGEncoding == 0){
573 G4cout <<
"PDGEncoding [" << aPDGEncoding <<
"] is not valid " <<
G4endl;
582 G4PTblEncodingDictionary::iterator it = pedic->find(aPDGEncoding );
583 if (it != pedic->end()) {
584 particle = (*it).second;
587 #ifdef G4MULTITHREADED
594 particle = (*its).second;
597 fDictionary->insert( std::pair<G4String, G4ParticleDefinition*>(key,particle) );
605 G4cout <<
"CODE:" << aPDGEncoding <<
" does not exist in ParticleTable " <<
G4endl;
615 if (( particle_name ==
"ALL" ) || (particle_name ==
"all")){
631 G4cout <<
" G4ParticleTable::DumpTable : "
632 << particle_name <<
" does not exist in ParticleTable " <<
G4endl;
643 msg =
"Illegal use of G4ParticleTable : ";
644 msg +=
" Access to G4ParticleTable for finding a particle or equivalent\n";
645 msg +=
"operation occurs before G4VUserPhysicsList is instantiated and\n";
646 msg +=
"assigned to G4RunManager. Such an access is prohibited by\n";
647 msg +=
"Geant4 version 8.0. To fix this problem, please make sure that\n";
648 msg +=
"your main() instantiates G4VUserPhysicsList and set it to\n";
649 msg +=
"G4RunManager before instantiating other user classes such as\n";
650 msg +=
"G4VUserPrimaryParticleGeneratorAction.";
void WorkerG4ParticleTable()
void RemoveAllParticles()
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
void DumpTable(const G4String &particle_name="ALL")
std::ostringstream G4ExceptionDescription
const G4PTblDictionary * GetDictionary() const
const G4String & GetParticleName(G4int index) const
G4UImessenger * CreateMessenger()
virtual ~G4ParticleTable()
G4ParticleDefinition * Remove(G4ParticleDefinition *particle)
const G4String & GetKey(const G4ParticleDefinition *particle) const
void Remove(const G4ParticleDefinition *particle)
G4ParticleTableIterator< G4int, G4ParticleDefinition * >::Map G4PTblEncodingDictionary
static G4bool IsIon(const G4ParticleDefinition *)
G4int GetPDGEncoding() const
G4ParticleTableIterator< G4String, G4ParticleDefinition * > G4PTblDicIterator
#define G4MUTEX_INITIALIZER
const G4String & GetParticleName() const
void Insert(const G4ParticleDefinition *particle)
static G4ParticleMessenger * fParticleMessengerShadow
static G4ThreadLocal G4ParticleMessenger * fParticleMessenger
static G4PTblEncodingDictionary * fEncodingDictionaryShadow
static G4StateManager * GetStateManager()
G4ParticleDefinition * GetParticle(G4int index) const
G4ParticleTable & operator=(const G4ParticleTable &)
G4ParticleDefinition * Insert(G4ParticleDefinition *particle)
G4IonTable * GetIonTable() const
G4GLOB_DLL std::ostream G4cout
void reset(G4bool ifSkipIon=true)
void DestroyWorkerG4ParticleTable()
G4ApplicationState GetCurrentState() const
void SetVerboseLevel(G4int value)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
G4bool contains(const G4ParticleDefinition *particle) const
void DeleteAllParticles()
static G4ParticleTable * GetParticleTable()
static G4ThreadLocal G4PTblDictionary * fDictionary
void DestroyWorkerG4IonTable()
void SlaveG4ParticleTable()
const G4PTblEncodingDictionary * GetEncodingDictionary() const
void CheckReadiness() const
static G4IonTable * fIonTable
G4PTblDicIterator * GetIterator() const
static G4ThreadLocal G4PTblDicIterator * fIterator
static G4ThreadLocal G4PTblEncodingDictionary * fEncodingDictionary
static G4PTblDicIterator * fIteratorShadow
static G4ParticleTable * fgParticleTable
static G4PTblDictionary * fDictionaryShadow
G4ParticleTableIterator< G4String, G4ParticleDefinition * >::Map G4PTblDictionary