source: trunk/source/particles/management/include/G4ParticleTable.hh@ 1339

Last change on this file since 1339 was 1337, checked in by garnier, 15 years ago

tag geant4.9.4 beta 1 + modifs locales

File size: 8.7 KB
RevLine 
[824]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//
[850]27// $Id: G4ParticleTable.hh,v 1.21 2008/03/22 06:03:40 kurasige Exp $
[1337]28// GEANT4 tag $Name: geant4-09-04-beta-01 $
[824]29//
30//
31// ------------------------------------------------------------
32// GEANT 4 class header file
33//
34// History: first implementation, based on object model of
35// 27 June 1996, H.Kurashige
36// ------------------------------------------------------------
37// added fParticleMessenger 14 Nov., 97 H.Kurashige
38// added Create/DeleteMessenger 06 Jul., 98 H.Kurashige
39// modified FindIon 02 Aug., 98 H.Kurashige
40// added dictionary for encoding 24 Sep., 98 H.Kurashige
41// added RemoveAllParticles() 8 Nov., 98 H.Kurashige
42// --------------------------------
43// fixed some improper codings 08 Apr., 99 H.Kurashige
44// modified FindIon/GetIon methods 17 AUg., 99 H.Kurashige
45// implement new version for using STL map instaed of RW PtrHashedDictionary
46// 28 ct., 99 H.Kurashige
47// modified implementation of Remove 21 Mar.,08 H.Kurashige
48
49#ifndef G4ParticleTable_h
50#define G4ParticleTable_h 1
51
52#include "G4ios.hh"
53#include "globals.hh"
54#include "G4ParticleDefinition.hh"
55
56
57#include <map>
58#include "G4ParticleTableIterator.hh"
59
60class G4UImessenger;
61class G4ParticleMessenger;
62class G4IonTable;
63class G4ShortLivedTable;
64
65class G4ParticleTable
66{
67 // Class Description
68 // G4ParticleTable is the table of pointer to G4ParticleDefinition
69 // G4ParticleTable is a "singleton" (only one and staic object)
70 // In G4ParticleTable, each G4ParticleDefinition pointer is stored
71 // with its name as a key to itself. So, each G4ParticleDefinition
72 // object must have unique name for itself.
73 //
74
75 public:
76
77 typedef G4ParticleTableIterator<G4String, G4ParticleDefinition*>::Map G4PTblDictionary;
78 typedef G4ParticleTableIterator<G4String, G4ParticleDefinition*> G4PTblDicIterator;
79 typedef G4ParticleTableIterator<G4int, G4ParticleDefinition*>::Map G4PTblEncodingDictionary;
80 typedef G4ParticleTableIterator<G4int, G4ParticleDefinition*> G4PTblEncodingDicIterator;
81
82 protected:
83 G4ParticleTable();
84 G4ParticleTable(const G4ParticleTable &right);
85
86 public:
87 virtual ~G4ParticleTable();
88
89 public: // With Description
90 static G4ParticleTable* GetParticleTable();
91 // return the pointer to G4ParticleTable object
92 // G4ParticleTable is a "singleton" and can get its pointer by this function
93 // At the first time of calling this function, the G4ParticleTable object
94 // is instantiated
95
96 G4bool contains(const G4ParticleDefinition *particle);
97 G4bool contains(const G4String &particle_name);
98 // returns TRUE if the ParticleTable contains
99
100 G4int entries() const;
101 G4int size() const;
102 // returns the number of Particles in the ParticleTable
103
104 G4ParticleDefinition* GetParticle(G4int index);
105 // returns a pointer to i-th particles in the ParticleTable
106 // 0<= index < entries()
107
108 const G4String& GetParticleName(G4int index);
109 // returns name of i-th particles in the ParticleTable
110
111 G4ParticleDefinition* FindParticle(G4int PDGEncoding );
112 G4ParticleDefinition* FindParticle(const G4String &particle_name);
113 G4ParticleDefinition* FindParticle(const G4ParticleDefinition *particle);
114 // returns a pointer to the particle (0 if not contained)
115
116 G4ParticleDefinition* FindAntiParticle(G4int PDGEncoding );
117 G4ParticleDefinition* FindAntiParticle(const G4String &particle_name);
118 G4ParticleDefinition* FindAntiParticle(const G4ParticleDefinition *particle);
119 // returns a pointer to its anti-particle (0 if not contained)
120
121 G4ParticleDefinition* FindIon( G4int atomicNumber,
122 G4int atomicMass,
123 G4double excitationEnergy );
124 G4ParticleDefinition* FindIon( G4int atomicNumber,
125 G4int atomicMass,
126 G4int numberOfLambda,
127 G4double excitationEnergy );
128 // return the pointer to an ion (returns 0 if the ion does not exist)
129 // the ion has excitation energy nearest to given excitationEnergy (0: ground state)
130
131 G4ParticleDefinition* GetIon( G4int atomicNumber,
132 G4int atomicMass,
133 G4double excitationEnergy);
134 G4ParticleDefinition* GetIon( G4int atomicNumber,
135 G4int atomicMass,
136 G4int numberOfLambda,
137 G4double excitationEnergy);
138 // return the pointer to an ion ( create ion if the ion does not exist)
139 // It has excitation energy nearest to given excitationEnergy (0: ground state)
140
141 G4ParticleDefinition* FindIon( G4int atomicNumber,
142 G4int atomicMass,
143 G4int dummy1,
144 G4int dummy2 );
145 // return the pointer to an ion
146 // !! This routine behaves same as GetIon( atomicNumber, atomicMass, 0)
147 // !! The third and fourth arguments are meaningless
148 // !! This routine is provided for compatibility to old version
149
150 G4PTblDicIterator* GetIterator();
151 // return the pointer of Iterator (RW compatible)
152
153 void DumpTable(const G4String &particle_name = "ALL");
154 // dump information of particles specified by name
155
156 public: //With Description
157
158 G4IonTable* GetIonTable();
159 // return the pointer to G4IonTable object
160
161 const G4ShortLivedTable* GetShortLivedTable();
162 // return the pointer to G4ShortLivedTable object
163
164 public: // With Description
165 G4ParticleDefinition* Insert(G4ParticleDefinition *particle);
166 // insert the particle into ParticleTable
167 // return value is same as particle if successfully inserted
168 // or pointer to another G4ParticleDefinition object
169 // which has same name of particle
170 // or 0 if fail to insert by another reason
171
172 G4ParticleDefinition* Remove(G4ParticleDefinition *particle);
173 // Remove the particle from the table (not delete)
174
175 void RemoveAllParticles();
176 // remove all particles from G4ParticleTable
177
178 void DeleteAllParticles();
179 // remove and delete all particles from G4ParticleTable
180
181 public:
182 G4UImessenger* CreateMessenger();
183 void DeleteMessenger();
184 // create/delete messenger for the particle table
185
186 protected:
187 G4PTblDictionary* GetDictionary();
188
189 const G4String& GetKey(const G4ParticleDefinition *particle) const;
190 // return key value of the particle (i.e. particle name)
191
192 const G4PTblEncodingDictionary* GetEncodingDictionary();
193 // return the pointer to EncodingDictionary
194
195 private:
196 G4int verboseLevel;
197 // controle flag for output message
198 // 0: Silent
199 // 1: Warning message
200 // 2: More
201
202 public:
203 void SetVerboseLevel(G4int value);
204 G4int GetVerboseLevel() const;
205
206 private:
207 G4ParticleMessenger* fParticleMessenger;
208 G4PTblDictionary* fDictionary;
209 G4PTblDicIterator* fIterator;
210 G4PTblEncodingDictionary* fEncodingDictionary;
211 G4int DictionaryBucketSize;
212
213 static G4ParticleTable* fgParticleTable;
214
215 G4IonTable* fIonTable;
216 G4ShortLivedTable* fShortLivedTable;
217
218 G4String noName;
219
220 G4bool readyToUse;
221
222 public:
223 void SetReadiness();
224 G4bool GetReadiness() const;
225 private:
226 void CheckReadiness();
227};
228#include "G4ParticleTable.icc"
229
230#endif
231
232
233
234
235
236
Note: See TracBrowser for help on using the repository browser.