88 #ifdef G4MULTITHREADED
92 G4int G4ParticleTable::lockCount = 0;
162 #ifdef G4MULTITHREADED
164 G4ParticleTable::lockCount++;
182 fDictionary->insert( std::pair<G4String, G4ParticleDefinition*>(
GetKey(particle), particle) );
190 #ifdef G4MULTITHREADED
246 "Illegal call of copy constructor for G4ParticleTable");
254 if (
this != &right) {
257 "Illegal call of assignment operator for G4ParticleTable");
293 G4cout <<
"G4ParticleTable::DeleteAllParticles() " <<
G4endl;
299 piter -> reset(
false);
307 delete (piter->
value());
316 G4Exception(
"G4ParticleTable::RemoveAllParticle()",
318 "No effects because readyToUse is true.");
324 G4cout <<
"G4ParticleTable::RemoveAllParticles() " <<
G4endl;
344 if ((particle == 0) || (
GetKey(particle).isNull())) {
347 "Particle witnout name can not be registered.");
350 G4cout <<
"The particle[Addr:" << particle <<
"] has no name "<<
G4endl;
365 msg +=
" has already been registered in the Particle Table ";
375 pdic->insert( std::pair<G4String, G4ParticleDefinition*>(
GetKey(particle), particle) );
376 #ifdef G4MULTITHREADED
378 {
fDictionary->insert( std::pair<G4String, G4ParticleDefinition*>(
GetKey(particle), particle) ); }
385 pedic->insert( std::pair<G4int, G4ParticleDefinition*>(code ,particle) );
386 #ifdef G4MULTITHREADED
388 {
fEncodingDictionary->insert( std::pair<G4int, G4ParticleDefinition*>(code ,particle) ); }
403 <<
" is inserted in the ParticleTable " <<
G4endl;
415 if(!particle)
return 0;
416 #ifdef G4MULTITHREADED
420 <<
" is ignored as it is invoked from a worker thread.";
429 G4String msg =
"Request of removing ";
431 msg +=
" has No effects other than Pre_Init";
439 <<
" will be removed from the ParticleTable " <<
G4endl;
465 <<
" is removed from the ParticleTable " <<
G4endl;
477 if ( (index >=0) && (index <
entries()) ) {
479 piter -> reset(
false);
482 if ( counter == index )
return piter->
value();
488 G4cout <<
" G4ParticleTable::GetParticle"
489 <<
" invalid index (=" << index <<
")" <<
G4endl;
499 if (aParticle != 0) {
509 G4PTblDictionary::iterator it =
fDictionary->find(particle_name);
513 #ifdef G4MULTITHREADED
522 ptcl = (*its).second;
524 if(code!=0)
fEncodingDictionary->insert(std::pair<G4int, G4ParticleDefinition*>(code,ptcl) );
548 if (aPDGEncoding == 0){
551 G4cout <<
"PDGEncoding [" << aPDGEncoding <<
"] is not valid " <<
G4endl;
560 G4PTblEncodingDictionary::iterator it = pedic->find(aPDGEncoding );
561 if (it != pedic->end()) {
562 particle = (*it).second;
565 #ifdef G4MULTITHREADED
572 particle = (*its).second;
575 fDictionary->insert( std::pair<G4String, G4ParticleDefinition*>(key,particle) );
583 G4cout <<
"CODE:" << aPDGEncoding <<
" does not exist in ParticleTable " <<
G4endl;
593 if (( particle_name ==
"ALL" ) || (particle_name ==
"all")){
609 G4cout <<
" G4ParticleTable::DumpTable : "
610 << particle_name <<
" does not exist in ParticleTable " <<
G4endl;
621 msg =
"Illegal use of G4ParticleTable : ";
622 msg +=
" Access to G4ParticleTable for finding a particle or equivalent\n";
623 msg +=
"operation occurs before G4VUserPhysicsList is instantiated and\n";
624 msg +=
"assigned to G4RunManager. Such an access is prohibited by\n";
625 msg +=
"Geant4 version 8.0. To fix this problem, please make sure that\n";
626 msg +=
"your main() instantiates G4VUserPhysicsList and set it to\n";
627 msg +=
"G4RunManager before instantiating other user classes such as\n";
628 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)
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 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