G4ParticleTable.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, based on object model of
00034 //      27 June 1996, H.Kurashige
00035 // ------------------------------------------------------------
00036 //      added fParticleMessenger         14 Nov., 97 H.Kurashige
00037 //      added Create/DeleteMessenger     06 Jul., 98 H.Kurashige
00038 //      modified FindIon                 02 Aug., 98 H.Kurashige
00039 //      added dictionary for encoding    24 Sep., 98 H.Kurashige
00040 //      added RemoveAllParticles()        8 Nov., 98 H.Kurashige
00041 //         --------------------------------
00042 //      fixed  some improper codings     08 Apr., 99 H.Kurashige
00043 //      modified FindIon/GetIon methods  17 AUg., 99 H.Kurashige
00044 //      implement new version for using STL map instaed of RW PtrHashedDictionary
00045 //                                       28 ct., 99  H.Kurashige
00046 //      modified implementation of Remove 21 Mar.,08  H.Kurashige
00047 
00048 #ifndef G4ParticleTable_h
00049 #define G4ParticleTable_h 1
00050 
00051 #include "G4ios.hh"
00052 #include "globals.hh"
00053 #include "G4ParticleDefinition.hh"
00054 
00055 
00056 #include <map>
00057 #include "G4ParticleTableIterator.hh"
00058 
00059 class G4UImessenger;
00060 class G4ParticleMessenger;
00061 class G4IonTable;
00062 class G4ShortLivedTable;
00063 
00064 class G4ParticleTable
00065 {
00066  // Class Description
00067  //   G4ParticleTable is the table of pointer to G4ParticleDefinition
00068  //   G4ParticleTable is a "singleton" (only one and staic object)
00069  //   In G4ParticleTable, each G4ParticleDefinition pointer is stored
00070  //   with its name as a key to itself. So, each  G4ParticleDefinition 
00071  //   object must have unique name for itself. 
00072  //   
00073 
00074  public:
00075 
00076    typedef G4ParticleTableIterator<G4String, G4ParticleDefinition*>::Map G4PTblDictionary;
00077    typedef G4ParticleTableIterator<G4String, G4ParticleDefinition*> G4PTblDicIterator;
00078    typedef G4ParticleTableIterator<G4int, G4ParticleDefinition*>::Map G4PTblEncodingDictionary;
00079    typedef G4ParticleTableIterator<G4int, G4ParticleDefinition*> G4PTblEncodingDicIterator;
00080 
00081  protected:
00082    // default constructor
00083    G4ParticleTable();
00084    // Copy constructor and assignment operator
00085    G4ParticleTable(const  G4ParticleTable &right);
00086    G4ParticleTable & operator=(const G4ParticleTable &);
00087 
00088  public:
00089    virtual ~G4ParticleTable();
00090   
00091  public: // With Description
00092    static G4ParticleTable* GetParticleTable();
00093    // return the pointer to G4ParticleTable object
00094    //   G4ParticleTable is a "singleton" and can get its pointer by this function
00095    //   At the first time of calling this function, the G4ParticleTable object
00096    //   is instantiated 
00097 
00098    G4bool   contains(const G4ParticleDefinition *particle);
00099    G4bool   contains(const G4String &particle_name);
00100    // returns TRUE if the ParticleTable contains 
00101 
00102    G4int    entries() const;
00103    G4int    size() const;
00104    // returns the number of Particles in the ParticleTable
00105    
00106    G4ParticleDefinition* GetParticle(G4int index);
00107    // returns a pointer to i-th particles in the ParticleTable
00108    //    0<= index < entries()
00109 
00110    const G4String& GetParticleName(G4int index);
00111    // returns name of i-th particles in the ParticleTable
00112 
00113    G4ParticleDefinition* FindParticle(G4int  PDGEncoding );
00114    G4ParticleDefinition* FindParticle(const G4String &particle_name);
00115    G4ParticleDefinition* FindParticle(const G4ParticleDefinition *particle);
00116    // returns a pointer to the particle (0 if not contained)
00117 
00118    G4ParticleDefinition* FindAntiParticle(G4int  PDGEncoding );
00119    G4ParticleDefinition* FindAntiParticle(const G4String &particle_name);
00120    G4ParticleDefinition* FindAntiParticle(const G4ParticleDefinition *particle);
00121    // returns a pointer to its anti-particle (0 if not contained)
00122 
00123    G4ParticleDefinition* FindIon( G4int    atomicNumber, 
00124                                   G4int    atomicMass, 
00125                                   G4double excitationEnergy );
00126    G4ParticleDefinition* FindIon( G4int    atomicNumber, 
00127                                   G4int    atomicMass, 
00128                                   G4int    numberOfLambda, 
00129                                   G4double excitationEnergy );
00130    //  return the pointer to an ion  (returns 0 if the ion does not exist)
00131    //  the ion has excitation energy nearest to given excitationEnergy  (0: ground state)
00132 
00133    G4ParticleDefinition* GetIon(  G4int    atomicNumber, 
00134                                   G4int    atomicMass, 
00135                                   G4double   excitationEnergy);
00136    G4ParticleDefinition* GetIon(  G4int    atomicNumber, 
00137                                   G4int    atomicMass, 
00138                                   G4int    numberOfLambda, 
00139                                   G4double   excitationEnergy);
00140    //  return the pointer to an ion ( create ion if the ion does not exist)
00141    //  It has excitation energy nearest to given excitationEnergy  (0: ground state)
00142   
00143    G4ParticleDefinition* FindIon( G4int atomicNumber, 
00144                                   G4int atomicMass, 
00145                                   G4int dummy1,
00146                                   G4int dummy2 );
00147    //  return the pointer to an ion
00148    //  !! This routine behaves same as GetIon( atomicNumber, atomicMass, 0) 
00149    //  !! The third and fourth arguments are meaningless
00150    //  !! This routine is provided for compatibility to old version
00151 
00152    G4PTblDicIterator* GetIterator();
00153    // return the pointer of Iterator (RW compatible)
00154    
00155    void DumpTable(const G4String &particle_name = "ALL");
00156    // dump information of particles specified by name 
00157 
00158  public: //With Description
00159 
00160    G4IonTable* GetIonTable();
00161    // return the pointer to G4IonTable object
00162 
00163    const G4ShortLivedTable* GetShortLivedTable();
00164    // return the pointer to G4ShortLivedTable object
00165  
00166  public: // With Description
00167    G4ParticleDefinition* Insert(G4ParticleDefinition *particle);
00168    // insert the particle into ParticleTable 
00169    // return value is same as particle if successfully inserted
00170    //              or pointer to another G4ParticleDefinition object 
00171    //                   which has same name of particle
00172    //              or 0 if fail to insert by another reason
00173 
00174    G4ParticleDefinition* Remove(G4ParticleDefinition *particle);
00175    // Remove the particle from the table (not delete)
00176 
00177    void RemoveAllParticles();
00178    // remove all particles from G4ParticleTable 
00179 
00180    void DeleteAllParticles();
00181    // remove and delete all particles from G4ParticleTable  
00182 
00183  public:
00184    G4UImessenger*       CreateMessenger();
00185    void                 DeleteMessenger();
00186   // create/delete messenger for the particle table 
00187  
00188  protected:
00189    G4PTblDictionary* GetDictionary();
00190 
00191    const G4String& GetKey(const G4ParticleDefinition *particle) const;
00192    // return key value of the particle (i.e. particle name)
00193 
00194    const G4PTblEncodingDictionary* GetEncodingDictionary();
00195    // return the pointer to EncodingDictionary
00196 
00197  private:
00198    G4int verboseLevel;
00199    // controle flag for output message
00200    //  0: Silent
00201    //  1: Warning message
00202    //  2: More
00203 
00204  public:
00205    void  SetVerboseLevel(G4int value);
00206    G4int GetVerboseLevel() const;
00207 
00208  private:
00209    G4ParticleMessenger* fParticleMessenger;
00210    G4PTblDictionary*  fDictionary;
00211    G4PTblDicIterator* fIterator;
00212    G4PTblEncodingDictionary* fEncodingDictionary;
00213 
00214    static G4ParticleTable*  fgParticleTable;
00215 
00216    G4IonTable*            fIonTable;
00217    G4ShortLivedTable*     fShortLivedTable;
00218 
00219    G4String               noName;
00220 
00221    G4bool  readyToUse;
00222  
00223  public:
00224    void SetReadiness(G4bool val=true);
00225    G4bool GetReadiness() const;
00226  private:
00227    void CheckReadiness();
00228 };
00229 #include "G4ParticleTable.icc"
00230 
00231 #endif
00232 
00233 
00234 
00235 
00236 
00237 

Generated on Mon May 27 17:49:16 2013 for Geant4 by  doxygen 1.4.7