Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/particles/management/src/G4ParticleTable.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.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/src/G4ParticleTable.cc (Version 11.3.0) and /particles/management/src/G4ParticleTable.cc (Version 10.0.p4)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 // G4ParticleTable class implementation        << 
 27 //                                                 26 //
 28 // Authors: G.Cosmo, 2 December 1995 - Design, <<  27 // $Id: G4ParticleTable.cc 79155 2014-02-19 15:27:31Z gcosmo $
 29 //          H.Kurashige, 27 June 1996 - First  <<  28 //
                                                   >>  29 // class G4ParticleTable
                                                   >>  30 //
                                                   >>  31 // Implementation
                                                   >>  32 //
 30 // History:                                        33 // History:
 31 // - 14 Nov 1997, H.Kurashige - Added messenge <<  34 //      modified                                Apr., 97 H.Kurashige
 32 // - 24 Sep 1998, H.Kurashige - Added dictiona <<  35 //      added fParticleMessenger             14 Nov., 97 H.Kurashige
 33 // - 28 Oct 1999, H.Kurashige - Migration to S <<  36 //      added GetParticle()                  13 Dec., 97 H.Kurashige
 34 // - 15 Sep 2017, K.L.Genser - Added support f <<  37 //      added IonTable and ShortLivedTable   27 June, 98 H.Kurashige 
 35 // ------------------------------------------- <<  38 //      modified FindIon                     02 Aug., 98 H.Kurashige
                                                   >>  39 //      added dictionary for encoding    24 Sep., 98 H.Kurashige
                                                   >>  40 //      fixed bugs in destruction of IonTable 08 Nov.,98 H.Kurashige
                                                   >>  41 //      commented out G4cout/G4cout in the constructor 10 Nov.,98 H.Kurashige
                                                   >>  42 //         --------------------------------
                                                   >>  43 //      modified destructor for STL interface 18 May 1999
                                                   >>  44 //      fixed  some improper codings     08 Apr., 99 H.Kurashige
                                                   >>  45 //      modified FindIon/GetIon methods  17 AUg., 99 H.Kurashige
                                                   >>  46 //      implement new version for using STL map instaed of 
                                                   >>  47 //      RW PtrHashedDictionary           28 Oct., 99  H.Kurashige
                                                   >>  48 //      remove G4ShortLivedTable         25 July, 13 H.Kurashige
                                                   >>  49 // 
 36                                                    50 
                                                   >>  51 #include "globals.hh"
                                                   >>  52 #include "G4ios.hh"
 37 #include "G4ParticleTable.hh"                      53 #include "G4ParticleTable.hh"
 38                                                <<  54 #include "G4UImessenger.hh"
 39 #include "G4IonTable.hh"                       << 
 40 #include "G4ParticleMessenger.hh"                  55 #include "G4ParticleMessenger.hh"
                                                   >>  56 #include "G4IonTable.hh"
 41 #include "G4StateManager.hh"                       57 #include "G4StateManager.hh"
 42 #include "G4UImessenger.hh"                    << 
 43 #include "G4ios.hh"                            << 
 44 #include "globals.hh"                          << 
 45                                                    58 
 46 // These fields should be thread local or thre     59 // These fields should be thread local or thread private. For a singleton
 47 // class, we can change any member field as st     60 // class, we can change any member field as static without any problem
 48 // because there is only one instance. Then we <<  61 // because there is only one instance. Then we are allowed to add 
 49 // "G4ThreadLocal"                             <<  62 // "G4ThreadLocal".
                                                   >>  63 //
                                                   >>  64 G4ThreadLocal G4ParticleMessenger* G4ParticleTable::fParticleMessenger = 0;
                                                   >>  65 G4ThreadLocal G4ParticleTable::G4PTblDictionary*  G4ParticleTable::fDictionary = 0;
                                                   >>  66 G4ThreadLocal G4ParticleTable::G4PTblDicIterator* G4ParticleTable::fIterator = 0;
                                                   >>  67 G4ThreadLocal G4ParticleTable::G4PTblEncodingDictionary* G4ParticleTable::fEncodingDictionary = 0;
                                                   >>  68 
                                                   >>  69 // This field should be thread private. However, we have to keep one copy
                                                   >>  70 // of the ion table pointer. So we change all important fields of G4IonTable
                                                   >>  71 // to the thread local variable.
 50 //                                                 72 //
 51 G4ThreadLocal G4ParticleTable::G4PTblDictionar <<  73 G4IonTable*            G4ParticleTable::fIonTable = 0;
 52 G4ThreadLocal G4ParticleTable::G4PTblDicIterat <<  74 
 53 G4ThreadLocal G4ParticleTable::G4PTblEncodingD << 
 54   nullptr;                                     << 
 55                                                    75 
 56 // These shadow pointers are used by each work     76 // These shadow pointers are used by each worker thread to copy the content
 57 // from the master thread                      <<  77 // from the master thread. 
 58 //                                                 78 //
 59 G4ParticleTable::G4PTblDictionary* G4ParticleT <<  79 G4ParticleMessenger* G4ParticleTable::fParticleMessengerShadow = 0;
 60 G4ParticleTable::G4PTblDicIterator* G4Particle <<  80 G4ParticleTable::G4PTblDictionary*  G4ParticleTable::fDictionaryShadow = 0;
 61 G4ParticleTable::G4PTblEncodingDictionary* G4P <<  81 G4ParticleTable::G4PTblDicIterator* G4ParticleTable::fIteratorShadow = 0;
                                                   >>  82 G4ParticleTable::G4PTblEncodingDictionary* G4ParticleTable::fEncodingDictionaryShadow = 0;
 62                                                    83 
 63 // Static class variable: pointer to single in <<  84 // Static class variable: ptr to single instance of class
 64 //                                             <<  85 G4ParticleTable* G4ParticleTable::fgParticleTable =0;
 65 G4ParticleTable* G4ParticleTable::fgParticleTa << 
 66                                                    86 
 67 #ifdef G4MULTITHREADED                             87 #ifdef G4MULTITHREADED
 68 // Lock for particle table accesses.               88 // Lock for particle table accesses.
 69 //                                                 89 //
 70 G4Mutex& G4ParticleTable::particleTableMutex() <<  90 G4Mutex G4ParticleTable::particleTableMutex = G4MUTEX_INITIALIZER;
 71 {                                              <<  91 G4int G4ParticleTable::lockCount = 0;
 72   static G4Mutex _instance = G4MUTEX_INITIALIZ <<  92 #endif 
 73   return _instance;                            << 
 74 }                                              << 
 75 G4int& G4ParticleTable::lockCount()            << 
 76 {                                              << 
 77   static G4int _instance = 0;                  << 
 78   return _instance;                            << 
 79 }                                              << 
 80 #endif                                         << 
 81                                                    93 
                                                   >>  94 ////////////////////
 82 G4ParticleTable* G4ParticleTable::GetParticleT     95 G4ParticleTable* G4ParticleTable::GetParticleTable()
 83 {                                                  96 {
 84   if (fgParticleTable == nullptr) {            << 
 85     static G4ParticleTable theParticleTable;       97     static G4ParticleTable theParticleTable;
 86     fgParticleTable = &theParticleTable;       <<  98     if (!fgParticleTable){
 87   }                                            <<  99       fgParticleTable =  &theParticleTable;
                                                   >> 100     }
 88                                                   101 
 89   // Here we initialize all thread private dat << 102     // Here we initialize all thread private data members.
 90   //                                           << 103     //
 91   if (fDictionary == nullptr) fgParticleTable- << 104     if (fDictionary == 0) fgParticleTable->WorkerG4ParticleTable();
 92                                                   105 
 93   return fgParticleTable;                      << 106     return fgParticleTable;
 94 }                                                 107 }
 95                                                   108 
                                                   >> 109 ////////////////////
 96 G4ParticleTable::G4ParticleTable()                110 G4ParticleTable::G4ParticleTable()
                                                   >> 111      :verboseLevel(1),
                                                   >> 112       noName(" "),
                                                   >> 113       readyToUse(false),
                                                   >> 114       genericIon(NULL)
 97 {                                                 115 {
 98   fDictionary = new G4PTblDictionary();           116   fDictionary = new G4PTblDictionary();
 99                                                   117 
100   // Set up the shadow pointer used by worker  << 118   // Set up the shadow pointer used by worker threads.
101   //                                              119   //
102   if (fDictionaryShadow == nullptr) {          << 120   if (fDictionaryShadow == 0)
                                                   >> 121   {
103     fDictionaryShadow = fDictionary;              122     fDictionaryShadow = fDictionary;
104   }                                               123   }
105                                                   124 
106   fIterator = new G4PTblDicIterator(*fDictiona << 125   fIterator   = new G4PTblDicIterator( *fDictionary );
107                                                   126 
108   // Set up the shadow pointer used by worker  << 127   // Set up the shadow pointer used by worker threads.
109   //                                              128   //
110   if (fIteratorShadow == nullptr) {            << 129   if (fIteratorShadow == 0)
                                                   >> 130   {
111     fIteratorShadow = fIterator;                  131     fIteratorShadow = fIterator;
112   }                                               132   }
113                                                << 133  
114   fEncodingDictionary = new G4PTblEncodingDict    134   fEncodingDictionary = new G4PTblEncodingDictionary();
115   // Set up the shadow pointer used by worker  << 135   // Set up the shadow pointer used by worker threads.
116   //                                              136   //
117   if (fEncodingDictionaryShadow == nullptr) {  << 137   if (fEncodingDictionaryShadow == 0)
                                                   >> 138   {
118     fEncodingDictionaryShadow = fEncodingDicti    139     fEncodingDictionaryShadow = fEncodingDictionary;
119   }                                               140   }
120                                                   141 
121   // Ion Table                                 << 142 
122   //                                           << 143    // Ion Table
123   fIonTable = new G4IonTable();                   144   fIonTable = new G4IonTable();
124   fParticleMessenger = nullptr;                << 145 
125 }                                                 146 }
126                                                   147 
127 // This method is similar to the constructor.     148 // This method is similar to the constructor. It is used by each worker
128 // thread to achieve the partial effect as tha    149 // thread to achieve the partial effect as that of the master thread.
129 // Here we initialize all thread private data  << 150 // Here we initialize all thread private data members.
                                                   >> 151 //
                                                   >> 152 void G4ParticleTable::SlaveG4ParticleTable()
                                                   >> 153 {
                                                   >> 154   G4Exception("G4ParticleTable::SlaveG4ParticleTable()","G4MT0000",FatalException,"Obsolete");
                                                   >> 155 }
                                                   >> 156 
130 void G4ParticleTable::WorkerG4ParticleTable()     157 void G4ParticleTable::WorkerG4ParticleTable()
131 {                                                 158 {
132   // The iterator for the shadow particle tabl    159   // The iterator for the shadow particle table is not sharable.
133   //                                              160   //
134 #ifdef G4MULTITHREADED                            161 #ifdef G4MULTITHREADED
135   G4MUTEXLOCK(&G4ParticleTable::particleTableM << 162   G4MUTEXLOCK(&G4ParticleTable::particleTableMutex);
136   G4ParticleTable::lockCount()++;              << 163   G4ParticleTable::lockCount++;
137 #endif                                            164 #endif
138   if (fDictionary == nullptr) {                << 165   if(fDictionary == 0) { 
139     fDictionary = new G4PTblDictionary();      << 166     fDictionary = new G4PTblDictionary();   
140   }                                            << 167   } else { 
141   else {                                       << 168     fDictionary->clear(); 
142     fDictionary->clear();                      << 
143   }                                               169   }
144                                                   170 
145   if (fEncodingDictionary == nullptr) {        << 171   if(fEncodingDictionary == 0){
146     fEncodingDictionary = new G4PTblEncodingDi << 172     fEncodingDictionary = new G4PTblEncodingDictionary(); 
147   }                                            << 173   } else { 
148   else {                                       << 174     fEncodingDictionary->clear(); 
149     fEncodingDictionary->clear();              << 
150   }                                               175   }
151                                                   176 
152   fIteratorShadow->reset(false);                  177   fIteratorShadow->reset(false);
153   while ((*fIteratorShadow)())  // Loop checki << 178   while( (*fIteratorShadow)() )
154   {                                               179   {
155     G4ParticleDefinition* particle = fIterator    180     G4ParticleDefinition* particle = fIteratorShadow->value();
156     fDictionary->insert(std::pair<G4String, G4 << 181     fDictionary->insert( std::pair<G4String, G4ParticleDefinition*>(GetKey(particle), particle) );
157     G4int code = particle->GetPDGEncoding();      182     G4int code = particle->GetPDGEncoding();
158     if (code != 0) {                           << 183     if (code !=0 ) {
159       fEncodingDictionary->insert(std::pair<G4 << 184       fEncodingDictionary->insert( std::pair<G4int, G4ParticleDefinition*>(code ,particle) );
160     }                                             185     }
161   }                                            << 186   }       
162   fIterator = new G4PTblDicIterator(*fDictiona << 187   fIterator =  new G4PTblDicIterator( *fDictionary);
163                                                   188 
164 #ifdef G4MULTITHREADED                            189 #ifdef G4MULTITHREADED
165   G4MUTEXUNLOCK(&G4ParticleTable::particleTabl << 190   G4MUTEXUNLOCK(&G4ParticleTable::particleTableMutex);
166 #endif                                            191 #endif
167                                                   192 
168   fIonTable->WorkerG4IonTable();                  193   fIonTable->WorkerG4IonTable();
                                                   >> 194 
169 }                                                 195 }
170                                                   196 
                                                   >> 197 // Do we need DestroySlaveG4ParticleTable()? 
                                                   >> 198 //
                                                   >> 199 ////////////////////
171 G4ParticleTable::~G4ParticleTable()               200 G4ParticleTable::~G4ParticleTable()
172 {                                                 201 {
173   readyToUse = false;                          << 202    readyToUse = false;
174                                                << 203    
175   // remove all items from G4ParticleTable     << 204    // remove all items from G4ParticleTable
176   RemoveAllParticles();                        << 205    RemoveAllParticles();
177                                                << 206 
178   // delete Ion Table                          << 207   //delete Ion Table 
179   delete fIonTable;                            << 208   if (fIonTable!=0) delete fIonTable;
180   fIonTable = nullptr;                         << 209   fIonTable =0;
181                                                   210 
182   // delete dictionary for encoding               211   // delete dictionary for encoding
183   if (fEncodingDictionary != nullptr) {        << 212   if (fEncodingDictionary!=0){
184     fEncodingDictionary->clear();              << 213     fEncodingDictionary -> clear();
185     delete fEncodingDictionary;                   214     delete fEncodingDictionary;
186     fEncodingDictionary = nullptr;             << 215     fEncodingDictionary =0;
187   }                                               216   }
188                                                   217 
189   if (fDictionary != nullptr) {                << 218 
190     delete fIterator;                          << 219   if(fDictionary){
191     fIterator = nullptr;                       << 220     if (fIterator!=0 )delete fIterator;
                                                   >> 221     fIterator =0;
192                                                   222 
193     fDictionary->clear();                         223     fDictionary->clear();
194     delete fDictionary;                           224     delete fDictionary;
195     fDictionary = nullptr;                     << 225     fDictionary =0;
196   }                                               226   }
197                                                   227 
198   delete fParticleMessenger;                   << 228   if (fParticleMessenger!=0) delete fParticleMessenger;  
199   fParticleMessenger = nullptr;                << 229   fParticleMessenger =0;
200                                                   230 
201   fgParticleTable = nullptr;                   << 231   fgParticleTable =0;
202                                                   232 
203   G4ParticleDefinition::Clean();  // Delete su << 
204 }                                                 233 }
205                                                   234 
206 void G4ParticleTable::DestroyWorkerG4ParticleT << 235 ////////////////////
                                                   >> 236 G4ParticleTable::G4ParticleTable(const G4ParticleTable &right)
                                                   >> 237   :verboseLevel(1),
                                                   >> 238    noName(" "),
                                                   >> 239    readyToUse(false)
207 {                                                 240 {
208   // delete Ion Table in worker thread         << 241   fParticleMessenger = 0 ;
209   if (fIonTable != nullptr) fIonTable->Destroy << 
210                                                << 
211   // delete dictionary for encoding            << 
212   if (fEncodingDictionary != nullptr) {        << 
213     fEncodingDictionary->clear();              << 
214     delete fEncodingDictionary;                << 
215     fEncodingDictionary = nullptr;             << 
216   }                                            << 
217                                                   242 
218   if (fDictionary != nullptr) {                << 243   G4Exception("G4ParticleTable::G4ParticleTable()",
219     delete fIterator;                          << 244         "PART001", FatalException,
220     fIterator = nullptr;                       << 245         "Illegal call of copy constructor for G4ParticleTable");    
                                                   >> 246   fDictionary = new G4PTblDictionary(*(right.fDictionary));
                                                   >> 247   fIterator   = new G4PTblDicIterator(*fDictionary);
                                                   >> 248 }
221                                                   249 
222     fDictionary->clear();                      << 250 ////////////////////
223     delete fDictionary;                        << 251 G4ParticleTable & G4ParticleTable::operator=(const G4ParticleTable & right)
224     fDictionary = nullptr;                     << 252 {
                                                   >> 253   if (this != &right) {
                                                   >> 254     G4Exception("G4ParticleTable::G4ParticleTable()",
                                                   >> 255     "PART001", FatalException,
                                                   >> 256     "Illegal call of assignment operator for G4ParticleTable");    
                                                   >> 257     fDictionary = new G4PTblDictionary(*(right.fDictionary));
                                                   >> 258     fIterator   = new G4PTblDicIterator(*fDictionary);
225   }                                               259   }
                                                   >> 260   return *this;
226 }                                                 261 }
227                                                   262 
                                                   >> 263 ////////////////////
228 G4UImessenger* G4ParticleTable::CreateMessenge    264 G4UImessenger* G4ParticleTable::CreateMessenger()
229 {                                                 265 {
230   if (fParticleMessenger == nullptr) {         << 266   if (fParticleMessenger== 0) {
231     // UI messenger                            << 267     //UI messenger
232     fParticleMessenger = new G4ParticleMesseng    268     fParticleMessenger = new G4ParticleMessenger(this);
233   }                                               269   }
234   return fParticleMessenger;                      270   return fParticleMessenger;
235 }                                                 271 }
236                                                   272 
                                                   >> 273 ////////////////////
                                                   >> 274 void G4ParticleTable::DeleteMessenger()
                                                   >> 275 {
                                                   >> 276   if (fParticleMessenger!= 0) {
                                                   >> 277     //UI messenger
                                                   >> 278     delete fParticleMessenger;
                                                   >> 279     fParticleMessenger= 0;
                                                   >> 280   }
                                                   >> 281 
                                                   >> 282 }
                                                   >> 283 
                                                   >> 284 ////////////////////
237 void G4ParticleTable::DeleteAllParticles()        285 void G4ParticleTable::DeleteAllParticles()
238 {                                                 286 {
239   // set readyToUse false                      << 287   //set readyToUse false  
240   readyToUse = false;                             288   readyToUse = false;
241                                                   289 
242 #ifdef G4VERBOSE                                  290 #ifdef G4VERBOSE
243   if (verboseLevel > 1) {                      << 291   if (verboseLevel>1){
244     G4cout << "G4ParticleTable::DeleteAllParti    292     G4cout << "G4ParticleTable::DeleteAllParticles() " << G4endl;
245   }                                               293   }
246 #endif                                            294 #endif
247                                                   295 
248   // delete all particles                      << 296   // delete all particles 
249   G4PTblDicIterator* piter = fIterator;        << 297   G4PTblDicIterator *piter = fIterator; 
250   piter->reset(false);                         << 298   piter -> reset();
251   while ((*piter)())  // Loop checking, 09.08. << 299   while( (*piter)() ){
252   {                                            << 300 #ifdef G4VERBOSE
253 #ifdef G4VERBOSE                               << 301     if (verboseLevel>2){
254     if (verboseLevel > 2) {                    << 302       G4cout << "Delete " << (piter->value())->GetParticleName() 
255       G4cout << "Delete " << (piter->value())- << 303        << " " << (piter->value()) << G4endl;
256              << G4endl;                        << 
257     }                                             304     }
258 #endif                                            305 #endif
259     delete (piter->value());                      306     delete (piter->value());
260   }                                               307   }
261   RemoveAllParticles();                           308   RemoveAllParticles();
262 }                                                 309 }
263                                                   310 
                                                   >> 311 ////////////////////
264 void G4ParticleTable::RemoveAllParticles()        312 void G4ParticleTable::RemoveAllParticles()
265 {                                                 313 {
266   if (readyToUse) {                               314   if (readyToUse) {
267     G4Exception("G4ParticleTable::RemoveAllPar << 315     G4Exception("G4ParticleTable::RemoveAllParticle()",
268                 "No effects because readyToUse << 316     "PART115", JustWarning,
                                                   >> 317     "No effects because readyToUse is true.");    
269     return;                                       318     return;
270   }                                               319   }
271                                                << 320   
272 #ifdef G4VERBOSE                                  321 #ifdef G4VERBOSE
273   if (verboseLevel > 1) {                      << 322   if (verboseLevel>1){
274     G4cout << "G4ParticleTable::RemoveAllParti    323     G4cout << "G4ParticleTable::RemoveAllParticles() " << G4endl;
275   }                                               324   }
276 #endif                                            325 #endif
277                                                   326 
278   // remove all contents in Ion Table          << 327   //remove all contnts in Ion Table
279   if (fIonTable != nullptr) {                  << 328   if (fIonTable!=0) {
280     fIonTable->clear();                           329     fIonTable->clear();
281   }                                               330   }
282                                                   331 
283   // clear dictionary                             332   // clear dictionary
284   if (fDictionary != nullptr) {                << 333   if (fDictionary) {
285     fDictionary->clear();                         334     fDictionary->clear();
286   }                                               335   }
287 }                                                 336 }
288                                                   337 
289 G4ParticleDefinition* G4ParticleTable::Insert( << 338 ////////////////////
                                                   >> 339 G4ParticleDefinition* G4ParticleTable::Insert(G4ParticleDefinition *particle)
290 {                                                 340 {
                                                   >> 341 
291   // check particle name                          342   // check particle name
292   if ((particle == nullptr) || (GetKey(particl << 343   if ((particle == 0) || (GetKey(particle).isNull())) {
293     G4Exception("G4ParticleTable::Insert()", " << 344     G4Exception("G4ParticleTable::Insert()",
294                 "Particle witnout name can not << 345     "PART121", FatalException,
                                                   >> 346     "Particle witnout name can not be registered.");    
295 #ifdef G4VERBOSE                                  347 #ifdef G4VERBOSE
296     if (verboseLevel > 1) {                    << 348     if (verboseLevel>1){
297       G4cout << "The particle[Addr:" << partic << 349       G4cout << "The particle[Addr:" << particle << "] has no name "<< G4endl;
298     }                                             350     }
299 #endif                                            351 #endif
300     return nullptr;                            << 352     return 0;
301   }                                            << 
302                                                   353 
303   if (contains(particle)) {                    << 354   }else {  
                                                   >> 355 
                                                   >> 356     if (contains(particle)) {  
304 #ifdef G4VERBOSE                                  357 #ifdef G4VERBOSE
305     if (verboseLevel > 2) {                    << 358       if (verboseLevel>2){
306       FindParticle(particle)->DumpTable();     << 359         FindParticle(particle) -> DumpTable();
307     }                                          << 360       }
308 #endif                                            361 #endif
309     G4String msg = "The particle ";            << 362       G4String msg = "The particle ";
310     msg += particle->GetParticleName();        << 363       msg += particle->GetParticleName();
311     msg += "  has already been registered in t << 364       msg += "  has already been registered in the Particle Table ";
312     G4Exception("G4ParticleTable::Insert()", " << 365       G4Exception("G4ParticleTable::Insert()",
313                                                << 366       "PART122", FatalException,msg); 
314     return particle;                           << 367 ////////////////////      return  FindParticle(particle);
315   }                                            << 368       return particle;
316                                                   369 
317   G4PTblDictionary* pdic = fDictionaryShadow;  << 370     } else {
                                                   >> 371       G4PTblDictionary *pdic =  fDictionaryShadow;
318                                                   372 
319   // insert into Dictionary                    << 373       // insert into Dictionary
320   pdic->insert(std::pair<G4String, G4ParticleD << 374       pdic->insert( std::pair<G4String, G4ParticleDefinition*>(GetKey(particle), particle) );
321 #ifdef G4MULTITHREADED                            375 #ifdef G4MULTITHREADED
322   if (G4Threading::IsWorkerThread()) {         << 376       if(G4Threading::IsWorkerThread())
323     fDictionary->insert(std::pair<G4String, G4 << 377       { fDictionary->insert( std::pair<G4String, G4ParticleDefinition*>(GetKey(particle), particle) ); }
324   }                                            << 
325 #endif                                            378 #endif
326                                                   379 
327   G4PTblEncodingDictionary* pedic = fEncodingD << 380       G4PTblEncodingDictionary *pedic =  fEncodingDictionaryShadow;  
328                                                << 381       // insert into EncodingDictionary
329   // insert into EncodingDictionary            << 382       G4int code = particle->GetPDGEncoding();
330   G4int code = particle->GetPDGEncoding();     << 383       if (code !=0 ) {
331   if (code != 0) {                             << 384         pedic->insert( std::pair<G4int, G4ParticleDefinition*>(code ,particle) );
332     pedic->insert(std::pair<G4int, G4ParticleD << 
333 #ifdef G4MULTITHREADED                            385 #ifdef G4MULTITHREADED
334     if (G4Threading::IsWorkerThread()) {       << 386         if(G4Threading::IsWorkerThread())
335       fEncodingDictionary->insert(std::pair<G4 << 387         { fEncodingDictionary->insert( std::pair<G4int, G4ParticleDefinition*>(code ,particle) ); }
336     }                                          << 
337 #endif                                            388 #endif
338   }                                            << 389       }       
339                                                   390 
340   // insert it in IonTable if "nucleus"        << 391       // insert it in IonTable if "nucleus"
341   if (fIonTable->IsIon(particle)) {            << 392       if (fIonTable->IsIon(particle) ){
342     fIonTable->Insert(particle);               << 393         fIonTable->Insert(particle);
343   }                                            << 394       }
344                                                   395 
345   // set Verbose Level same as ParticleTable   << 396       // set Verbose Level same as ParticleTable
346   particle->SetVerboseLevel(verboseLevel);     << 397       particle->SetVerboseLevel(verboseLevel);
347                                                   398 
348 #ifdef G4VERBOSE                                  399 #ifdef G4VERBOSE
349   if (verboseLevel > 3) {                      << 400       if (verboseLevel>3){
350     G4cout << "The particle " << particle->Get << 401         G4cout << "The particle "<< particle->GetParticleName() 
351            << G4endl;                          << 402          << " is inserted in the ParticleTable " << G4endl;
352   }                                            << 403       }
353 #endif                                            404 #endif
354   return particle;                             << 405 
                                                   >> 406       return particle;
                                                   >> 407     }
                                                   >> 408   }
355 }                                                 409 }
356                                                   410 
                                                   >> 411 ////////////////////
357 G4ParticleDefinition* G4ParticleTable::Remove(    412 G4ParticleDefinition* G4ParticleTable::Remove(G4ParticleDefinition* particle)
358 {                                                 413 {
359   if (particle == nullptr) return nullptr;     << 414   if(!particle) return 0;
360 #ifdef G4MULTITHREADED                            415 #ifdef G4MULTITHREADED
361   if (G4Threading::IsWorkerThread()) {         << 416   if(G4Threading::IsWorkerThread()) {
362     G4ExceptionDescription ed;                    417     G4ExceptionDescription ed;
363     ed << "Request of removing " << particle->    418     ed << "Request of removing " << particle->GetParticleName()
364        << " is ignored as it is invoked from a    419        << " is ignored as it is invoked from a worker thread.";
365     G4Exception("G4ParticleTable::Remove()", " << 420     G4Exception("G4ParticleTable::Remove()","PART10117",JustWarning,ed);
366     return nullptr;                            << 421     return 0;
367   }                                               422   }
368 #endif                                            423 #endif
369   if (readyToUse) {                               424   if (readyToUse) {
370     G4StateManager* pStateManager = G4StateMan    425     G4StateManager* pStateManager = G4StateManager::GetStateManager();
371     G4ApplicationState currentState = pStateMa    426     G4ApplicationState currentState = pStateManager->GetCurrentState();
372     if (currentState != G4State_PreInit) {        427     if (currentState != G4State_PreInit) {
373       G4String msg = "Request of removing ";      428       G4String msg = "Request of removing ";
374       msg += particle->GetParticleName();      << 429       msg += particle->GetParticleName();  
375       msg += " has No effects other than Pre_I    430       msg += " has No effects other than Pre_Init";
376       G4Exception("G4ParticleTable::Remove()", << 431       G4Exception("G4ParticleTable::Remove()",
377       return nullptr;                          << 432     "PART117", JustWarning, msg);
378     }                                          << 433       return 0;
379                                                << 434     } else {
380 #ifdef G4VERBOSE                               << 435 #ifdef G4VERBOSE
381     if (verboseLevel > 0) {                    << 436       if (verboseLevel>0){
382       G4cout << particle->GetParticleName() << << 437   G4cout << particle->GetParticleName()
383     }                                          << 438          << " will be removed from the ParticleTable " << G4endl;
                                                   >> 439       }
384 #endif                                            440 #endif
                                                   >> 441     }
385   }                                               442   }
386                                                << 443   
387   auto it = fDictionaryShadow->find(GetKey(par << 444   G4PTblDictionary::iterator it =  fDictionaryShadow->find(GetKey(particle));
388   if (it != fDictionaryShadow->end()) {           445   if (it != fDictionaryShadow->end()) {
389     fDictionaryShadow->erase(it);                 446     fDictionaryShadow->erase(it);
390     // remove from EncodingDictionary             447     // remove from EncodingDictionary
391     G4int code = particle->GetPDGEncoding();      448     G4int code = particle->GetPDGEncoding();
392     if (code != 0) {                           << 449     if (code !=0 ) {
393       fEncodingDictionaryShadow->erase(fEncodi << 450       fEncodingDictionaryShadow->erase(fEncodingDictionaryShadow->find(code)); 
394     }                                             451     }
395   }                                            << 452   } else {
396   else {                                       << 453     return 0;
397     return nullptr;                            << 
398   }                                               454   }
399                                                   455 
400   // remove it from IonTable if "nucleus"         456   // remove it from IonTable if "nucleus"
401   if (fIonTable->IsIon(particle)) {            << 457   if (fIonTable->IsIon(particle) ){
402     fIonTable->Remove(particle);                  458     fIonTable->Remove(particle);
403   }                                               459   }
404                                                << 460   
405 #ifdef G4VERBOSE                                  461 #ifdef G4VERBOSE
406   if (verboseLevel > 3) {                      << 462   if (verboseLevel>3){
407     G4cout << "The particle " << particle->Get << 463     G4cout << "The particle "<< particle->GetParticleName()
408            << " is removed from the ParticleTa    464            << " is removed from the ParticleTable " << G4endl;
409   }                                               465   }
410 #endif                                            466 #endif
411                                                   467 
412   return particle;                                468   return particle;
413 }                                                 469 }
414                                                   470 
                                                   >> 471 ///////////////////////////////////////////////////////////////////////
                                                   >> 472 // NOTE ::
                                                   >> 473 //  Following FindIon/GetIon methods will be removed in future relases
                                                   >> 474 //  Use  FindIon/GetIon methods of G4IonTable instead
                                                   >> 475 //
                                                   >> 476 ////////////////////
                                                   >> 477 G4ParticleDefinition* G4ParticleTable::FindIon(G4int Z, G4int A, G4int , G4int )
                                                   >> 478 {
                                                   >> 479    G4Exception("G4ParticleTable::FindIon()","PART11117",JustWarning,
                                                   >> 480    "This method is obsolete and will be dropped from v10.0. Use G4IonTable::FindIon().");
                                                   >> 481    CheckReadiness();
                                                   >> 482    if (Z<=0) return 0;
                                                   >> 483    if (A<Z) return 0;
                                                   >> 484    return fIonTable->GetIon(Z, A);
                                                   >> 485 }
                                                   >> 486 
                                                   >> 487 ////////////////////
                                                   >> 488 G4ParticleDefinition* G4ParticleTable::GetIon(G4int Z, G4int A, G4double E)
                                                   >> 489 {
                                                   >> 490    G4Exception("G4ParticleTable::FindIon()","PART11117",JustWarning,
                                                   >> 491    "This method is obsolete and will be dropped from v10.0. Use G4IonTable::FindIon().");
                                                   >> 492    CheckReadiness();
                                                   >> 493    if (Z<=0) return 0;
                                                   >> 494    if (A<Z) return 0;
                                                   >> 495    if (E<0.) return 0;
                                                   >> 496    return fIonTable->GetIon(Z, A, E);
                                                   >> 497 }
                                                   >> 498 
                                                   >> 499 ////////////////////
                                                   >> 500 G4ParticleDefinition* G4ParticleTable::GetIon(G4int Z, G4int A, G4int L, G4double E)
                                                   >> 501 {
                                                   >> 502    G4Exception("G4ParticleTable::GetIon()","PART11117",JustWarning,
                                                   >> 503    "This method is obsolete and will be dropped from v10.0. Use G4IonTable::FindIon().");
                                                   >> 504    CheckReadiness();
                                                   >> 505    if (Z<=0) return 0;
                                                   >> 506    if (A-L<Z) return 0;
                                                   >> 507    if (L<0) return 0; 
                                                   >> 508    if (E<0.) return 0;
                                                   >> 509    return fIonTable->GetIon(Z, A, L, E);
                                                   >> 510 }
                                                   >> 511 
                                                   >> 512 G4ParticleDefinition* G4ParticleTable::GetIon(G4int Z, G4int A, G4int level)
                                                   >> 513 {
                                                   >> 514    G4Exception("G4ParticleTable::GetIon()","PART11117",JustWarning,
                                                   >> 515    "This method is obsolete and will be dropped from v10.0. Use G4IonTable::FindIon().");
                                                   >> 516    CheckReadiness();
                                                   >> 517    if (Z <= 0) return 0;
                                                   >> 518    if (A < Z) return 0;
                                                   >> 519    if (level < 0) return 0;
                                                   >> 520    return fIonTable->GetIon(Z, A, level);
                                                   >> 521 }
                                                   >> 522 
                                                   >> 523 ////////////////////
                                                   >> 524 G4ParticleDefinition* G4ParticleTable::FindIon(G4int Z, G4int A, G4double E)
                                                   >> 525 {
                                                   >> 526    G4Exception("G4ParticleTable::FindIon()","PART11117",JustWarning,
                                                   >> 527    "This method is obsolete and will be dropped from v10.0. Use G4IonTable::FindIon().");
                                                   >> 528    CheckReadiness();
                                                   >> 529    if (Z<=0) return 0;
                                                   >> 530    if (A<Z) return 0;
                                                   >> 531    if (E<0.) return 0;
                                                   >> 532    return fIonTable->FindIon(Z, A, E);
                                                   >> 533 }
                                                   >> 534 
                                                   >> 535 ////////////////////
                                                   >> 536 G4ParticleDefinition* G4ParticleTable::FindIon(G4int Z, G4int A, G4int L, G4double E)
                                                   >> 537 {
                                                   >> 538    G4Exception("G4ParticleTable::FindIon()","PART11117",JustWarning,
                                                   >> 539    "This method is obsolete and will be dropped from v10.0. Use G4IonTable::FindIon().");
                                                   >> 540    CheckReadiness();
                                                   >> 541    if (Z<=0) return 0;
                                                   >> 542    if (A-L<Z) return 0;
                                                   >> 543    if (L<0) return 0;
                                                   >> 544    if (E<0.) return 0;
                                                   >> 545    return fIonTable->FindIon(Z, A, L, E);
                                                   >> 546 }
                                                   >> 547 /////////////////////////////////////////////////////////////////////
                                                   >> 548 
                                                   >> 549 ////////////////////
415 G4ParticleDefinition* G4ParticleTable::GetPart    550 G4ParticleDefinition* G4ParticleTable::GetParticle(G4int index) const
416 {                                                 551 {
417   CheckReadiness();                            << 552    CheckReadiness();
418   if ((index >= 0) && (index < entries())) {   << 553   if ( (index >=0) && (index < entries()) ) {
419     G4PTblDicIterator* piter = fIterator;      << 554     G4PTblDicIterator *piter = fIterator; 
420     piter->reset(false);                       << 555     piter -> reset(false);
421     G4int counter = 0;                            556     G4int counter = 0;
422     while ((*piter)())  // Loop checking, 09.0 << 557     while( (*piter)() ){
423     {                                          << 558       if ( counter == index ) return piter->value();
424       if (counter == index) return piter->valu << 559       counter++;
425       ++counter;                               << 
426     }                                             560     }
427   }                                            << 561   } 
428 #ifdef G4VERBOSE                                  562 #ifdef G4VERBOSE
429   if (verboseLevel > 1) {                      << 563   if (verboseLevel>1){
430     G4cout << " G4ParticleTable::GetParticle"     564     G4cout << " G4ParticleTable::GetParticle"
431            << " invalid index (=" << index <<     565            << " invalid index (=" << index << ")" << G4endl;
432   }                                               566   }
433 #endif                                            567 #endif
434   return nullptr;                              << 568   return 0;
435 }                                                 569 }
436                                                   570 
                                                   >> 571 ////////////////////
437 const G4String& G4ParticleTable::GetParticleNa    572 const G4String& G4ParticleTable::GetParticleName(G4int index) const
438 {                                                 573 {
439   G4ParticleDefinition* aParticle = GetParticl << 574   G4ParticleDefinition* aParticle =GetParticle(index);
440   if (aParticle != nullptr) {                  << 575   if (aParticle != 0) {
441     return aParticle->GetParticleName();          576     return aParticle->GetParticleName();
                                                   >> 577   } else {
                                                   >> 578     return noName;
442   }                                               579   }
443                                                << 
444   return noName;                               << 
445 }                                                 580 }
446                                                   581 
447 G4ParticleDefinition* G4ParticleTable::FindPar << 582 ////////////////////
                                                   >> 583 G4ParticleDefinition* G4ParticleTable::FindParticle(const G4String &particle_name) 
448 {                                                 584 {
449   auto it = fDictionary->find(particle_name);  << 585   G4PTblDictionary::iterator it =  fDictionary->find(particle_name);
450   if (it != fDictionary->end()) {                 586   if (it != fDictionary->end()) {
451     return (*it).second;                          587     return (*it).second;
452   }                                            << 588   } else {
453                                                << 
454 #ifdef G4MULTITHREADED                            589 #ifdef G4MULTITHREADED
455   G4ParticleDefinition* ptcl = nullptr;        << 590     G4ParticleDefinition* ptcl = 0;
456   if (G4Threading::IsWorkerThread()) {         << 591     if(G4Threading::IsWorkerThread())
457     G4MUTEXLOCK(&G4ParticleTable::particleTabl << 592     {
458     auto its = fDictionaryShadow->find(particl << 593       G4MUTEXLOCK(&G4ParticleTable::particleTableMutex);
459     if (its != fDictionaryShadow->end()) {     << 594       G4PTblDictionary::iterator its = fDictionaryShadow->find(particle_name);
460       fDictionary->insert(*its);               << 595       if(its != fDictionaryShadow->end())
461       ptcl = (*its).second;                    << 596       {
462       G4int code = ptcl->GetPDGEncoding();     << 597         fDictionary->insert(*its);
463       if (code != 0)                           << 598         ptcl = (*its).second;
464         fEncodingDictionary->insert(std::pair< << 599         G4int code = ptcl->GetPDGEncoding();
                                                   >> 600         if(code!=0) fEncodingDictionary->insert(std::pair<G4int, G4ParticleDefinition*>(code,ptcl) );
                                                   >> 601       }
                                                   >> 602       G4MUTEXUNLOCK(&G4ParticleTable::particleTableMutex);
465     }                                             603     }
466     G4MUTEXUNLOCK(&G4ParticleTable::particleTa << 604     return ptcl;
467   }                                            << 
468   return ptcl;                                 << 
469 #else                                             605 #else
470   return nullptr;                              << 606     return 0;
471 #endif                                         << 
472 }                                              << 
473                                                << 
474 void G4ParticleTable::SelectParticle(const G4S << 
475 {                                              << 
476   if (name != selectedName) {                  << 
477     const G4ParticleDefinition* part = FindPar << 
478     if (part != nullptr) {                     << 
479 #ifdef G4MULTITHREADED                         << 
480       G4MUTEXLOCK(&G4ParticleTable::particleTa << 
481 #endif                                            607 #endif
482       selectedParticle = part;                 << 
483       selectedName = name;                     << 
484 #ifdef G4MULTITHREADED                         << 
485       G4MUTEXUNLOCK(&G4ParticleTable::particle << 
486 #endif                                         << 
487     }                                          << 
488   }                                               608   }
489 }                                                 609 }
490                                                   610 
491 G4ParticleDefinition* G4ParticleTable::FindPar << 611 ////////////////////
                                                   >> 612 G4ParticleDefinition* G4ParticleTable::FindParticle(const G4ParticleDefinition *particle )
492 {                                                 613 {
493   CheckReadiness();                               614   CheckReadiness();
494   G4String key = GetKey(particle);                615   G4String key = GetKey(particle);
495   return FindParticle(key);                       616   return FindParticle(key);
496 }                                                 617 }
497                                                   618 
498 G4ParticleDefinition* G4ParticleTable::FindPar << 619 ////////////////////
                                                   >> 620 G4ParticleDefinition* G4ParticleTable::FindParticle(G4int aPDGEncoding ) 
499 {                                                 621 {
500   CheckReadiness();                            << 622    CheckReadiness();
501   // check aPDGEncoding is valid               << 623     // check aPDGEncoding is valid
502   if (aPDGEncoding == 0) {                     << 624     if (aPDGEncoding == 0){ 
503 #ifdef G4VERBOSE                                  625 #ifdef G4VERBOSE
504     if (verboseLevel > 1) {                    << 626       if (verboseLevel>1){
505       G4cout << "PDGEncoding  [" << aPDGEncodi << 627         G4cout << "PDGEncoding  [" <<  aPDGEncoding << "] is not valid " << G4endl;
506     }                                          << 628       }
507 #endif                                            629 #endif
508     return nullptr;                            << 630       return 0;
509   }                                            << 631     }
510                                                << 632     
511   G4PTblEncodingDictionary* pedic = fEncodingD << 633     G4PTblEncodingDictionary *pedic =  fEncodingDictionary;
512   G4ParticleDefinition* particle = nullptr;    << 634     G4ParticleDefinition* particle =0;  
513                                                   635 
514   if (pedic != nullptr) {                      << 636     G4PTblEncodingDictionary::iterator it =  pedic->find(aPDGEncoding );
515     auto it = pedic->find(aPDGEncoding);       << 
516     if (it != pedic->end()) {                     637     if (it != pedic->end()) {
517       particle = (*it).second;                    638       particle = (*it).second;
518     }                                             639     }
519   }                                            << 
520                                                   640 
521 #ifdef G4MULTITHREADED                            641 #ifdef G4MULTITHREADED
522   if (particle == nullptr && G4Threading::IsWo << 642     if(particle == 0 && G4Threading::IsWorkerThread())
523     G4MUTEXLOCK(&G4ParticleTable::particleTabl << 643     {
524     auto its = fEncodingDictionaryShadow->find << 644       G4MUTEXLOCK(&G4ParticleTable::particleTableMutex);
525     if (its != fEncodingDictionaryShadow->end( << 645       G4PTblEncodingDictionary::iterator its = fEncodingDictionaryShadow->find(aPDGEncoding);
526       particle = (*its).second;                << 646       if(its!=fEncodingDictionaryShadow->end())
527       fEncodingDictionary->insert(*its);       << 647       {
528       G4String key = GetKey(particle);         << 648         particle = (*its).second;
529       fDictionary->insert(std::pair<G4String,  << 649         fEncodingDictionary->insert(*its);
                                                   >> 650         G4String key = GetKey(particle);
                                                   >> 651         fDictionary->insert( std::pair<G4String, G4ParticleDefinition*>(key,particle) );
                                                   >> 652       }
                                                   >> 653       G4MUTEXUNLOCK(&G4ParticleTable::particleTableMutex);  
530     }                                             654     }
531     G4MUTEXUNLOCK(&G4ParticleTable::particleTa << 
532   }                                            << 
533 #endif                                            655 #endif
534                                                   656 
535 #ifdef G4VERBOSE                                  657 #ifdef G4VERBOSE
536   if ((particle == nullptr) && (verboseLevel > << 658     if ((particle == 0) && (verboseLevel>1) ){
537     G4cout << "CODE:" << aPDGEncoding << " doe << 659       G4cout << "CODE:" << aPDGEncoding << " does not exist in ParticleTable " << G4endl;
538   }                                            << 660     }
539 #endif                                            661 #endif
540   return particle;                             << 662     return particle;
541 }                                                 663 }
542                                                   664 
543 void G4ParticleTable::DumpTable(const G4String << 665 ////////////////////
                                                   >> 666 void G4ParticleTable::DumpTable(const G4String &particle_name) 
544 {                                                 667 {
545   CheckReadiness();                               668   CheckReadiness();
546   if ((particle_name == "ALL") || (particle_na << 669   if (( particle_name == "ALL" ) || (particle_name == "all")){
547     // dump all particles                      << 670     // dump all particles 
548     G4PTblDicIterator* piter = fIterator;      << 671     G4PTblDicIterator *piter = fIterator; 
549     piter->reset();                            << 672     piter -> reset();
550     while ((*piter)())  // Loop checking, 09.0 << 673     while( (*piter)() ){
551     {                                          << 
552       (piter->value())->DumpTable();              674       (piter->value())->DumpTable();
553     }                                             675     }
554   }                                            << 676   } else {
555   else {                                       << 677     // dump only particle with name of  particle_name
556     // dump only particle with name of particl << 678     G4ParticleDefinition *ptr;
557     G4ParticleDefinition* ptr = FindParticle(p << 679     ptr = FindParticle(particle_name);
558     if (ptr != nullptr) {                      << 680     if ( ptr != 0) {
559       ptr->DumpTable();                           681       ptr->DumpTable();
560     }                                          << 682     } else { 
561     else {                                     << 
562 #ifdef G4VERBOSE                                  683 #ifdef G4VERBOSE
563       if (verboseLevel > 1) {                  << 684       if (verboseLevel>1) {
564         G4cout << " G4ParticleTable::DumpTable << 685   G4cout << " G4ParticleTable::DumpTable : " 
565                << " does not exist in Particle << 686          << particle_name << " does not exist in ParticleTable " <<G4endl;
566       }                                           687       }
567 #endif                                            688 #endif
568     }                                             689     }
569   }                                               690   }
570 }                                                 691 }
571                                                   692 
572 void G4ParticleTable::CheckReadiness() const      693 void G4ParticleTable::CheckReadiness() const
573 {                                                 694 {
574   if (!readyToUse) {                           << 695   if(!readyToUse) {
575     G4String msg;                              << 696    G4String msg;
576     msg = "Illegal use of G4ParticleTable :\n" << 697    msg = "Illegal use of G4ParticleTable : ";
577     msg += "Access to G4ParticleTable for find << 698    msg += " Access to G4ParticleTable for finding a particle or equivalent\n";
578     msg += "operation occurs before G4VUserPhy << 699    msg += "operation occurs before G4VUserPhysicsList is instantiated and\n";
579     msg += "assigned to G4RunManager. Such an  << 700    msg += "assigned to G4RunManager. Such an access is prohibited by\n";
580     msg += "Geant4 version 8.0. To fix this pr << 701    msg += "Geant4 version 8.0. To fix this problem, please make sure that\n";
581     msg += "your main() instantiates G4VUserPh << 702    msg += "your main() instantiates G4VUserPhysicsList and set it to\n";
582     msg += "G4RunManager before instantiating  << 703    msg += "G4RunManager before instantiating other user classes such as\n";
583     msg += "G4VUserPrimaryParticleGeneratorAct << 704    msg += "G4VUserPrimaryParticleGeneratorAction.";
584     G4Exception("G4ParticleTable::CheckReadine << 705    G4Exception("G4ParticleTable::CheckReadiness()",
                                                   >> 706               "PART002",FatalException,msg);
585   }                                               707   }
586 }                                                 708 }
587                                                   709 
588 G4IonTable* G4ParticleTable::GetIonTable() con << 710  
                                                   >> 711 
                                                   >> 712 G4IonTable*  G4ParticleTable::GetIonTable() const
589 {                                                 713 {
590   return fIonTable;                               714   return fIonTable;
591 }                                                 715 }
592                                                << 716  
593 const G4ParticleTable::G4PTblDictionary* G4Par    717 const G4ParticleTable::G4PTblDictionary* G4ParticleTable::GetDictionary() const
594 {                                                 718 {
595   return fDictionary;                             719   return fDictionary;
596 }                                                 720 }
597                                                   721 
598 G4ParticleTable::G4PTblDicIterator* G4Particle    722 G4ParticleTable::G4PTblDicIterator* G4ParticleTable::GetIterator() const
599 {                                                 723 {
600   return fIterator;                               724   return fIterator;
601 }                                                 725 }
602                                                   726 
603 const G4ParticleTable::G4PTblEncodingDictionar    727 const G4ParticleTable::G4PTblEncodingDictionary* G4ParticleTable::GetEncodingDictionary() const
604 {                                                 728 {
605   return fEncodingDictionary;                     729   return fEncodingDictionary;
606 }                                                 730 }
607                                                   731 
608 G4bool G4ParticleTable::contains(const G4Strin << 732 G4bool  G4ParticleTable::contains(const G4String& particle_name) const
609 {                                                 733 {
610   auto it = fDictionaryShadow->find(particle_n << 734   G4PTblDictionary::iterator it =  fDictionaryShadow->find(particle_name);
611   return (it != fDictionaryShadow->cend());    << 735   return (it != fDictionaryShadow->end());
612 }                                                 736 }
613                                                   737 
614 G4int G4ParticleTable::entries() const            738 G4int G4ParticleTable::entries() const
615 {                                                 739 {
616   return (G4int)fDictionary->size();           << 740   return fDictionary->size();
617 }                                                 741 }
618                                                   742 
619 G4int G4ParticleTable::size() const               743 G4int G4ParticleTable::size() const
620 {                                                 744 {
621   return (G4int)fDictionary->size();           << 745   return fDictionary->size();
622 }                                                 746 }
                                                   >> 747 
                                                   >> 748 
623                                                   749