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

Last change on this file since 921 was 850, checked in by garnier, 16 years ago

geant4.8.2 beta

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