Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4ParticleTable Class Reference

#include <G4ParticleTable.hh>

Collaboration diagram for G4ParticleTable:

Public Types

typedef
G4ParticleTableIterator
< G4String,
G4ParticleDefinition * >::Map 
G4PTblDictionary
 
typedef
G4ParticleTableIterator
< G4String,
G4ParticleDefinition * > 
G4PTblDicIterator
 
typedef
G4ParticleTableIterator< G4int,
G4ParticleDefinition * >::Map 
G4PTblEncodingDictionary
 
typedef
G4ParticleTableIterator< G4int,
G4ParticleDefinition * > 
G4PTblEncodingDicIterator
 

Public Member Functions

void SlaveG4ParticleTable ()
 
void WorkerG4ParticleTable ()
 
virtual ~G4ParticleTable ()
 
void DestroyWorkerG4ParticleTable ()
 
G4bool contains (const G4ParticleDefinition *particle) const
 
G4bool contains (const G4String &particle_name) const
 
G4int entries () const
 
G4int size () const
 
G4ParticleDefinitionGetParticle (G4int index) const
 
const G4StringGetParticleName (G4int index) const
 
G4ParticleDefinitionFindParticle (G4int PDGEncoding)
 
G4ParticleDefinitionFindParticle (const G4String &particle_name)
 
G4ParticleDefinitionFindParticle (const G4ParticleDefinition *particle)
 
G4ParticleDefinitionFindAntiParticle (G4int PDGEncoding)
 
G4ParticleDefinitionFindAntiParticle (const G4String &particle_name)
 
G4ParticleDefinitionFindAntiParticle (const G4ParticleDefinition *particle)
 
G4PTblDicIteratorGetIterator () const
 
void DumpTable (const G4String &particle_name="ALL")
 
G4IonTableGetIonTable () const
 
G4ParticleDefinitionInsert (G4ParticleDefinition *particle)
 
G4ParticleDefinitionRemove (G4ParticleDefinition *particle)
 
void RemoveAllParticles ()
 
void DeleteAllParticles ()
 
G4UImessengerCreateMessenger ()
 
void DeleteMessenger ()
 
void SetVerboseLevel (G4int value)
 
G4int GetVerboseLevel () const
 
void SetReadiness (G4bool val=true)
 
G4bool GetReadiness () const
 
G4ParticleDefinitionGetGenericIon () const
 
void SetGenericIon (G4ParticleDefinition *)
 

Static Public Member Functions

static G4ParticleTableGetParticleTable ()
 

Static Public Attributes

static G4ThreadLocal
G4ParticleMessenger
fParticleMessenger = 0
 
static G4ThreadLocal
G4PTblDictionary
fDictionary = 0
 
static G4ThreadLocal
G4PTblDicIterator
fIterator = 0
 
static G4ThreadLocal
G4PTblEncodingDictionary
fEncodingDictionary = 0
 
static G4ParticleTablefgParticleTable =0
 
static G4IonTablefIonTable = 0
 
static G4ParticleMessengerfParticleMessengerShadow = 0
 
static G4PTblDictionaryfDictionaryShadow = 0
 
static G4PTblDicIteratorfIteratorShadow = 0
 
static G4PTblEncodingDictionaryfEncodingDictionaryShadow = 0
 

Protected Member Functions

 G4ParticleTable ()
 
 G4ParticleTable (const G4ParticleTable &right)
 
G4ParticleTableoperator= (const G4ParticleTable &)
 
const G4PTblDictionaryGetDictionary () const
 
const G4StringGetKey (const G4ParticleDefinition *particle) const
 
const G4PTblEncodingDictionaryGetEncodingDictionary () const
 

Detailed Description

Definition at line 65 of file G4ParticleTable.hh.

Member Typedef Documentation

Constructor & Destructor Documentation

G4ParticleTable::G4ParticleTable ( )
protected

Definition at line 111 of file G4ParticleTable.cc.

112  :verboseLevel(1),
113  noName(" "),
114  readyToUse(false),
115  genericIon(NULL)
116 {
118 
119  // Set up the shadow pointer used by worker threads.
120  //
121  if (fDictionaryShadow == 0)
122  {
124  }
125 
127 
128  // Set up the shadow pointer used by worker threads.
129  //
130  if (fIteratorShadow == 0)
131  {
133  }
134 
136  // Set up the shadow pointer used by worker threads.
137  //
138  if (fEncodingDictionaryShadow == 0)
139  {
141  }
142 
143 
144  // Ion Table
145  fIonTable = new G4IonTable();
146 
147 }
G4ParticleTableIterator< G4int, G4ParticleDefinition * >::Map G4PTblEncodingDictionary
G4ParticleTableIterator< G4String, G4ParticleDefinition * > G4PTblDicIterator
static G4PTblEncodingDictionary * fEncodingDictionaryShadow
static G4ThreadLocal G4PTblDictionary * fDictionary
static G4IonTable * fIonTable
static G4ThreadLocal G4PTblDicIterator * fIterator
static G4ThreadLocal G4PTblEncodingDictionary * fEncodingDictionary
static G4PTblDicIterator * fIteratorShadow
static G4PTblDictionary * fDictionaryShadow
G4ParticleTableIterator< G4String, G4ParticleDefinition * >::Map G4PTblDictionary
G4ParticleTable::G4ParticleTable ( const G4ParticleTable right)
protected

Definition at line 259 of file G4ParticleTable.cc.

260  :verboseLevel(1),
261  noName(" "),
262  readyToUse(false)
263 {
264  fParticleMessenger = 0 ;
265 
266  G4Exception("G4ParticleTable::G4ParticleTable()",
267  "PART001", FatalException,
268  "Illegal call of copy constructor for G4ParticleTable");
269  fDictionary = new G4PTblDictionary(*(right.fDictionary));
271 }
G4ParticleTableIterator< G4String, G4ParticleDefinition * > G4PTblDicIterator
static G4ThreadLocal G4ParticleMessenger * fParticleMessenger
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
static G4ThreadLocal G4PTblDictionary * fDictionary
static G4ThreadLocal G4PTblDicIterator * fIterator
G4ParticleTableIterator< G4String, G4ParticleDefinition * >::Map G4PTblDictionary

Here is the call graph for this function:

G4ParticleTable::~G4ParticleTable ( )
virtual

Definition at line 198 of file G4ParticleTable.cc.

199 {
200  readyToUse = false;
201 
202  // remove all items from G4ParticleTable
204 
205  //delete Ion Table
206  if (fIonTable!=0) delete fIonTable;
207  fIonTable =0;
208 
209  // delete dictionary for encoding
210  if (fEncodingDictionary!=0){
211  fEncodingDictionary -> clear();
212  delete fEncodingDictionary;
214  }
215 
216  if(fDictionary){
217  if (fIterator!=0 )delete fIterator;
218  fIterator =0;
219 
220  fDictionary->clear();
221  delete fDictionary;
222  fDictionary =0;
223  }
224 
225  if (fParticleMessenger!=0) delete fParticleMessenger;
227 
228  fgParticleTable =0;
229 
230 }
static G4ThreadLocal G4ParticleMessenger * fParticleMessenger
static G4ThreadLocal G4PTblDictionary * fDictionary
static G4IonTable * fIonTable
static G4ThreadLocal G4PTblDicIterator * fIterator
static G4ThreadLocal G4PTblEncodingDictionary * fEncodingDictionary
static G4ParticleTable * fgParticleTable

Here is the call graph for this function:

Member Function Documentation

G4bool G4ParticleTable::contains ( const G4ParticleDefinition particle) const

Here is the caller graph for this function:

G4bool G4ParticleTable::contains ( const G4String particle_name) const

Definition at line 678 of file G4ParticleTable.cc.

679 {
680  G4PTblDictionary::iterator it = fDictionaryShadow->find(particle_name);
681  return (it != fDictionaryShadow->end());
682 }
static G4PTblDictionary * fDictionaryShadow
G4UImessenger * G4ParticleTable::CreateMessenger ( )

Definition at line 287 of file G4ParticleTable.cc.

288 {
289  if (fParticleMessenger== 0) {
290  //UI messenger
292  }
293  return fParticleMessenger;
294 }
static G4ThreadLocal G4ParticleMessenger * fParticleMessenger

Here is the caller graph for this function:

void G4ParticleTable::DeleteAllParticles ( )

Definition at line 308 of file G4ParticleTable.cc.

309 {
310  //set readyToUse false
311  readyToUse = false;
312 
313 #ifdef G4VERBOSE
314  if (verboseLevel>1){
315  G4cout << "G4ParticleTable::DeleteAllParticles() " << G4endl;
316  }
317 #endif
318 
319  // delete all particles
320  G4PTblDicIterator *piter = fIterator;
321  piter -> reset(false);
322  while( (*piter)() ){// Loop checking, 09.08.2015, K.Kurashige
323 #ifdef G4VERBOSE
324  if (verboseLevel>2){
325  G4cout << "Delete " << (piter->value())->GetParticleName()
326  << " " << (piter->value()) << G4endl;
327  }
328 #endif
329  delete (piter->value());
330  }
332 }
const G4String & GetParticleName(G4int index) const
G4ParticleTableIterator< G4String, G4ParticleDefinition * > G4PTblDicIterator
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
static G4ThreadLocal G4PTblDicIterator * fIterator

Here is the call graph for this function:

Here is the caller graph for this function:

void G4ParticleTable::DeleteMessenger ( )

Definition at line 297 of file G4ParticleTable.cc.

298 {
299  if (fParticleMessenger!= 0) {
300  //UI messenger
301  delete fParticleMessenger;
303  }
304 
305 }
static G4ThreadLocal G4ParticleMessenger * fParticleMessenger

Here is the caller graph for this function:

void G4ParticleTable::DestroyWorkerG4ParticleTable ( )

Definition at line 233 of file G4ParticleTable.cc.

234 {
235  //delete Ion Table in worker thread
237 
238  // delete dictionary for encoding
239  if (fEncodingDictionary!=0){
240  fEncodingDictionary -> clear();
241  delete fEncodingDictionary;
243  }
244 
245  if(fDictionary){
246  if (fIterator!=0 )delete fIterator;
247  fIterator =0;
248 
249  fDictionary->clear();
250  delete fDictionary;
251  fDictionary =0;
252  }
253 
254  if (fParticleMessenger!=0) delete fParticleMessenger;
256 }
static G4ThreadLocal G4ParticleMessenger * fParticleMessenger
static G4ThreadLocal G4PTblDictionary * fDictionary
void DestroyWorkerG4IonTable()
Definition: G4IonTable.cc:217
static G4IonTable * fIonTable
static G4ThreadLocal G4PTblDicIterator * fIterator
static G4ThreadLocal G4PTblEncodingDictionary * fEncodingDictionary

Here is the call graph for this function:

Here is the caller graph for this function:

void G4ParticleTable::DumpTable ( const G4String particle_name = "ALL")

Definition at line 612 of file G4ParticleTable.cc.

613 {
614  CheckReadiness();
615  if (( particle_name == "ALL" ) || (particle_name == "all")){
616  // dump all particles
617  G4PTblDicIterator *piter = fIterator;
618  piter -> reset();
619  while( (*piter)() ){// Loop checking, 09.08.2015, K.Kurashige
620  (piter->value())->DumpTable();
621  }
622  } else {
623  // dump only particle with name of particle_name
625  ptr = FindParticle(particle_name);
626  if ( ptr != 0) {
627  ptr->DumpTable();
628  } else {
629 #ifdef G4VERBOSE
630  if (verboseLevel>1) {
631  G4cout << " G4ParticleTable::DumpTable : "
632  << particle_name << " does not exist in ParticleTable " <<G4endl;
633  }
634 #endif
635  }
636  }
637 }
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
void DumpTable(const G4String &particle_name="ALL")
G4ParticleTableIterator< G4String, G4ParticleDefinition * > G4PTblDicIterator
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
static G4ThreadLocal G4PTblDicIterator * fIterator

Here is the call graph for this function:

Here is the caller graph for this function:

G4int G4ParticleTable::entries ( ) const

Definition at line 684 of file G4ParticleTable.cc.

685 {
686  return fDictionary->size();
687 }
static G4ThreadLocal G4PTblDictionary * fDictionary

Here is the caller graph for this function:

G4ParticleDefinition* G4ParticleTable::FindAntiParticle ( G4int  PDGEncoding)
G4ParticleDefinition* G4ParticleTable::FindAntiParticle ( const G4String particle_name)
G4ParticleDefinition* G4ParticleTable::FindAntiParticle ( const G4ParticleDefinition particle)
G4ParticleDefinition * G4ParticleTable::FindParticle ( G4int  PDGEncoding)

Definition at line 566 of file G4ParticleTable.cc.

567 {
568  CheckReadiness();
569  // check aPDGEncoding is valid
570  if (aPDGEncoding == 0){
571 #ifdef G4VERBOSE
572  if (verboseLevel>1){
573  G4cout << "PDGEncoding [" << aPDGEncoding << "] is not valid " << G4endl;
574  }
575 #endif
576  return 0;
577  }
578 
580  G4ParticleDefinition* particle =0;
581 
582  G4PTblEncodingDictionary::iterator it = pedic->find(aPDGEncoding );
583  if (it != pedic->end()) {
584  particle = (*it).second;
585  }
586 
587 #ifdef G4MULTITHREADED
588  if(particle == 0 && G4Threading::IsWorkerThread())
589  {
590  G4MUTEXLOCK(&G4ParticleTable::particleTableMutex);
591  G4PTblEncodingDictionary::iterator its = fEncodingDictionaryShadow->find(aPDGEncoding);
592  if(its!=fEncodingDictionaryShadow->end())
593  {
594  particle = (*its).second;
595  fEncodingDictionary->insert(*its);
596  G4String key = GetKey(particle);
597  fDictionary->insert( std::pair<G4String, G4ParticleDefinition*>(key,particle) );
598  }
599  G4MUTEXUNLOCK(&G4ParticleTable::particleTableMutex);
600  }
601 #endif
602 
603 #ifdef G4VERBOSE
604  if ((particle == 0) && (verboseLevel>1) ){
605  G4cout << "CODE:" << aPDGEncoding << " does not exist in ParticleTable " << G4endl;
606  }
607 #endif
608  return particle;
609 }
#define G4MUTEXUNLOCK
Definition: G4Threading.hh:180
const G4String & GetKey(const G4ParticleDefinition *particle) const
G4ParticleTableIterator< G4int, G4ParticleDefinition * >::Map G4PTblEncodingDictionary
static G4PTblEncodingDictionary * fEncodingDictionaryShadow
G4GLOB_DLL std::ostream G4cout
#define G4MUTEXLOCK
Definition: G4Threading.hh:179
G4bool IsWorkerThread()
Definition: G4Threading.cc:145
static G4ThreadLocal G4PTblDictionary * fDictionary
#define G4endl
Definition: G4ios.hh:61
static G4ThreadLocal G4PTblEncodingDictionary * fEncodingDictionary

Here is the call graph for this function:

G4ParticleDefinition * G4ParticleTable::FindParticle ( const G4String particle_name)

Definition at line 529 of file G4ParticleTable.cc.

530 {
531  G4PTblDictionary::iterator it = fDictionary->find(particle_name);
532  if (it != fDictionary->end()) {
533  return (*it).second;
534  } else {
535 #ifdef G4MULTITHREADED
536  G4ParticleDefinition* ptcl = 0;
538  {
539  G4MUTEXLOCK(&G4ParticleTable::particleTableMutex);
540  G4PTblDictionary::iterator its = fDictionaryShadow->find(particle_name);
541  if(its != fDictionaryShadow->end())
542  {
543  fDictionary->insert(*its);
544  ptcl = (*its).second;
545  G4int code = ptcl->GetPDGEncoding();
546  if(code!=0) fEncodingDictionary->insert(std::pair<G4int, G4ParticleDefinition*>(code,ptcl) );
547  }
548  G4MUTEXUNLOCK(&G4ParticleTable::particleTableMutex);
549  }
550  return ptcl;
551 #else
552  return 0;
553 #endif
554  }
555 }
#define G4MUTEXUNLOCK
Definition: G4Threading.hh:180
int G4int
Definition: G4Types.hh:78
#define G4MUTEXLOCK
Definition: G4Threading.hh:179
G4bool IsWorkerThread()
Definition: G4Threading.cc:145
Definition: inftrees.h:24
static G4ThreadLocal G4PTblDictionary * fDictionary
static G4ThreadLocal G4PTblEncodingDictionary * fEncodingDictionary
static G4PTblDictionary * fDictionaryShadow

Here is the call graph for this function:

G4ParticleDefinition * G4ParticleTable::FindParticle ( const G4ParticleDefinition particle)

Definition at line 558 of file G4ParticleTable.cc.

559 {
560  CheckReadiness();
561  G4String key = GetKey(particle);
562  return FindParticle(key);
563 }
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
const G4String & GetKey(const G4ParticleDefinition *particle) const

Here is the call graph for this function:

const G4ParticleTable::G4PTblDictionary * G4ParticleTable::GetDictionary ( ) const
protected

Definition at line 663 of file G4ParticleTable.cc.

664 {
665  return fDictionary;
666 }
static G4ThreadLocal G4PTblDictionary * fDictionary
const G4ParticleTable::G4PTblEncodingDictionary * G4ParticleTable::GetEncodingDictionary ( ) const
protected

Definition at line 673 of file G4ParticleTable.cc.

674 {
675  return fEncodingDictionary;
676 }
static G4ThreadLocal G4PTblEncodingDictionary * fEncodingDictionary
G4ParticleDefinition* G4ParticleTable::GetGenericIon ( ) const

Here is the caller graph for this function:

G4IonTable * G4ParticleTable::GetIonTable ( ) const

Definition at line 658 of file G4ParticleTable.cc.

659 {
660  return fIonTable;
661 }
static G4IonTable * fIonTable

Here is the caller graph for this function:

G4ParticleTable::G4PTblDicIterator * G4ParticleTable::GetIterator ( ) const

Definition at line 668 of file G4ParticleTable.cc.

669 {
670  return fIterator;
671 }
static G4ThreadLocal G4PTblDicIterator * fIterator

Here is the caller graph for this function:

const G4String& G4ParticleTable::GetKey ( const G4ParticleDefinition particle) const
protected

Here is the caller graph for this function:

G4ParticleDefinition * G4ParticleTable::GetParticle ( G4int  index) const

Definition at line 496 of file G4ParticleTable.cc.

497 {
498  CheckReadiness();
499  if ( (index >=0) && (index < entries()) ) {
500  G4PTblDicIterator *piter = fIterator;
501  piter -> reset(false);
502  G4int counter = 0;
503  while( (*piter)() ){ // Loop checking, 09.08.2015, K.Kurashige
504  if ( counter == index ) return piter->value();
505  counter++;
506  }
507  }
508 #ifdef G4VERBOSE
509  if (verboseLevel>1){
510  G4cout << " G4ParticleTable::GetParticle"
511  << " invalid index (=" << index << ")" << G4endl;
512  }
513 #endif
514  return 0;
515 }
G4ParticleTableIterator< G4String, G4ParticleDefinition * > G4PTblDicIterator
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
G4int entries() const
static G4ThreadLocal G4PTblDicIterator * fIterator

Here is the call graph for this function:

Here is the caller graph for this function:

const G4String & G4ParticleTable::GetParticleName ( G4int  index) const

Definition at line 518 of file G4ParticleTable.cc.

519 {
520  G4ParticleDefinition* aParticle =GetParticle(index);
521  if (aParticle != 0) {
522  return aParticle->GetParticleName();
523  } else {
524  return noName;
525  }
526 }
const G4String & GetParticleName() const
G4ParticleDefinition * GetParticle(G4int index) const

Here is the call graph for this function:

Here is the caller graph for this function:

G4ParticleTable * G4ParticleTable::GetParticleTable ( )
static

Definition at line 96 of file G4ParticleTable.cc.

97 {
98  static G4ParticleTable theParticleTable;
99  if (!fgParticleTable){
100  fgParticleTable = &theParticleTable;
101  }
102 
103  // Here we initialize all thread private data members.
104  //
106 
107  return fgParticleTable;
108 }
void WorkerG4ParticleTable()
static G4ThreadLocal G4PTblDictionary * fDictionary
static G4ParticleTable * fgParticleTable

Here is the call graph for this function:

G4bool G4ParticleTable::GetReadiness ( ) const

Here is the caller graph for this function:

G4int G4ParticleTable::GetVerboseLevel ( ) const

Here is the caller graph for this function:

G4ParticleDefinition * G4ParticleTable::Insert ( G4ParticleDefinition particle)

Definition at line 362 of file G4ParticleTable.cc.

363 {
364 
365  // check particle name
366  if ((particle == 0) || (GetKey(particle).isNull())) {
367  G4Exception("G4ParticleTable::Insert()",
368  "PART121", FatalException,
369  "Particle witnout name can not be registered.");
370 #ifdef G4VERBOSE
371  if (verboseLevel>1){
372  G4cout << "The particle[Addr:" << particle << "] has no name "<< G4endl;
373  }
374 #endif
375  return 0;
376 
377  }else {
378 
379  if (contains(particle)) {
380 #ifdef G4VERBOSE
381  if (verboseLevel>2){
382  FindParticle(particle) -> DumpTable();
383  }
384 #endif
385  G4String msg = "The particle ";
386  msg += particle->GetParticleName();
387  msg += " has already been registered in the Particle Table ";
388  G4Exception("G4ParticleTable::Insert()",
389  "PART122", FatalException,msg);
391  return particle;
392 
393  } else {
395 
396  // insert into Dictionary
397  pdic->insert( std::pair<G4String, G4ParticleDefinition*>(GetKey(particle), particle) );
398 #ifdef G4MULTITHREADED
400  { fDictionary->insert( std::pair<G4String, G4ParticleDefinition*>(GetKey(particle), particle) ); }
401 #endif
402 
404  // insert into EncodingDictionary
405  G4int code = particle->GetPDGEncoding();
406  if (code !=0 ) {
407  pedic->insert( std::pair<G4int, G4ParticleDefinition*>(code ,particle) );
408 #ifdef G4MULTITHREADED
410  { fEncodingDictionary->insert( std::pair<G4int, G4ParticleDefinition*>(code ,particle) ); }
411 #endif
412  }
413 
414  // insert it in IonTable if "nucleus"
415  if (fIonTable->IsIon(particle) ){
416  fIonTable->Insert(particle);
417  }
418 
419  // set Verbose Level same as ParticleTable
420  particle->SetVerboseLevel(verboseLevel);
421 
422 #ifdef G4VERBOSE
423  if (verboseLevel>3){
424  G4cout << "The particle "<< particle->GetParticleName()
425  << " is inserted in the ParticleTable " << G4endl;
426  }
427 #endif
428 
429  return particle;
430  }
431  }
432 }
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
void DumpTable(const G4String &particle_name="ALL")
const G4String & GetKey(const G4ParticleDefinition *particle) const
G4ParticleTableIterator< G4int, G4ParticleDefinition * >::Map G4PTblEncodingDictionary
static G4bool IsIon(const G4ParticleDefinition *)
Definition: G4IonTable.cc:1147
int G4int
Definition: G4Types.hh:78
const G4String & GetParticleName() const
void Insert(const G4ParticleDefinition *particle)
Definition: G4IonTable.cc:1363
static G4PTblEncodingDictionary * fEncodingDictionaryShadow
G4GLOB_DLL std::ostream G4cout
void SetVerboseLevel(G4int value)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4bool IsWorkerThread()
Definition: G4Threading.cc:145
G4bool contains(const G4ParticleDefinition *particle) const
Definition: inftrees.h:24
static G4ThreadLocal G4PTblDictionary * fDictionary
#define G4endl
Definition: G4ios.hh:61
static G4IonTable * fIonTable
static G4ThreadLocal G4PTblEncodingDictionary * fEncodingDictionary
static G4PTblDictionary * fDictionaryShadow
G4ParticleTableIterator< G4String, G4ParticleDefinition * >::Map G4PTblDictionary

Here is the call graph for this function:

Here is the caller graph for this function:

G4ParticleTable & G4ParticleTable::operator= ( const G4ParticleTable right)
protected

Definition at line 274 of file G4ParticleTable.cc.

275 {
276  if (this != &right) {
277  G4Exception("G4ParticleTable::G4ParticleTable()",
278  "PART001", FatalException,
279  "Illegal call of assignment operator for G4ParticleTable");
280  fDictionary = new G4PTblDictionary(*(right.fDictionary));
282  }
283  return *this;
284 }
G4ParticleTableIterator< G4String, G4ParticleDefinition * > G4PTblDicIterator
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
static G4ThreadLocal G4PTblDictionary * fDictionary
static G4ThreadLocal G4PTblDicIterator * fIterator
G4ParticleTableIterator< G4String, G4ParticleDefinition * >::Map G4PTblDictionary

Here is the call graph for this function:

G4ParticleDefinition * G4ParticleTable::Remove ( G4ParticleDefinition particle)

Definition at line 435 of file G4ParticleTable.cc.

436 {
437  if(!particle) return 0;
438 #ifdef G4MULTITHREADED
441  ed << "Request of removing " << particle->GetParticleName()
442  << " is ignored as it is invoked from a worker thread.";
443  G4Exception("G4ParticleTable::Remove()","PART10117",JustWarning,ed);
444  return 0;
445  }
446 #endif
447  if (readyToUse) {
449  G4ApplicationState currentState = pStateManager->GetCurrentState();
450  if (currentState != G4State_PreInit) {
451  G4String msg = "Request of removing ";
452  msg += particle->GetParticleName();
453  msg += " has No effects other than Pre_Init";
454  G4Exception("G4ParticleTable::Remove()",
455  "PART117", JustWarning, msg);
456  return 0;
457  } else {
458 #ifdef G4VERBOSE
459  if (verboseLevel>0){
460  G4cout << particle->GetParticleName()
461  << " will be removed from the ParticleTable " << G4endl;
462  }
463 #endif
464  }
465  }
466 
467  G4PTblDictionary::iterator it = fDictionaryShadow->find(GetKey(particle));
468  if (it != fDictionaryShadow->end()) {
469  fDictionaryShadow->erase(it);
470  // remove from EncodingDictionary
471  G4int code = particle->GetPDGEncoding();
472  if (code !=0 ) {
474  }
475  } else {
476  return 0;
477  }
478 
479  // remove it from IonTable if "nucleus"
480  if (fIonTable->IsIon(particle) ){
481  fIonTable->Remove(particle);
482  }
483 
484 #ifdef G4VERBOSE
485  if (verboseLevel>3){
486  G4cout << "The particle "<< particle->GetParticleName()
487  << " is removed from the ParticleTable " << G4endl;
488  }
489 #endif
490 
491  return particle;
492 }
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
const G4String & GetKey(const G4ParticleDefinition *particle) const
void Remove(const G4ParticleDefinition *particle)
Definition: G4IonTable.cc:1404
static G4bool IsIon(const G4ParticleDefinition *)
Definition: G4IonTable.cc:1147
int G4int
Definition: G4Types.hh:78
const G4String & GetParticleName() const
static G4PTblEncodingDictionary * fEncodingDictionaryShadow
static G4StateManager * GetStateManager()
G4GLOB_DLL std::ostream G4cout
G4ApplicationState GetCurrentState() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4bool IsWorkerThread()
Definition: G4Threading.cc:145
Definition: inftrees.h:24
#define G4endl
Definition: G4ios.hh:61
static G4IonTable * fIonTable
G4ApplicationState
static G4PTblDictionary * fDictionaryShadow

Here is the call graph for this function:

Here is the caller graph for this function:

void G4ParticleTable::RemoveAllParticles ( )

Definition at line 335 of file G4ParticleTable.cc.

336 {
337  if (readyToUse) {
338  G4Exception("G4ParticleTable::RemoveAllParticle()",
339  "PART115", JustWarning,
340  "No effects because readyToUse is true.");
341  return;
342  }
343 
344 #ifdef G4VERBOSE
345  if (verboseLevel>1){
346  G4cout << "G4ParticleTable::RemoveAllParticles() " << G4endl;
347  }
348 #endif
349 
350  //remove all contnts in Ion Table
351  if (fIonTable!=0) {
352  fIonTable->clear();
353  }
354 
355  // clear dictionary
356  if (fDictionary) {
357  fDictionary->clear();
358  }
359 }
G4GLOB_DLL std::ostream G4cout
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
static G4ThreadLocal G4PTblDictionary * fDictionary
void clear()
Definition: G4IonTable.cc:1345
#define G4endl
Definition: G4ios.hh:61
static G4IonTable * fIonTable

Here is the call graph for this function:

Here is the caller graph for this function:

void G4ParticleTable::SetGenericIon ( G4ParticleDefinition )

Here is the caller graph for this function:

void G4ParticleTable::SetReadiness ( G4bool  val = true)

Here is the caller graph for this function:

void G4ParticleTable::SetVerboseLevel ( G4int  value)

Here is the caller graph for this function:

G4int G4ParticleTable::size ( ) const

Definition at line 689 of file G4ParticleTable.cc.

690 {
691  return fDictionary->size();
692 }
static G4ThreadLocal G4PTblDictionary * fDictionary

Here is the caller graph for this function:

void G4ParticleTable::SlaveG4ParticleTable ( )

Definition at line 153 of file G4ParticleTable.cc.

154 {
155  G4Exception("G4ParticleTable::SlaveG4ParticleTable()","G4MT0000",FatalException,"Obsolete");
156 }
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41

Here is the call graph for this function:

void G4ParticleTable::WorkerG4ParticleTable ( )

Definition at line 158 of file G4ParticleTable.cc.

159 {
160  // The iterator for the shadow particle table is not sharable.
161  //
162 #ifdef G4MULTITHREADED
163  G4MUTEXLOCK(&G4ParticleTable::particleTableMutex);
164  G4ParticleTable::lockCount++;
165 #endif
166  if(fDictionary == 0) {
167  fDictionary = new G4PTblDictionary();
168  } else {
169  fDictionary->clear();
170  }
171 
172  if(fEncodingDictionary == 0){
174  } else {
175  fEncodingDictionary->clear();
176  }
177 
178  fIteratorShadow->reset(false);
179  while( (*fIteratorShadow)() ) { // Loop checking, 09.08.2015, K.Kurashige
181  fDictionary->insert( std::pair<G4String, G4ParticleDefinition*>(GetKey(particle), particle) );
182  G4int code = particle->GetPDGEncoding();
183  if (code !=0 ) {
184  fEncodingDictionary->insert( std::pair<G4int, G4ParticleDefinition*>(code ,particle) );
185  }
186  }
188 
189 #ifdef G4MULTITHREADED
190  G4MUTEXUNLOCK(&G4ParticleTable::particleTableMutex);
191 #endif
192 
194 
195 }
#define G4MUTEXUNLOCK
Definition: G4Threading.hh:180
void WorkerG4IonTable()
Definition: G4IonTable.cc:156
const G4String & GetKey(const G4ParticleDefinition *particle) const
G4ParticleTableIterator< G4int, G4ParticleDefinition * >::Map G4PTblEncodingDictionary
G4ParticleTableIterator< G4String, G4ParticleDefinition * > G4PTblDicIterator
int G4int
Definition: G4Types.hh:78
void reset(G4bool ifSkipIon=true)
#define G4MUTEXLOCK
Definition: G4Threading.hh:179
Definition: inftrees.h:24
static G4ThreadLocal G4PTblDictionary * fDictionary
static G4IonTable * fIonTable
static G4ThreadLocal G4PTblDicIterator * fIterator
static G4ThreadLocal G4PTblEncodingDictionary * fEncodingDictionary
static G4PTblDicIterator * fIteratorShadow
G4ParticleTableIterator< G4String, G4ParticleDefinition * >::Map G4PTblDictionary

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

G4ThreadLocal G4ParticleTable::G4PTblDictionary * G4ParticleTable::fDictionary = 0
static

Definition at line 190 of file G4ParticleTable.hh.

G4ParticleTable::G4PTblDictionary * G4ParticleTable::fDictionaryShadow = 0
static

Definition at line 213 of file G4ParticleTable.hh.

G4ThreadLocal G4ParticleTable::G4PTblEncodingDictionary * G4ParticleTable::fEncodingDictionary = 0
static

Definition at line 192 of file G4ParticleTable.hh.

G4ParticleTable::G4PTblEncodingDictionary * G4ParticleTable::fEncodingDictionaryShadow = 0
static

Definition at line 215 of file G4ParticleTable.hh.

G4ParticleTable * G4ParticleTable::fgParticleTable =0
static

Definition at line 202 of file G4ParticleTable.hh.

G4IonTable * G4ParticleTable::fIonTable = 0
static

Definition at line 204 of file G4ParticleTable.hh.

G4ThreadLocal G4ParticleTable::G4PTblDicIterator * G4ParticleTable::fIterator = 0
static

Definition at line 191 of file G4ParticleTable.hh.

G4ParticleTable::G4PTblDicIterator * G4ParticleTable::fIteratorShadow = 0
static

Definition at line 214 of file G4ParticleTable.hh.

G4ThreadLocal G4ParticleMessenger * G4ParticleTable::fParticleMessenger = 0
static

Definition at line 189 of file G4ParticleTable.hh.

G4ParticleMessenger * G4ParticleTable::fParticleMessengerShadow = 0
static

Definition at line 212 of file G4ParticleTable.hh.


The documentation for this class was generated from the following files: