G4IonTable.hh

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // $Id$
00028 //
00029 // 
00030 // ------------------------------------------------------------
00031 //      GEANT 4 class header file 
00032 //
00033 //      History: first implementation, 
00034 //      based on object model of June 27, 98 H.Kurashige
00035 // ------------------------------------------------------------
00036 //      added clear()                   20 Mar., 08 H.Kurashige
00037 //      modified GetIon                 02 Aug., 98 H.Kurashige
00038 //      added Remove()                  06 Nov.,98 H.Kurashige
00039 //      add GetNucleusMass              15 Mar. 99  H.Kurashige
00040 //          -----
00041 //      Modified GetIon methods                  17 Aug. 99 H.Kurashige
00042 //      New design using G4VIsotopeTable          5 Oct. 99 H.Kurashige
00043 //      Add GetNucleusEncoding according PDG 2006 9 Oct. 2006 H.Kurashige
00044 //      Use STL map                              30 Jul. 2009 H.Kurashige
00045 
00046 #ifndef G4IonTable_h
00047 #define G4IonTable_h 1
00048 
00049 #include "G4ios.hh"
00050 #include "globals.hh"
00051 #include "G4ParticleDefinition.hh"
00052 #include "G4ParticleTable.hh"
00053 #include "G4Ions.hh"
00054 
00055 #include <cmath>
00056 #include <vector>
00057 #include <map>
00058 
00059 class G4ParticleTable;
00060 class G4VIsotopeTable; 
00061 class G4IsotopeProperty;
00062 
00063 class G4IonTable
00064 {
00065  // Class Description
00066  //   G4IonTable is the table of pointer to G4ParticleDefinition
00067  //   In G4IonTable, each G4ParticleDefinition pointer is stored
00068  //
00069 
00070  public:
00071    // Use STL map as list of ions
00072    typedef  std::multimap<G4int, const G4ParticleDefinition*> G4IonList;
00073    typedef  std::multimap<G4int, const G4ParticleDefinition*>::iterator G4IonListIterator;
00074 
00075  public:
00076   // constructor
00077    G4IonTable();
00078 
00079  protected:
00080    // hide copy construictor as protected 
00081    G4IonTable(const  G4IonTable &right);
00082    G4IonTable & operator = (const G4IonTable &) {return *this;}
00083 
00084  public:
00085   // destructor
00086    virtual ~G4IonTable();
00087 
00088  public: // With Description
00089    G4int GetNumberOfElements() const;
00090    // Get number of elements defined in the IonTable
00091 
00092    // Register Isotope table
00093    void RegisterIsotopeTable(G4VIsotopeTable* table);
00094    G4VIsotopeTable* GetIsotopeTable(size_t idx=0) const;
00095    // G4IonTable asks properties of isotopes to this G4VIsotopeTable 
00096    // by using FindIsotope(G4IsotopeProperty* property) method.
00097    
00098    // ---------------------------  
00099    // FindIon/GetIon
00100    //   FindIon methods return pointer of ion if it exists       
00101    //   GetIon methods also return pointer of ion. In GetIon 
00102    //   methods the designated ion will be created if it does not exist.
00103    //
00104    // !! PDGCharge inG4ParticleDefinition of ions is           !!
00105    // !! electric charge of nucleus (i.e. fully ionized ions)  !!
00106    // -----------------------------
00107 
00108    // Find/Get "ground state" 
00109    G4ParticleDefinition* GetIon(G4int Z, G4int A, G4int J=0);
00110    // The ion is assumed to be ground state (i.e Excited energy = 0) 
00111    //   Z: Atomic Number
00112    //   A: Atomic Mass
00113    //   J: Total Angular momentum (in unit of 1/2)
00114    G4ParticleDefinition* GetIon(G4int encoding);
00115    // The ion can be get by using PDG encoding 
00116    // !! Only ground state can be obtained .i.e. Isomer = 0
00117    
00118    void CreateAllIon();
00119    // All ground state ions will be created
00120 
00121    // Find/Get "excited state" 
00122    G4ParticleDefinition* FindIon(G4int Z, G4int A, G4double E, G4int J=0);
00123    G4ParticleDefinition* GetIon(G4int Z, G4int A, G4double E, G4int J=0);
00124    G4ParticleDefinition* FindIon(G4int Z, G4int A, G4int L,
00125                                  G4double E, G4int J=0);
00126    G4ParticleDefinition* GetIon(G4int Z, G4int A, G4int L,
00127                                 G4double E, G4int J=0);
00128    //   Z: Atomic Number
00129    //   A: Atomic Mass (nn + np +nlambda)
00130    //   L: Number of Lmabda
00131    //   J: Total Angular momentum (in unit of 1/2)
00132    //   E: Excitaion energy
00133 
00134    G4ParticleDefinition* GetIon(G4int Z, G4int A, G4int J, G4int Q);
00135    // This method is provided for compatibilties 
00136    // The third and last arguments gives no effect
00137 
00138    static G4bool        IsIon(const G4ParticleDefinition*);
00139    // return true if the particle is ion
00140 
00141    static G4bool        IsAntiIon(const G4ParticleDefinition*);
00142    // return true if the particle is anti_ion
00143 
00144 
00145    const G4String&  GetIonName(G4int Z, G4int A, G4double E) const;
00146    const G4String&  GetIonName(G4int Z, G4int A, G4int L, G4double E) const;
00147    // get ion name
00148   
00149    static G4int GetNucleusEncoding(G4int Z,        G4int A, 
00150                                    G4double E=0.0, G4int J=0);
00151   //  get PDG code for Ions 
00152   // Nuclear codes are given as 10-digit numbers +-100ZZZAAAI.
00153   //For a nucleus consisting of np protons and nn neutrons
00154   // A = np + nn and Z = np.
00155   // I gives the isomer level, with I = 0 corresponding 
00156   // to the ground state and I >0 to excitations
00157   //
00159   
00160    static G4int GetNucleusEncoding(G4int Z,        G4int A,  G4int L,        
00161                                    G4double E=0.0, G4int J=0);
00162   //  get PDG code for Hyper-Nucleus Ions 
00163   // Nuclear codes are given as 10-digit numbers +-10LZZZAAAI.
00164   //For a nucleus consisting of np protons and nn neutrons
00165   // A = np + nn +nlambda and Z = np.
00166   // L = nlambda
00167   // I gives the isomer level, with I = 0 corresponding 
00168   // to the ground state and I >0 to excitations
00169   //
00171 
00172    static G4bool GetNucleusByEncoding(G4int encoding,
00173                                      G4int &Z,      G4int &A, 
00174                                      G4double &E,   G4int &J);
00175    static G4bool GetNucleusByEncoding(G4int encoding,
00176                                       G4int &Z,      G4int &A,  G4int &L,    
00177                                       G4double &E,   G4int &J);
00179  
00180  
00181    G4double             GetIonMass(G4int Z, G4int A, G4int L=0) const;
00182    G4double             GetNucleusMass(G4int Z, G4int A, G4int L=0) const;
00183    // These two methods returns Nucleus (i.e. full ionized atom) mass 
00184    // ,where Z is Atomic Number (number of protons) and
00185    //  A is Atomic Number (number of nucleons and hyperons)
00186    //  L is number of lambda (A= nn + np + nlambda)
00187 
00188  
00189    
00190    G4int                 Entries() const;
00191    // Return number of ions in the table
00192 
00193    G4ParticleDefinition* GetParticle(G4int index) const;
00194    // Return the pointer of index-th ion in the table
00195  
00196    G4bool                Contains(const G4ParticleDefinition *particle) const;
00197    // Return 'true' if the ion exists
00198 
00199    void                  Insert(const G4ParticleDefinition* particle);
00200    void                  Remove(const G4ParticleDefinition* particle);
00201    // Insert/Remove an ion in the table
00202 
00203    void                  clear();
00204    // erase all contents in the list (not delete just remove)
00205 
00206    G4int                 size() const;
00207    //  Return number of ions in the table
00208 
00209     void DumpTable(const G4String &particle_name = "ALL") const;
00210    // dump information of particles specified by name 
00211 
00212 
00213  protected:
00214    G4ParticleDefinition* CreateIon(G4int Z, G4int A, G4double E, G4int J);
00215    G4ParticleDefinition* CreateIon(G4int Z, G4int A, G4int L, 
00216                                    G4double E, G4int J);
00217    // Create Ion 
00218    
00219    G4IsotopeProperty* FindIsotope(G4int Z, G4int A, G4double E, G4int J);
00220    // Ask properties of isotopes to this G4VIsotopeTable 
00221    
00222    G4ParticleDefinition* GetLightIon(G4int Z, G4int A) const;
00223    G4ParticleDefinition* GetLightAntiIon(G4int Z, G4int A) const;
00224    
00225    G4bool                IsLightIon(const G4ParticleDefinition*) const;
00226    G4bool                IsLightAntiIon(const G4ParticleDefinition*) const;
00227    // return true if the particle is pre-defined ion
00228  
00229    void                  AddProcessManager(const G4String& ionName);
00230    // Add process manager to ions with name of 'ionName'
00231 
00232    G4int                GetVerboseLevel() const;
00233    // get Verbose Level defined in G4ParticleTable
00234 
00235  private:
00236    G4IonList*                  fIonList; 
00237 
00238    std::vector<G4VIsotopeTable*> *fIsotopeTableList;
00239 
00240  
00241    enum { numberOfElements = 118};
00242    static const G4String       elementName[numberOfElements];
00243 
00244 };
00245 
00246 inline G4int  G4IonTable::GetNumberOfElements() const
00247 {
00248   return numberOfElements;
00249 }
00250 
00251 inline G4bool  G4IonTable::Contains(const G4ParticleDefinition* particle) const
00252 {
00253   if (!IsIon(particle)) return false;
00254 
00255   G4int Z = particle->GetAtomicNumber();
00256   G4int A = particle->GetAtomicMass();  
00257   G4int L = particle->GetQuarkContent(3);  //strangeness 
00258   G4int encoding=GetNucleusEncoding(Z, A, L);
00259   G4bool found = false;
00260   if (encoding !=0 ) {
00261     G4IonList::iterator i = fIonList->find(encoding);
00262     for( ;i != fIonList->end() ; i++) {
00263       if (particle == i->second ) {
00264         found  = true;
00265         break;
00266       }
00267     }
00268   }
00269   return found;
00270 }
00271 
00272 inline G4int G4IonTable::Entries() const
00273 {
00274   return fIonList->size();
00275 }
00276 
00277 inline G4int G4IonTable::size() const
00278 {
00279   return fIonList->size();
00280 }
00281 
00282 
00283 #endif
00284 
00285 
00286 
00287 
00288 
00289 
00290 
00291 
00292 
00293 

Generated on Mon May 27 17:48:40 2013 for Geant4 by  doxygen 1.4.7