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