Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
G4ParticleTable.hh
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26//
27// $Id$
28//
29//
30// ------------------------------------------------------------
31// GEANT 4 class header file
32//
33// History: first implementation, based on object model of
34// 27 June 1996, H.Kurashige
35// ------------------------------------------------------------
36// added fParticleMessenger 14 Nov., 97 H.Kurashige
37// added Create/DeleteMessenger 06 Jul., 98 H.Kurashige
38// modified FindIon 02 Aug., 98 H.Kurashige
39// added dictionary for encoding 24 Sep., 98 H.Kurashige
40// added RemoveAllParticles() 8 Nov., 98 H.Kurashige
41// --------------------------------
42// fixed some improper codings 08 Apr., 99 H.Kurashige
43// modified FindIon/GetIon methods 17 AUg., 99 H.Kurashige
44// implement new version for using STL map instaed of RW PtrHashedDictionary
45// 28 ct., 99 H.Kurashige
46// modified implementation of Remove 21 Mar.,08 H.Kurashige
47
48#ifndef G4ParticleTable_h
49#define G4ParticleTable_h 1
50
51#include "G4ios.hh"
52#include "globals.hh"
54
55
56#include <map>
58
59class G4UImessenger;
61class G4IonTable;
63
65{
66 // Class Description
67 // G4ParticleTable is the table of pointer to G4ParticleDefinition
68 // G4ParticleTable is a "singleton" (only one and staic object)
69 // In G4ParticleTable, each G4ParticleDefinition pointer is stored
70 // with its name as a key to itself. So, each G4ParticleDefinition
71 // object must have unique name for itself.
72 //
73
74 public:
75
80
81 protected:
82 // default constructor
84 // Copy constructor and assignment operator
85 G4ParticleTable(const G4ParticleTable &right);
87
88 public:
89 virtual ~G4ParticleTable();
90
91 public: // With Description
93 // return the pointer to G4ParticleTable object
94 // G4ParticleTable is a "singleton" and can get its pointer by this function
95 // At the first time of calling this function, the G4ParticleTable object
96 // is instantiated
97
99 G4bool contains(const G4String &particle_name);
100 // returns TRUE if the ParticleTable contains
101
102 G4int entries() const;
103 G4int size() const;
104 // returns the number of Particles in the ParticleTable
105
107 // returns a pointer to i-th particles in the ParticleTable
108 // 0<= index < entries()
109
110 const G4String& GetParticleName(G4int index);
111 // returns name of i-th particles in the ParticleTable
112
114 G4ParticleDefinition* FindParticle(const G4String &particle_name);
116 // returns a pointer to the particle (0 if not contained)
117
121 // returns a pointer to its anti-particle (0 if not contained)
122
123 G4ParticleDefinition* FindIon( G4int atomicNumber,
124 G4int atomicMass,
125 G4double excitationEnergy );
126 G4ParticleDefinition* FindIon( G4int atomicNumber,
127 G4int atomicMass,
128 G4int numberOfLambda,
129 G4double excitationEnergy );
130 // return the pointer to an ion (returns 0 if the ion does not exist)
131 // the ion has excitation energy nearest to given excitationEnergy (0: ground state)
132
133 G4ParticleDefinition* GetIon( G4int atomicNumber,
134 G4int atomicMass,
135 G4double excitationEnergy);
136 G4ParticleDefinition* GetIon( G4int atomicNumber,
137 G4int atomicMass,
138 G4int numberOfLambda,
139 G4double excitationEnergy);
140 // return the pointer to an ion ( create ion if the ion does not exist)
141 // It has excitation energy nearest to given excitationEnergy (0: ground state)
142
143 G4ParticleDefinition* FindIon( G4int atomicNumber,
144 G4int atomicMass,
145 G4int dummy1,
146 G4int dummy2 );
147 // return the pointer to an ion
148 // !! This routine behaves same as GetIon( atomicNumber, atomicMass, 0)
149 // !! The third and fourth arguments are meaningless
150 // !! This routine is provided for compatibility to old version
151
153 // return the pointer of Iterator (RW compatible)
154
155 void DumpTable(const G4String &particle_name = "ALL");
156 // dump information of particles specified by name
157
158 public: //With Description
159
161 // return the pointer to G4IonTable object
162
164 // return the pointer to G4ShortLivedTable object
165
166 public: // With Description
168 // insert the particle into ParticleTable
169 // return value is same as particle if successfully inserted
170 // or pointer to another G4ParticleDefinition object
171 // which has same name of particle
172 // or 0 if fail to insert by another reason
173
175 // Remove the particle from the table (not delete)
176
177 void RemoveAllParticles();
178 // remove all particles from G4ParticleTable
179
180 void DeleteAllParticles();
181 // remove and delete all particles from G4ParticleTable
182
183 public:
185 void DeleteMessenger();
186 // create/delete messenger for the particle table
187
188 protected:
190
191 const G4String& GetKey(const G4ParticleDefinition *particle) const;
192 // return key value of the particle (i.e. particle name)
193
195 // return the pointer to EncodingDictionary
196
197 private:
198 G4int verboseLevel;
199 // controle flag for output message
200 // 0: Silent
201 // 1: Warning message
202 // 2: More
203
204 public:
207
208 private:
209 G4ParticleMessenger* fParticleMessenger;
210 G4PTblDictionary* fDictionary;
211 G4PTblDicIterator* fIterator;
212 G4PTblEncodingDictionary* fEncodingDictionary;
213
214 static G4ParticleTable* fgParticleTable;
215
216 G4IonTable* fIonTable;
217 G4ShortLivedTable* fShortLivedTable;
218
219 G4String noName;
220
221 G4bool readyToUse;
222
223 public:
224 void SetReadiness(G4bool val=true);
226 private:
227 void CheckReadiness();
228};
229#include "G4ParticleTable.icc"
230
231#endif
232
233
234
235
236
237
double G4double
Definition: G4Types.hh:64
int G4int
Definition: G4Types.hh:66
bool G4bool
Definition: G4Types.hh:67
std::map< K, V, std::less< K > > Map
G4bool GetReadiness() const
G4ParticleTableIterator< G4String, G4ParticleDefinition * > G4PTblDicIterator
G4PTblDictionary * GetDictionary()
G4int GetVerboseLevel() const
G4ParticleTableIterator< G4int, G4ParticleDefinition * > G4PTblEncodingDicIterator
G4int entries() const
const G4String & GetParticleName(G4int index)
G4ParticleTable & operator=(const G4ParticleTable &)
G4ParticleTableIterator< G4String, G4ParticleDefinition * >::Map G4PTblDictionary
G4bool contains(const G4String &particle_name)
G4PTblDicIterator * GetIterator()
G4ParticleDefinition * FindAntiParticle(const G4String &particle_name)
G4ParticleDefinition * FindIon(G4int atomicNumber, G4int atomicMass, G4double excitationEnergy)
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
static G4ParticleTable * GetParticleTable()
void SetVerboseLevel(G4int value)
G4ParticleDefinition * FindAntiParticle(const G4ParticleDefinition *particle)
G4ParticleDefinition * Insert(G4ParticleDefinition *particle)
G4bool contains(const G4ParticleDefinition *particle)
G4ParticleDefinition * Remove(G4ParticleDefinition *particle)
const G4ShortLivedTable * GetShortLivedTable()
G4int size() const
void SetReadiness(G4bool val=true)
G4IonTable * GetIonTable()
G4UImessenger * CreateMessenger()
const G4PTblEncodingDictionary * GetEncodingDictionary()
virtual ~G4ParticleTable()
G4ParticleDefinition * GetParticle(G4int index)
const G4String & GetKey(const G4ParticleDefinition *particle) const
G4ParticleTableIterator< G4int, G4ParticleDefinition * >::Map G4PTblEncodingDictionary
G4ParticleDefinition * FindAntiParticle(G4int PDGEncoding)
G4ParticleDefinition * GetIon(G4int atomicNumber, G4int atomicMass, G4double excitationEnergy)
void DumpTable(const G4String &particle_name="ALL")