66 if (!fgParticleTable){
67 fgParticleTable = &theParticleTable;
69 return fgParticleTable;
74 :verboseLevel(1),fParticleMessenger(0),
98 if (fShortLivedTable!=0)
delete fShortLivedTable;
103 if (fIonTable!=0)
delete fIonTable;
107 if (fEncodingDictionary!=0){
108 fEncodingDictionary -> clear();
109 delete fEncodingDictionary;
110 fEncodingDictionary =0;
114 if (fIterator!=0 )
delete fIterator;
117 fDictionary->clear();
122 if (fParticleMessenger!=0)
delete fParticleMessenger;
123 fParticleMessenger =0;
131 :verboseLevel(1),fParticleMessenger(0),
137 "Illegal call of copy constructor for G4ParticleTable");
145 if (
this != &right) {
148 "Illegal call of assignment operator for G4ParticleTable");
158 if (fParticleMessenger== 0) {
162 return fParticleMessenger;
168 if (fParticleMessenger!= 0) {
170 delete fParticleMessenger;
171 fParticleMessenger= 0;
192 G4cout <<
"G4ParticleTable::DeleteAllParticles() " <<
G4endl;
206 delete (piter->
value());
215 G4Exception(
"G4ParticleTable::RemoveAllParticle()",
217 "No effects because readyToUse is true.");
223 G4cout <<
"G4ParticleTable::RemoveAllParticles() " <<
G4endl;
233 if (fShortLivedTable!=0) {
234 fShortLivedTable->
clear();
238 if (fEncodingDictionary) {
239 fEncodingDictionary->clear();
244 fDictionary->clear();
253 if ((particle == 0) || (
GetKey(particle).isNull())) {
256 G4cerr <<
"The particle[Addr:" << particle <<
"] has no name "<<
G4endl;
267 <<
"has been already registered in the Particle Table "<<
G4endl;
280 pdic->insert( std::pair<G4String, G4ParticleDefinition*>(
GetKey(particle), particle) );
285 pedic->insert( std::pair<G4int, G4ParticleDefinition*>(code ,particle) );
289 if (fIonTable->
IsIon(particle) ){
290 fIonTable->
Insert(particle);
295 fShortLivedTable->
Insert(particle);
304 <<
" is inserted in the ParticleTable " <<
G4endl;
320 G4String msg =
"Request of removing ";
322 msg +=
" has No effects other than Pre_Init";
330 <<
" will be removed from the ParticleTable " <<
G4endl;
336 G4PTblDictionary::iterator it = fDictionary->find(
GetKey(particle));
337 if (it != fDictionary->end()) {
338 fDictionary->erase(it);
342 fEncodingDictionary->erase(fEncodingDictionary->find(code));
349 if (fIonTable->
IsIon(particle) ){
350 fIonTable->
Remove(particle);
355 fShortLivedTable->
Remove(particle);
361 <<
" is removed from the ParticleTable " <<
G4endl;
374 return fIonTable->
GetIon(Z, A);
384 return fIonTable->
GetIon(Z, A, E);
395 return fIonTable->
GetIon(Z, A, L, E);
405 return fIonTable->
FindIon(Z, A, E);
416 return fIonTable->
FindIon(Z, A, L, E);
423 if ( (index >=0) && (index <
entries()) ) {
428 if ( counter == index )
return piter->
value();
434 G4cerr <<
" G4ParticleTable::GetParticle"
435 <<
" invalid index (=" << index <<
")" <<
G4endl;
445 if (aParticle != 0) {
455 G4PTblDictionary::iterator it = fDictionary->find(particle_name);
456 if (it != fDictionary->end()) {
476 if (aPDGEncoding == 0){
479 G4cerr <<
"PDGEncoding [" << aPDGEncoding <<
"] is not valid " <<
G4endl;
488 G4PTblEncodingDictionary::iterator it = pedic->find(aPDGEncoding );
489 if (it != pedic->end()) {
490 particle = (*it).second;
494 if ((particle == 0) && (verboseLevel>1) ){
495 G4cerr <<
"CODE:" << aPDGEncoding <<
" does not exist in ParticleTable " <<
G4endl;
505 if (( particle_name ==
"ALL" ) || (particle_name ==
"all")){
519 G4cerr <<
" G4ParticleTable::DumpTable : "
520 << particle_name <<
" does not exist in ParticleTable " <<
G4endl;
525void G4ParticleTable::CheckReadiness()
529 msg =
"Illegal use of G4ParticleTable : ";
530 msg +=
" Access to G4ParticleTable for finding a particle or equivalent\n";
531 msg +=
"operation occurs before G4VUserPhysicsList is instantiated and\n";
532 msg +=
"assigned to G4RunManager. Such an access is prohibited by\n";
533 msg +=
"Geant4 version 8.0. To fix this problem, please make sure that\n";
534 msg +=
"your main() instantiates G4VUserPhysicsList and set it to\n";
535 msg +=
"G4RunManager before instantiating other user classes such as\n";
536 msg +=
"G4VUserPrimaryParticleGeneratorAction.";
G4DLLIMPORT std::ostream G4cerr
G4DLLIMPORT std::ostream G4cout
void Remove(const G4ParticleDefinition *particle)
static G4bool IsIon(const G4ParticleDefinition *)
G4ParticleDefinition * FindIon(G4int Z, G4int A, G4double E, G4int J=0)
void Insert(const G4ParticleDefinition *particle)
G4ParticleDefinition * GetIon(G4int Z, G4int A, G4int J=0)
G4bool IsShortLived() const
G4int GetPDGEncoding() const
void SetVerboseLevel(G4int value)
const G4String & GetParticleName() const
G4ParticleTableIterator< G4String, G4ParticleDefinition * > G4PTblDicIterator
const G4String & GetParticleName(G4int index)
G4ParticleTable & operator=(const G4ParticleTable &)
G4ParticleTableIterator< G4String, G4ParticleDefinition * >::Map G4PTblDictionary
G4ParticleDefinition * FindIon(G4int atomicNumber, G4int atomicMass, G4double excitationEnergy)
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
static G4ParticleTable * GetParticleTable()
G4ParticleDefinition * Insert(G4ParticleDefinition *particle)
G4bool contains(const G4ParticleDefinition *particle)
G4ParticleDefinition * Remove(G4ParticleDefinition *particle)
void RemoveAllParticles()
void DeleteAllParticles()
G4UImessenger * CreateMessenger()
virtual ~G4ParticleTable()
G4ParticleDefinition * GetParticle(G4int index)
const G4String & GetKey(const G4ParticleDefinition *particle) const
G4ParticleTableIterator< G4int, G4ParticleDefinition * >::Map G4PTblEncodingDictionary
G4ParticleDefinition * GetIon(G4int atomicNumber, G4int atomicMass, G4double excitationEnergy)
void DumpTable(const G4String &particle_name="ALL")
void Remove(const G4ParticleDefinition *particle)
void Insert(const G4ParticleDefinition *particle)
G4ApplicationState GetCurrentState() const
static G4StateManager * GetStateManager()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)