87 #ifdef G4MULTITHREADED
91 G4int G4ParticleTable::lockCount = 0;
161 #ifdef G4MULTITHREADED
163 G4ParticleTable::lockCount++;
181 fDictionary->insert( std::pair<G4String, G4ParticleDefinition*>(
GetKey(particle), particle) );
189 #ifdef G4MULTITHREADED
245 "Illegal call of copy constructor for G4ParticleTable");
253 if (
this != &right) {
256 "Illegal call of assignment operator for G4ParticleTable");
292 G4cout <<
"G4ParticleTable::DeleteAllParticles() " <<
G4endl;
306 delete (piter->
value());
315 G4Exception(
"G4ParticleTable::RemoveAllParticle()",
317 "No effects because readyToUse is true.");
323 G4cout <<
"G4ParticleTable::RemoveAllParticles() " <<
G4endl;
343 if ((particle == 0) || (
GetKey(particle).isNull())) {
346 "Particle witnout name can not be registered.");
349 G4cout <<
"The particle[Addr:" << particle <<
"] has no name "<<
G4endl;
364 msg +=
" has already been registered in the Particle Table ";
374 pdic->insert( std::pair<G4String, G4ParticleDefinition*>(
GetKey(particle), particle) );
375 #ifdef G4MULTITHREADED
377 {
fDictionary->insert( std::pair<G4String, G4ParticleDefinition*>(
GetKey(particle), particle) ); }
384 pedic->insert( std::pair<G4int, G4ParticleDefinition*>(code ,particle) );
385 #ifdef G4MULTITHREADED
387 {
fEncodingDictionary->insert( std::pair<G4int, G4ParticleDefinition*>(code ,particle) ); }
402 <<
" is inserted in the ParticleTable " <<
G4endl;
414 if(!particle)
return 0;
415 #ifdef G4MULTITHREADED
419 <<
" is ignored as it is invoked from a worker thread.";
428 G4String msg =
"Request of removing ";
430 msg +=
" has No effects other than Pre_Init";
438 <<
" will be removed from the ParticleTable " <<
G4endl;
464 <<
" is removed from the ParticleTable " <<
G4endl;
480 "This method is obsolete and will be dropped from v10.0. Use G4IonTable::FindIon().");
491 "This method is obsolete and will be dropped from v10.0. Use G4IonTable::FindIon().");
503 "This method is obsolete and will be dropped from v10.0. Use G4IonTable::FindIon().");
515 "This method is obsolete and will be dropped from v10.0. Use G4IonTable::FindIon().");
517 if (Z <= 0)
return 0;
519 if (level < 0)
return 0;
527 "This method is obsolete and will be dropped from v10.0. Use G4IonTable::FindIon().");
539 "This method is obsolete and will be dropped from v10.0. Use G4IonTable::FindIon().");
553 if ( (index >=0) && (index <
entries()) ) {
558 if ( counter == index )
return piter->
value();
564 G4cout <<
" G4ParticleTable::GetParticle"
565 <<
" invalid index (=" << index <<
")" <<
G4endl;
575 if (aParticle != 0) {
585 G4PTblDictionary::iterator it =
fDictionary->find(particle_name);
589 #ifdef G4MULTITHREADED
598 ptcl = (*its).second;
600 if(code!=0)
fEncodingDictionary->insert(std::pair<G4int, G4ParticleDefinition*>(code,ptcl) );
624 if (aPDGEncoding == 0){
627 G4cout <<
"PDGEncoding [" << aPDGEncoding <<
"] is not valid " <<
G4endl;
636 G4PTblEncodingDictionary::iterator it = pedic->find(aPDGEncoding );
637 if (it != pedic->end()) {
638 particle = (*it).second;
641 #ifdef G4MULTITHREADED
648 particle = (*its).second;
651 fDictionary->insert( std::pair<G4String, G4ParticleDefinition*>(key,particle) );
658 if ((particle == 0) && (verboseLevel>1) ){
659 G4cout <<
"CODE:" << aPDGEncoding <<
" does not exist in ParticleTable " <<
G4endl;
669 if (( particle_name ==
"ALL" ) || (particle_name ==
"all")){
684 if (verboseLevel>1) {
685 G4cout <<
" G4ParticleTable::DumpTable : "
686 << particle_name <<
" does not exist in ParticleTable " <<
G4endl;
693 void G4ParticleTable::CheckReadiness()
const
697 msg =
"Illegal use of G4ParticleTable : ";
698 msg +=
" Access to G4ParticleTable for finding a particle or equivalent\n";
699 msg +=
"operation occurs before G4VUserPhysicsList is instantiated and\n";
700 msg +=
"assigned to G4RunManager. Such an access is prohibited by\n";
701 msg +=
"Geant4 version 8.0. To fix this problem, please make sure that\n";
702 msg +=
"your main() instantiates G4VUserPhysicsList and set it to\n";
703 msg +=
"G4RunManager before instantiating other user classes such as\n";
704 msg +=
"G4VUserPrimaryParticleGeneratorAction.";
void WorkerG4ParticleTable()
void RemoveAllParticles()
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
void DumpTable(const G4String &particle_name="ALL")
std::ostringstream G4ExceptionDescription
const G4PTblDictionary * GetDictionary() const
G4ParticleDefinition * GetIon(G4int atomicNumber, G4int atomicMass, G4double excitationEnergy)
const G4String & GetParticleName(G4int index) const
G4UImessenger * CreateMessenger()
virtual ~G4ParticleTable()
G4ParticleDefinition * Remove(G4ParticleDefinition *particle)
const G4String & GetKey(const G4ParticleDefinition *particle) const
G4ParticleDefinition * GetIon(G4int Z, G4int A, G4int lvl=0)
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)
G4ParticleDefinition * FindIon(G4int atomicNumber, G4int atomicMass, G4double excitationEnergy)
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
G4ParticleDefinition * FindIon(G4int Z, G4int A, G4int lvl=0)
void DeleteAllParticles()
static G4ParticleTable * GetParticleTable()
static G4ThreadLocal G4PTblDictionary * fDictionary
void SlaveG4ParticleTable()
const G4PTblEncodingDictionary * GetEncodingDictionary() 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