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.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /particles/management/include/G4IonTable.hh (Version 11.3.0) and /particles/management/include/G4IonTable.hh (Version 5.2.p1)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                    <<   3 // * DISCLAIMER                                                       *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th <<   5 // * The following disclaimer summarizes all the specific disclaimers *
  6 // * the Geant4 Collaboration.  It is provided <<   6 // * of contributors to this software. The specific disclaimers,which *
  7 // * conditions of the Geant4 Software License <<   7 // * govern, are listed with their locations in:                      *
  8 // * LICENSE and available at  http://cern.ch/ <<   8 // *   http://cern.ch/geant4/license                                  *
  9 // * include a list of copyright holders.      << 
 10 // *                                                9 // *                                                                  *
 11 // * Neither the authors of this software syst     10 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     11 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     12 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     13 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file  <<  14 // * use.                                                             *
 16 // * for the full disclaimer and the limitatio << 
 17 // *                                               15 // *                                                                  *
 18 // * This  code  implementation is the result  <<  16 // * This  code  implementation is the  intellectual property  of the *
 19 // * technical work of the GEANT4 collaboratio <<  17 // * GEANT4 collaboration.                                            *
 20 // * By using,  copying,  modifying or  distri <<  18 // * By copying,  distributing  or modifying the Program (or any work *
 21 // * any work based  on the software)  you  ag <<  19 // * based  on  the Program)  you indicate  your  acceptance of  this *
 22 // * use  in  resulting  scientific  publicati <<  20 // * statement, and all its terms.                                    *
 23 // * acceptance of all terms of the Geant4 Sof << 
 24 // *******************************************     21 // ********************************************************************
 25 //                                                 22 //
 26 // G4IonTable                                  << 
 27 //                                                 23 //
 28 // Class description:                          <<  24 // $Id: G4IonTable.hh,v 1.20 2003/06/16 16:58:03 gunter Exp $
                                                   >>  25 // GEANT4 tag $Name: geant4-05-02-patch-01 $
 29 //                                                 26 //
 30 // G4IonTable stores all pointers to G4Particl <<  27 // 
                                                   >>  28 // ------------------------------------------------------------
                                                   >>  29 //  GEANT 4 class header file 
                                                   >>  30 //
                                                   >>  31 //  History: first implementation, 
                                                   >>  32 //      based on object model of June 27, 98 H.Kurashige
                                                   >>  33 // ------------------------------------------------------------
                                                   >>  34 //      modified GetIon                 02 Aug., 98 H.Kurashige
                                                   >>  35 //      added Remove()                  06 Nov.,98 H.Kurashige
                                                   >>  36 //      add GetNucleusMass              15 Mar. 99  H.Kurashige
                                                   >>  37 //          -----
                                                   >>  38 //      Modified GetIon methods                  17 Aug. 99 H.Kurashige
                                                   >>  39 //      New design using G4VIsotopeTable          5 Oct. 99 H.Kurashige
 31                                                    40 
 32 // Author: H.Kurashige, 27 June 1998           <<  41 #ifndef G4IonTable_h
 33 // ------------------------------------------- <<  42 #define G4IonTable_h 1
 34 #ifndef G4IonTable_hh                          << 
 35 #define G4IonTable_hh 1                        << 
 36                                                    43 
 37 #include "G4Ions.hh"                           << 
 38 #include "G4ParticleDefinition.hh"             << 
 39 #include "G4ParticleTable.hh"                  << 
 40 #include "G4ios.hh"                                44 #include "G4ios.hh"
 41 #include "globals.hh"                              45 #include "globals.hh"
                                                   >>  46 #include "G4ParticleDefinition.hh"
 42                                                    47 
 43 #include <cmath>                               << 
 44 #include <map>                                 << 
 45 #include <vector>                                  48 #include <vector>
 46                                                    49 
 47 class G4ParticleTable;                             50 class G4ParticleTable;
 48 class G4VIsotopeTable;                         <<  51 class G4VIsotopeTable; 
 49 class G4IsotopeProperty;                           52 class G4IsotopeProperty;
 50 class G4NuclideTable;                          << 
 51                                                    53 
 52 class G4IonTable                                   54 class G4IonTable
 53 {                                                  55 {
 54   public:                                      <<  56  // Class Description
 55     using G4IonList = std::multimap<G4int, con <<  57  //   G4IonTable is the table of pointer to G4ParticleDefinition
 56     using G4IonListIterator = std::multimap<G4 <<  58  //   In G4IonTable, each G4ParticleDefinition pointer is stored
 57                                                <<  59  //
 58     // Constructor, destructor                 <<  60 
 59     G4IonTable();                              <<  61  public:
 60     ~G4IonTable();                             <<  62    // Use STL Vector as list of ions
 61                                                <<  63    typedef std::vector<G4ParticleDefinition*> G4IonList;
 62     // Forbidden copy constructor and assignme <<  64 
 63     G4IonTable(const G4IonTable&) = delete;    <<  65  public:
 64     G4IonTable& operator=(const G4IonTable&) = <<  66   // constructor
 65                                                <<  67    G4IonTable();
 66     static G4IonTable* GetIonTable();          <<  68 
 67                                                <<  69  protected:
 68     // Method is used by each worker thread to <<  70    // hide copy construictor as protected 
 69     // from the master thread.                 <<  71    G4IonTable(const  G4IonTable &right);
 70     void WorkerG4IonTable();                   <<  72    G4IonTable & operator = (const G4IonTable &) {return *this;}
 71                                                <<  73 
 72     // Destructor for worker                   <<  74  public:
 73     void DestroyWorkerG4IonTable();            <<  75   // destructor
 74                                                <<  76    virtual ~G4IonTable();
 75     // Get number of elements defined in the I <<  77 
 76     G4int GetNumberOfElements() const;         <<  78  public: // With Description
 77                                                <<  79    G4int GetNumberOfElements() const;
 78     // Register Isotope table                  <<  80    // Get number of elements defined in the IonTable
 79     void RegisterIsotopeTable(G4VIsotopeTable* <<  81 
 80                                                <<  82    // Register Isotope table
 81     // G4IonTable asks properties of isotopes  <<  83    void RegisterIsotopeTable(G4VIsotopeTable* table);
 82     // by using FindIsotope(G4IsotopeProperty* <<  84    G4VIsotopeTable* GetIsotopeTable() const;
 83     G4VIsotopeTable* GetIsotopeTable(std::size <<  85    // G4IonTable asks properties of isotopes to this G4VIsotopeTable 
 84                                                <<  86    // by using FindIsotope(G4IsotopeProperty* property) method.
 85     // All ground state ions are created.      <<  87    
 86     // Stable ground states are defined in G4N <<  88    // ---------------------------  
 87     void CreateAllIon();                       <<  89    // FindIon/GetIon
 88                                                <<  90    //   FindIon methods return pointer of ion if it exists       
 89     // All excited ions with long life time (> <<  91    //   GetIon methods also return pointer of ion. In GetIon 
 90     // Isomers are defined in G4VIsotopeTable  <<  92    //   methods the designated ion will be created if it does not exist.
 91     void CreateAllIsomer();                    <<  93    //
 92                                                <<  94    // !! PDGCharge inG4ParticleDefinition of ions is           !!
 93     // All nuclide with a life time longer tha <<  95    // !! electric charge of nucleus (i.e. fully ionized ions)  !!
 94     // prior to the event loop                 <<  96    // -----------------------------
 95     void PrepareNuclideTable();                <<  97 
 96     void PreloadNuclide();                     <<  98    // Find/Get "ground state" 
 97                                                <<  99    G4ParticleDefinition* GetIon(G4int Z, G4int A, G4int J=0);
 98     // --------------------------------------- << 100    // The ion is assumed to be ground state (i.e Excited energy = 0) 
 99     // FindIon/GetIon                          << 101    //   Z: Atomic Number
100     //   FindIon() methods return pointer of i << 102    //   A: Atomic Mass
101     //   GetIon() methods also return pointer  << 103    //   J: Total Angular momentum (in unit of 1/2)
102     //   ion is created if it does not exist.  << 104 
103     //                                         << 105    // Find/Get "excited state" 
104     // !! PDGCharge in G4ParticleDefinition of << 106    G4ParticleDefinition* FindIon(G4int Z, G4int A, G4double E, G4int J=0);
105     // !! electric charge of nucleus (i.e. ful << 107    G4ParticleDefinition* GetIon(G4int Z, G4int A, G4double E, G4int J=0);
106     // --------------------------------------- << 108    //   Z: Atomic Number
107                                                << 109    //   A: Atomic Mass
108     // Find/Get "ground state" and "excited st << 110    //   J: Total Angular momentum (in unit of 1/2)
109     //                                         << 111    //   E: Excitaion energy
110     G4ParticleDefinition* GetIon(G4int Z, G4in << 112 
111     G4ParticleDefinition* GetIon(G4int Z, G4in << 113    G4ParticleDefinition* GetIon(G4int Z, G4int A, G4int J, G4int Q);
112     G4ParticleDefinition* GetIon(G4int Z, G4in << 114    // This method is provided for compatibilties 
113     G4ParticleDefinition* GetIon(G4int Z, G4in << 115    // The third and last arguments gives no effect
114                                  G4int J = 0); << 116 
115     G4ParticleDefinition* GetIon(G4int Z, G4in << 117    static G4bool        IsIon(G4ParticleDefinition*);
116     G4ParticleDefinition* GetIon(G4int Z, G4in << 118    // return true if the particle is ion
117     G4ParticleDefinition* GetIon(G4int Z, G4in << 119 
118                                  G4Ions::G4Flo << 120    G4String             GetIonName(G4int Z, G4int A, G4double E) const;
119     G4ParticleDefinition* GetIon(G4int Z, G4in << 121    // get ion name
120     // Z: Atomic Number                        << 122 
121     // A: Atomic Mass (nn + np +nlambda)       << 123    G4double             GetIonMass(G4int Z, G4int A) const;
122     // nL: Number of Lambda                    << 124    G4double             GetNucleusMass(G4int Z, G4int A) const;
123     // E: Excitation energy                    << 125    // These two methods returns Nucleus (i.e. full ionized atom) mass 
124     // lvl:  Isomer Level 0: ground state)     << 126    // ,where Z is Atomic Number (number of protons) and
125     // flb:  Floating level base (enum defined << 127    //  A is Atomic Number (number of nucleons)
126     // flbChar:  Floating level base denoted b << 128 
127     //           (<null>,X,Y,Z,U,V,W,R,S,T,A,B << 129   
128     // J: Total Angular momentum (in unit of 1 << 130    G4int                 Entries() const;
129                                                << 131    // Return number of ions in the table
130     // The ion can be retrieved by using PDG e << 132 
131     // !! Only ground state can be obtained .i << 133    G4ParticleDefinition* GetParticle(G4int index) const;
132     G4ParticleDefinition* GetIon(G4int encodin << 134    // Return the pointer of index-th ion in the table
133                                                << 135 
134     // Find/Get "excited state"                << 136    G4bool                Contains(const G4ParticleDefinition *particle) const;
135     //                                         << 137    // Return 'true' if the ion exists
136     G4ParticleDefinition* FindIon(G4int Z, G4i << 138 
137     G4ParticleDefinition* FindIon(G4int Z, G4i << 139    void                  Insert(G4ParticleDefinition* particle);
138     G4ParticleDefinition* FindIon(G4int Z, G4i << 140    void                  Remove(G4ParticleDefinition* particle);
139     G4ParticleDefinition* FindIon(G4int Z, G4i << 141    // Insert/Remove an ion in the table
140                                   G4int J = 0) << 142 
141     G4ParticleDefinition* FindIon(G4int Z, G4i << 143     void DumpTable(const G4String &particle_name = "ALL") const;
142     G4ParticleDefinition* FindIon(G4int Z, G4i << 144    // dump information of particles specified by name 
143     G4ParticleDefinition* FindIon(G4int Z, G4i << 145 
144                                   G4Ions::G4Fl << 146 
145     G4ParticleDefinition* FindIon(G4int Z, G4i << 147  protected:
146                                   G4int J = 0) << 148    G4ParticleDefinition* CreateIon(G4int Z, G4int A, G4double E, G4int J);
147     // Z: Atomic Number                        << 149    // Create Ion 
148     // A: Atomic Mass (nn + np +nlambda)       << 150    
149     // nL: Number of Lambda                    << 151    G4IsotopeProperty* FindIsotope(G4int Z, G4int A, G4double E, G4int J);
150     // E: Excitaion energy                     << 152    // Ask properties of isotopes to this G4VIsotopeTable 
151     // lvl:  Isomer Level 0: ground state)     << 153    
152     // flb:  Floating level base (enum defined << 154    G4ParticleDefinition* GetLightIon(G4int Z, G4int A) const;
153     // flbChar:  Floating level base denoted b << 155    
154     //           (<null>,X,Y,Z,U,V,W,R,S,T,A,B << 156    
155     // J: Total Angular momentum (in unit of 1 << 157    G4bool                IsLightIon(G4ParticleDefinition*) const;
156                                                << 158    // return true if the particle is pre-defined ion
157     // Return true if the particle is ion      << 159  
158     static G4bool IsIon(const G4ParticleDefini << 160    void                  AddProcessManager(const G4String& ionName);
159                                                << 161    // Add process manager to ions with name of 'ionName'
160     // Return true if the particle is anti_ion << 162 
161     static G4bool IsAntiIon(const G4ParticleDe << 163    G4int                GetVerboseLevel() const;
162                                                << 164    // get Verbose Level defined in G4ParticleTable
163     // Get ion name                            << 165 
164     G4String GetIonName(G4int Z, G4int A, G4in << 166  private:
165     G4String GetIonName(G4int Z, G4int A, G4do << 167    G4IonList*                  fIonList; 
166                         G4Ions::G4FloatLevelBa << 168 
167     G4String GetIonName(G4int Z, G4int A, G4in << 169    G4VIsotopeTable*            fIsotopeTable;
168                         G4Ions::G4FloatLevelBa << 170  
169     G4String GetIonName(G4int Z, G4int A, G4in << 171    enum { numberOfElements = 110};
170                                                << 172    static const G4String       elementName[numberOfElements];
171     // Get PDG code for Ions.                  << 173 
172     // Nuclear codes are given as 10-digit num << 174 };
173     // For a nucleus consisting of np protons  << 175 
174     // A = np + nn and Z = np.                 << 176 inline G4int  G4IonTable::GetNumberOfElements() const
175     // I gives the isomer level, with I = 0 co << 177 {
176     // to the ground state and I >0 to excitat << 178   return numberOfElements;
177     static G4int GetNucleusEncoding(G4int Z, G << 179 }
178                                                << 180 inline G4bool  G4IonTable::Contains(const G4ParticleDefinition* particle) const
179     // Get PDG code for Hyper-Nucleus Ions.    << 181 {
180     // Nuclear codes are given as 10-digit num << 182   G4IonList::iterator i;
181     // For a nucleus consisting of np protons  << 183   for (i = fIonList->begin(); i!= fIonList->end(); ++i) {
182     // A = np + nn +nlambda and Z = np.        << 184     if (**i==*particle) return true;
183     // nL = nlambda                            << 185   }
184     // I gives the isomer level, with I = 0 co << 186   return false;
185     // to the ground state and I >0 to excitat << 187 }
186     static G4int GetNucleusEncoding(G4int Z, G << 188 
187                                                << 189 inline G4int G4IonTable::Entries() const
188     static G4bool GetNucleusByEncoding(G4int e << 190 {
189     static G4bool GetNucleusByEncoding(G4int e << 191   return fIonList->size();
190                                        G4int&  << 192 }
191     // Energy will not be given even for excit << 193 
192                                                << 194 inline G4ParticleDefinition*  G4IonTable::GetParticle(G4int index) const
193     // These methods returns Nucleus (i.e. ful << 195 {
194     //  Z is Atomic Number (number of protons) << 196   if ( (index >=0 ) && (index < Entries()) ){
195     //  A is Atomic Number (number of nucleons << 197     return (*fIonList)[index];
196     //  nL is number of lambda (A= nn + np + n << 198   } else {
197     //  lvl is isomer level                    << 199     return 0; 
198     G4double GetIonMass(G4int Z, G4int A, G4in << 200   } 
199     G4double GetNucleusMass(G4int Z, G4int A,  << 201 }
200     G4double GetIsomerMass(G4int Z, G4int A, G << 202 
201                                                << 
202     // Returns a life time of an ion. -1 for s << 
203     // that is not listed in G4NuclideTable    << 
204     G4double GetLifeTime(const G4ParticleDefin << 
205     G4double GetLifeTime(G4int Z, G4int A, G4d << 
206                          G4Ions::G4FloatLevelB << 
207     G4double GetLifeTime(G4int Z, G4int A, G4d << 
208                                                << 
209     G4ParticleDefinition* GetMuonicAtom(G4Ions << 
210     G4ParticleDefinition* GetMuonicAtom(G4int  << 
211                                                << 
212     // Return number of ions in the table      << 
213     G4int Entries() const;                     << 
214                                                << 
215     // Return the pointer of index-th ion in t << 
216     G4ParticleDefinition* GetParticle(G4int in << 
217                                                << 
218     // Return 'true' if the ion exists         << 
219     G4bool Contains(const G4ParticleDefinition << 
220                                                << 
221     // Insert/Remove an ion in the table       << 
222     void Insert(const G4ParticleDefinition* pa << 
223     void Remove(const G4ParticleDefinition* pa << 
224                                                << 
225     // Erase all contents in the list (not del << 
226     void clear();                              << 
227                                                << 
228     // Return number of ions in the table      << 
229     G4int size() const;                        << 
230                                                << 
231     // Dump information of particles specified << 
232     void DumpTable(const G4String& particle_na << 
233                                                << 
234   public:                                      << 
235     // Needed for MT                           << 
236     void InitializeLightIons();                << 
237                                                << 
238     // It is very important for multithreaded  << 
239     // the particle table pointer and the ion  << 
240     // to let each worker thread hold its own  << 
241     // and the ion list. This implementation i << 
242     // table thread private. The two shadow po << 
243     // thread to copy the content from the mas << 
244     static G4ThreadLocal G4IonList* fIonList;  << 
245     static G4ThreadLocal std::vector<G4VIsotop << 
246     static G4IonList* fIonListShadow;          << 
247     static std::vector<G4VIsotopeTable*>* fIso << 
248                                                << 
249     enum                                       << 
250     {                                          << 
251       numberOfElements = 118                   << 
252     };                                         << 
253     static const G4String elementName[numberOf << 
254                                                   203 
255 #ifdef G4MULTITHREADED                         << 
256     static G4Mutex ionTableMutex;              << 
257 #endif                                            204 #endif
258                                                   205 
259   protected:                                   << 
260     G4ParticleDefinition* FindIonInMaster(G4in << 
261     G4ParticleDefinition* FindIonInMaster(G4in << 
262     G4ParticleDefinition* FindIonInMaster(G4in << 
263                                           G4Io << 
264     G4ParticleDefinition* FindIonInMaster(G4in << 
265                                           G4Io << 
266                                                << 
267     G4ParticleDefinition* CreateIon(G4int Z, G << 
268     G4ParticleDefinition* CreateIon(G4int Z, G << 
269                                     G4Ions::G4 << 
270     G4ParticleDefinition* CreateIon(G4int Z, G << 
271     G4ParticleDefinition* CreateIon(G4int Z, G << 
272                                                << 
273     void InsertWorker(const G4ParticleDefiniti << 
274                                                << 
275     // Create Ion                              << 
276                                                << 
277     G4IsotopeProperty* FindIsotope(G4int Z, G4 << 
278                                    G4Ions::G4F << 
279     G4IsotopeProperty* FindIsotope(G4int Z, G4 << 
280     // Ask properties of isotopes              << 
281                                                << 
282     G4ParticleDefinition* GetLightIon(G4int Z, << 
283     G4ParticleDefinition* GetLightAntiIon(G4in << 
284                                                << 
285     // Return true if the particle is pre-defi << 
286     G4bool IsLightIon(const G4ParticleDefiniti << 
287     G4bool IsLightAntiIon(const G4ParticleDefi << 
288                                                << 
289     // Add process manager to ions with name o << 
290     void AddProcessManager(G4ParticleDefinitio << 
291                                                   206 
292     // Get Verbose Level defined in G4Particle << 
293     G4int GetVerboseLevel() const;             << 
294                                                   207 
295   private:                                     << 
296     G4NuclideTable* pNuclideTable = nullptr;   << 
297                                                   208 
298     // Isomer table and flag of creation       << 
299     G4bool isIsomerCreated = false;            << 
300 };                                             << 
301                                                   209 
302 // ------------------------                    << 
303 // Inline methods                              << 
304 // ------------------------                    << 
305                                                   210 
306 inline G4int G4IonTable::GetNumberOfElements() << 
307 {                                              << 
308   return numberOfElements;                     << 
309 }                                              << 
310                                                   211 
311 #endif                                         << 212 
                                                   >> 213 
                                                   >> 214 
312                                                   215