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: G4IonTable.hh,v 1.31 2010/10/16 06:04:51 kurasige Exp $ |
---|
28 | // GEANT4 tag $Name: particles-V09-03-15 $ |
---|
29 | // |
---|
30 | // |
---|
31 | // ------------------------------------------------------------ |
---|
32 | // GEANT 4 class header file |
---|
33 | // |
---|
34 | // History: first implementation, |
---|
35 | // based on object model of June 27, 98 H.Kurashige |
---|
36 | // ------------------------------------------------------------ |
---|
37 | // added clear() 20 Mar., 08 H.Kurashige |
---|
38 | // modified GetIon 02 Aug., 98 H.Kurashige |
---|
39 | // added Remove() 06 Nov.,98 H.Kurashige |
---|
40 | // add GetNucleusMass 15 Mar. 99 H.Kurashige |
---|
41 | // ----- |
---|
42 | // Modified GetIon methods 17 Aug. 99 H.Kurashige |
---|
43 | // New design using G4VIsotopeTable 5 Oct. 99 H.Kurashige |
---|
44 | // Add GetNucleusEncoding according PDG 2006 9 Oct. 2006 H.Kurashige |
---|
45 | // Use STL map 30 Jul. 2009 H.Kurashige |
---|
46 | |
---|
47 | #ifndef G4IonTable_h |
---|
48 | #define G4IonTable_h 1 |
---|
49 | |
---|
50 | #include "G4ios.hh" |
---|
51 | #include "globals.hh" |
---|
52 | #include "G4ParticleDefinition.hh" |
---|
53 | #include "G4ParticleTable.hh" |
---|
54 | #include "G4Ions.hh" |
---|
55 | |
---|
56 | #include <cmath> |
---|
57 | #include <vector> |
---|
58 | #include <map> |
---|
59 | |
---|
60 | class G4ParticleTable; |
---|
61 | class G4VIsotopeTable; |
---|
62 | class G4IsotopeProperty; |
---|
63 | |
---|
64 | class G4IonTable |
---|
65 | { |
---|
66 | // Class Description |
---|
67 | // G4IonTable is the table of pointer to G4ParticleDefinition |
---|
68 | // In G4IonTable, each G4ParticleDefinition pointer is stored |
---|
69 | // |
---|
70 | |
---|
71 | public: |
---|
72 | // Use STL map as list of ions |
---|
73 | typedef std::multimap<G4int, const G4ParticleDefinition*> G4IonList; |
---|
74 | typedef std::multimap<G4int, const G4ParticleDefinition*>::iterator G4IonListIterator; |
---|
75 | |
---|
76 | public: |
---|
77 | // constructor |
---|
78 | G4IonTable(); |
---|
79 | |
---|
80 | protected: |
---|
81 | // hide copy construictor as protected |
---|
82 | G4IonTable(const G4IonTable &right); |
---|
83 | G4IonTable & operator = (const G4IonTable &) {return *this;} |
---|
84 | |
---|
85 | public: |
---|
86 | // destructor |
---|
87 | virtual ~G4IonTable(); |
---|
88 | |
---|
89 | public: // With Description |
---|
90 | G4int GetNumberOfElements() const; |
---|
91 | // Get number of elements defined in the IonTable |
---|
92 | |
---|
93 | // Register Isotope table |
---|
94 | void RegisterIsotopeTable(G4VIsotopeTable* table); |
---|
95 | G4VIsotopeTable* GetIsotopeTable(size_t idx=0) const; |
---|
96 | // G4IonTable asks properties of isotopes to this G4VIsotopeTable |
---|
97 | // by using FindIsotope(G4IsotopeProperty* property) method. |
---|
98 | |
---|
99 | // --------------------------- |
---|
100 | // FindIon/GetIon |
---|
101 | // FindIon methods return pointer of ion if it exists |
---|
102 | // GetIon methods also return pointer of ion. In GetIon |
---|
103 | // methods the designated ion will be created if it does not exist. |
---|
104 | // |
---|
105 | // !! PDGCharge inG4ParticleDefinition of ions is !! |
---|
106 | // !! electric charge of nucleus (i.e. fully ionized ions) !! |
---|
107 | // ----------------------------- |
---|
108 | |
---|
109 | // Find/Get "ground state" |
---|
110 | G4ParticleDefinition* GetIon(G4int Z, G4int A, G4int J=0); |
---|
111 | // The ion is assumed to be ground state (i.e Excited energy = 0) |
---|
112 | // Z: Atomic Number |
---|
113 | // A: Atomic Mass |
---|
114 | // J: Total Angular momentum (in unit of 1/2) |
---|
115 | G4ParticleDefinition* GetIon(G4int encoding); |
---|
116 | // The ion can be get by using PDG encoding |
---|
117 | // !! Only ground state can be obtained .i.e. Isomer = 0 |
---|
118 | |
---|
119 | void CreateAllIon(); |
---|
120 | // All ground state ions will be created |
---|
121 | |
---|
122 | // Find/Get "excited state" |
---|
123 | G4ParticleDefinition* FindIon(G4int Z, G4int A, G4double E, G4int J=0); |
---|
124 | G4ParticleDefinition* GetIon(G4int Z, G4int A, G4double E, G4int J=0); |
---|
125 | G4ParticleDefinition* FindIon(G4int Z, G4int A, G4int L, |
---|
126 | G4double E, G4int J=0); |
---|
127 | G4ParticleDefinition* GetIon(G4int Z, G4int A, G4int L, |
---|
128 | G4double E, G4int J=0); |
---|
129 | // Z: Atomic Number |
---|
130 | // A: Atomic Mass (nn + np +nlambda) |
---|
131 | // L: Number of Lmabda |
---|
132 | // J: Total Angular momentum (in unit of 1/2) |
---|
133 | // E: Excitaion energy |
---|
134 | |
---|
135 | G4ParticleDefinition* GetIon(G4int Z, G4int A, G4int J, G4int Q); |
---|
136 | // This method is provided for compatibilties |
---|
137 | // The third and last arguments gives no effect |
---|
138 | |
---|
139 | static G4bool IsIon(const G4ParticleDefinition*); |
---|
140 | // return true if the particle is ion |
---|
141 | |
---|
142 | static G4bool IsAntiIon(const G4ParticleDefinition*); |
---|
143 | // return true if the particle is anti_ion |
---|
144 | |
---|
145 | |
---|
146 | const G4String& GetIonName(G4int Z, G4int A, G4double E) const; |
---|
147 | const G4String& GetIonName(G4int Z, G4int A, G4int L, G4double E) const; |
---|
148 | // get ion name |
---|
149 | |
---|
150 | static G4int GetNucleusEncoding(G4int Z, G4int A, |
---|
151 | G4double E=0.0, G4int J=0); |
---|
152 | // get PDG code for Ions |
---|
153 | // Nuclear codes are given as 10-digit numbers +-100ZZZAAAI. |
---|
154 | //For a nucleus consisting of np protons and nn neutrons |
---|
155 | // A = np + nn and Z = np. |
---|
156 | // I gives the isomer level, with I = 0 corresponding |
---|
157 | // to the ground state and I >0 to excitations |
---|
158 | // |
---|
159 | //!!! I = 1 is assigned fo all excitation states in Geant4 |
---|
160 | |
---|
161 | static G4int GetNucleusEncoding(G4int Z, G4int A, G4int L, |
---|
162 | G4double E=0.0, G4int J=0); |
---|
163 | // get PDG code for Hyper-Nucleus Ions |
---|
164 | // Nuclear codes are given as 10-digit numbers +-10LZZZAAAI. |
---|
165 | //For a nucleus consisting of np protons and nn neutrons |
---|
166 | // A = np + nn +nlambda and Z = np. |
---|
167 | // L = nlambda |
---|
168 | // I gives the isomer level, with I = 0 corresponding |
---|
169 | // to the ground state and I >0 to excitations |
---|
170 | // |
---|
171 | //!!! I = 1 is assigned fo all excitation states in Geant4 |
---|
172 | |
---|
173 | static G4bool GetNucleusByEncoding(G4int encoding, |
---|
174 | G4int &Z, G4int &A, |
---|
175 | G4double &E, G4int &J); |
---|
176 | static G4bool GetNucleusByEncoding(G4int encoding, |
---|
177 | G4int &Z, G4int &A, G4int &L, |
---|
178 | G4double &E, G4int &J); |
---|
179 | //!!! Only ground states are supported now |
---|
180 | |
---|
181 | |
---|
182 | G4double GetIonMass(G4int Z, G4int A, G4int L=0) const; |
---|
183 | G4double GetNucleusMass(G4int Z, G4int A, G4int L=0) const; |
---|
184 | // These two methods returns Nucleus (i.e. full ionized atom) mass |
---|
185 | // ,where Z is Atomic Number (number of protons) and |
---|
186 | // A is Atomic Number (number of nucleons and hyperons) |
---|
187 | // L is number of lambda (A= nn + np + nlambda) |
---|
188 | |
---|
189 | |
---|
190 | |
---|
191 | G4int Entries() const; |
---|
192 | // Return number of ions in the table |
---|
193 | |
---|
194 | G4ParticleDefinition* GetParticle(G4int index) const; |
---|
195 | // Return the pointer of index-th ion in the table |
---|
196 | |
---|
197 | G4bool Contains(const G4ParticleDefinition *particle) const; |
---|
198 | // Return 'true' if the ion exists |
---|
199 | |
---|
200 | void Insert(const G4ParticleDefinition* particle); |
---|
201 | void Remove(const G4ParticleDefinition* particle); |
---|
202 | // Insert/Remove an ion in the table |
---|
203 | |
---|
204 | void clear(); |
---|
205 | // erase all contents in the list (not delete just remove) |
---|
206 | |
---|
207 | G4int size() const; |
---|
208 | // Return number of ions in the table |
---|
209 | |
---|
210 | void DumpTable(const G4String &particle_name = "ALL") const; |
---|
211 | // dump information of particles specified by name |
---|
212 | |
---|
213 | |
---|
214 | protected: |
---|
215 | G4ParticleDefinition* CreateIon(G4int Z, G4int A, G4double E, G4int J); |
---|
216 | G4ParticleDefinition* CreateIon(G4int Z, G4int A, G4int L, |
---|
217 | G4double E, G4int J); |
---|
218 | // Create Ion |
---|
219 | |
---|
220 | G4IsotopeProperty* FindIsotope(G4int Z, G4int A, G4double E, G4int J); |
---|
221 | // Ask properties of isotopes to this G4VIsotopeTable |
---|
222 | |
---|
223 | G4ParticleDefinition* GetLightIon(G4int Z, G4int A) const; |
---|
224 | G4ParticleDefinition* GetLightAntiIon(G4int Z, G4int A) const; |
---|
225 | |
---|
226 | G4bool IsLightIon(const G4ParticleDefinition*) const; |
---|
227 | G4bool IsLightAntiIon(const G4ParticleDefinition*) const; |
---|
228 | // return true if the particle is pre-defined ion |
---|
229 | |
---|
230 | void AddProcessManager(const G4String& ionName); |
---|
231 | // Add process manager to ions with name of 'ionName' |
---|
232 | |
---|
233 | G4int GetVerboseLevel() const; |
---|
234 | // get Verbose Level defined in G4ParticleTable |
---|
235 | |
---|
236 | private: |
---|
237 | G4IonList* fIonList; |
---|
238 | |
---|
239 | std::vector<G4VIsotopeTable*> *fIsotopeTableList; |
---|
240 | |
---|
241 | |
---|
242 | enum { numberOfElements = 118}; |
---|
243 | static const G4String elementName[numberOfElements]; |
---|
244 | |
---|
245 | }; |
---|
246 | |
---|
247 | inline G4int G4IonTable::GetNumberOfElements() const |
---|
248 | { |
---|
249 | return numberOfElements; |
---|
250 | } |
---|
251 | |
---|
252 | inline G4bool G4IonTable::Contains(const G4ParticleDefinition* particle) const |
---|
253 | { |
---|
254 | if (!IsIon(particle)) return false; |
---|
255 | |
---|
256 | G4int Z = particle->GetAtomicNumber(); |
---|
257 | G4int A = particle->GetAtomicMass(); |
---|
258 | G4int L = particle->GetQuarkContent(3); //strangeness |
---|
259 | G4int encoding=GetNucleusEncoding(Z, A, L); |
---|
260 | G4bool found = false; |
---|
261 | if (encoding !=0 ) { |
---|
262 | G4IonList::iterator i = fIonList->find(encoding); |
---|
263 | for( ;i != fIonList->end() ; i++) { |
---|
264 | if (particle == i->second ) { |
---|
265 | found = true; |
---|
266 | break; |
---|
267 | } |
---|
268 | } |
---|
269 | } |
---|
270 | return found; |
---|
271 | } |
---|
272 | |
---|
273 | inline G4int G4IonTable::Entries() const |
---|
274 | { |
---|
275 | return fIonList->size(); |
---|
276 | } |
---|
277 | |
---|
278 | inline G4int G4IonTable::size() const |
---|
279 | { |
---|
280 | return fIonList->size(); |
---|
281 | } |
---|
282 | |
---|
283 | inline void G4IonTable::clear() |
---|
284 | { |
---|
285 | #ifdef G4VERBOSE |
---|
286 | if (GetVerboseLevel()>2) { |
---|
287 | G4cout << "G4IonTable::Clear() : number of Ion regsitered = "; |
---|
288 | G4cout << fIonList->size() << G4endl; |
---|
289 | } |
---|
290 | #endif |
---|
291 | fIonList->clear(); |
---|
292 | } |
---|
293 | |
---|
294 | |
---|
295 | |
---|
296 | #endif |
---|
297 | |
---|
298 | |
---|
299 | |
---|
300 | |
---|
301 | |
---|
302 | |
---|
303 | |
---|
304 | |
---|
305 | |
---|
306 | |
---|