source: trunk/source/particles/management/include/G4IonTable.hh @ 1267

Last change on this file since 1267 was 1196, checked in by garnier, 15 years ago

update CVS release candidate geant4.9.3.01

File size: 10.0 KB
Line 
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.28 2009/09/23 12:13:48 kurasige Exp $
28// GEANT4 tag $Name: geant4-09-03-cand-01 $
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 "G4ParticleTableIterator.hh"
54#include "G4Ions.hh"
55
56#include <cmath>
57#include <vector>
58#include <map>
59
60class G4ParticleTable;
61class G4VIsotopeTable; 
62class G4IsotopeProperty;
63
64class 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, G4ParticleDefinition*> G4IonList;
74   typedef  std::multimap<G4int, 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   const G4String&  GetIonName(G4int Z, G4int A, G4double E) const;
143   const G4String&  GetIonName(G4int Z, G4int A, G4int L, G4double E) const;
144   // get ion name
145 
146   static G4int GetNucleusEncoding(G4int Z,        G4int A, 
147                                   G4double E=0.0, G4int J=0);
148  //  get PDG code for Ions
149  // Nuclear codes are given as 10-digit numbers +-100ZZZAAAI.
150  //For a nucleus consisting of np protons and nn neutrons
151  // A = np + nn and Z = np.
152  // I gives the isomer level, with I = 0 corresponding
153  // to the ground state and I >0 to excitations
154  //
155  //!!! I = 1 is assigned fo all excitation states in Geant4   
156 
157   static G4int GetNucleusEncoding(G4int Z,        G4int A,  G4int L,       
158                                   G4double E=0.0, G4int J=0);
159  //  get PDG code for Hyper-Nucleus Ions
160  // Nuclear codes are given as 10-digit numbers +-10LZZZAAAI.
161  //For a nucleus consisting of np protons and nn neutrons
162  // A = np + nn +nlambda and Z = np.
163  // L = nlambda
164  // I gives the isomer level, with I = 0 corresponding
165  // to the ground state and I >0 to excitations
166  //
167  //!!! I = 1 is assigned fo all excitation states in Geant4   
168
169   static G4bool GetNucleusByEncoding(G4int encoding,
170                                     G4int &Z,      G4int &A, 
171                                     G4double &E,   G4int &J);
172   static G4bool GetNucleusByEncoding(G4int encoding,
173                                      G4int &Z,      G4int &A,  G4int &L,   
174                                      G4double &E,   G4int &J);
175    //!!! Only ground states are supported now 
176 
177 
178   G4double             GetIonMass(G4int Z, G4int A, G4int L=0) const;
179   G4double             GetNucleusMass(G4int Z, G4int A, G4int L=0) const;
180   // These two methods returns Nucleus (i.e. full ionized atom) mass
181   // ,where Z is Atomic Number (number of protons) and
182   //  A is Atomic Number (number of nucleons and hyperons)
183   //  L is number of lambda (A= nn + np + nlambda)
184
185 
186   
187   G4int                 Entries() const;
188   // Return number of ions in the table
189
190   G4ParticleDefinition* GetParticle(G4int index) const;
191   // Return the pointer of index-th ion in the table
192 
193   G4bool                Contains(const G4ParticleDefinition *particle) const;
194   // Return 'true' if the ion exists
195
196   void                  Insert(G4ParticleDefinition* particle);
197   void                  Remove(G4ParticleDefinition* particle);
198   // Insert/Remove an ion in the table
199
200   void                  clear();
201   // erase all contents in the list (not delete just remove)
202
203   G4int                 size() const;
204   //  Return number of ions in the table
205
206    void DumpTable(const G4String &particle_name = "ALL") const;
207   // dump information of particles specified by name
208
209
210 protected:
211   G4ParticleDefinition* CreateIon(G4int Z, G4int A, G4double E, G4int J);
212   G4ParticleDefinition* CreateIon(G4int Z, G4int A, G4int L, 
213                                   G4double E, G4int J);
214   // Create Ion
215   
216   G4IsotopeProperty* FindIsotope(G4int Z, G4int A, G4double E, G4int J);
217   // Ask properties of isotopes to this G4VIsotopeTable
218   
219   G4ParticleDefinition* GetLightIon(G4int Z, G4int A) const;
220   
221   
222   G4bool                IsLightIon(G4ParticleDefinition*) const;
223   // return true if the particle is pre-defined ion
224 
225   void                  AddProcessManager(const G4String& ionName);
226   // Add process manager to ions with name of 'ionName'
227
228   G4int                GetVerboseLevel() const;
229   // get Verbose Level defined in G4ParticleTable
230
231 private:
232   G4IonList*                  fIonList; 
233
234   std::vector<G4VIsotopeTable*> *fIsotopeTableList;
235
236 
237   enum { numberOfElements = 118};
238   static const G4String       elementName[numberOfElements];
239
240};
241
242inline G4int  G4IonTable::GetNumberOfElements() const
243{
244  return numberOfElements;
245}
246
247inline G4bool  G4IonTable::Contains(const G4ParticleDefinition* particle) const
248{
249  if (!IsIon(particle)) return false;
250
251  G4int Z = particle->GetAtomicNumber();
252  G4int A = particle->GetAtomicMass(); 
253  G4int L = particle->GetQuarkContent(3);  //strangeness
254  G4int encoding=GetNucleusEncoding(Z, A, L);
255  G4bool found = false;
256  if (encoding !=0 ) {
257    G4IonList::iterator i = fIonList->find(encoding);
258    for( ;i != fIonList->end() ; i++) {
259      if (particle == i->second ) {
260        found  = true;
261        break;
262      }
263    }
264  }
265  return found;
266}
267
268inline G4int G4IonTable::Entries() const
269{
270  return fIonList->size();
271}
272
273inline G4int G4IonTable::size() const
274{
275  return fIonList->size();
276}
277
278inline void G4IonTable::clear()
279{
280#ifdef G4VERBOSE
281    if (GetVerboseLevel()>2) {
282      G4cout << "G4IonTable::Clear() : number of Ion regsitered =  "; 
283      G4cout << fIonList->size() <<  G4endl;
284    }
285#endif
286  fIonList->clear();
287}
288
289
290
291#endif
292
293
294
295
296
297
298
299
300
301
Note: See TracBrowser for help on using the repository browser.