Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/processes/management/src/G4ProcessTable.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 /processes/management/src/G4ProcessTable.cc (Version 11.3.0) and /processes/management/src/G4ProcessTable.cc (Version 10.7.p2)


  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 // G4ProcessTable class implementation             26 // G4ProcessTable class implementation
 27 //                                                 27 //
 28 // Author: H.Kurashige, 4 August 1998              28 // Author: H.Kurashige, 4 August 1998
 29 // -------------------------------------------     29 // --------------------------------------------------------------------
 30                                                    30 
 31 #include "G4ProcessTableMessenger.hh"              31 #include "G4ProcessTableMessenger.hh"
 32 #include "G4ProcessTable.hh"                       32 #include "G4ProcessTable.hh"
 33 #include "G4ParticleTable.hh"                      33 #include "G4ParticleTable.hh"
 34 #include "G4ios.hh"                                34 #include "G4ios.hh"
 35                                                    35 
 36 // -------------------------------------------     36 // --------------------------------------------------------------------
 37 // Static class variable: ptr to single instan     37 // Static class variable: ptr to single instance of class in a thread
 38 G4ThreadLocal G4ProcessTable* G4ProcessTable::     38 G4ThreadLocal G4ProcessTable* G4ProcessTable::fProcessTable = nullptr;
 39                                                    39 
 40 // -------------------------------------------     40 // --------------------------------------------------------------------
 41 // Default constructor                             41 // Default constructor
 42 //                                                 42 //
 43 G4ProcessTable::G4ProcessTable()                   43 G4ProcessTable::G4ProcessTable()
 44 {                                                  44 {
 45 #ifdef G4VERBOSE                                   45 #ifdef G4VERBOSE
 46   if (verboseLevel>1)                              46   if (verboseLevel>1)
 47   {                                                47   {
 48     G4cout << "--  G4ProcessTable constructor      48     G4cout << "--  G4ProcessTable constructor  --" << G4endl;
 49   }                                                49   }
 50 #endif                                             50 #endif
 51   fProcTblVector  = new  G4ProcTableVector();      51   fProcTblVector  = new  G4ProcTableVector();
 52   fProcNameVector = new  G4ProcNameVector();       52   fProcNameVector = new  G4ProcNameVector();
 53   tmpTblVector    = new  G4ProcTableVector();      53   tmpTblVector    = new  G4ProcTableVector();
 54   fProcTblMessenger = new G4ProcessTableMessen     54   fProcTblMessenger = new G4ProcessTableMessenger(this);
 55 }                                                  55 }
 56                                                    56 
 57 // -------------------------------------------     57 // --------------------------------------------------------------------
 58 // Destructor                                      58 // Destructor
 59 //                                                 59 //
 60 G4ProcessTable::~G4ProcessTable()                  60 G4ProcessTable::~G4ProcessTable()
 61 {                                                  61 {
 62   if ( tmpTblVector != nullptr )                   62   if ( tmpTblVector != nullptr )
 63   {                                                63   {
 64     tmpTblVector ->clear();                        64     tmpTblVector ->clear();
 65     delete tmpTblVector;                           65     delete tmpTblVector;
 66     tmpTblVector = nullptr;                        66     tmpTblVector = nullptr;
 67   }                                                67   }
 68                                                    68 
 69   if ( fProcTblVector != nullptr )                 69   if ( fProcTblVector != nullptr )
 70   {                                                70   {
 71     for (auto elem : *fProcTblVector)              71     for (auto elem : *fProcTblVector)
 72     {                                              72     {
 73       delete elem;                                 73       delete elem;
 74     }                                              74     }  
 75     fProcTblVector ->clear();                      75     fProcTblVector ->clear();
 76     delete fProcTblVector;                         76     delete fProcTblVector;
 77     fProcTblVector = nullptr;                      77     fProcTblVector = nullptr;
 78   }                                                78   }
 79                                                    79 
 80   // delete all process except transportation      80   // delete all process except transportation
 81   for(auto proc : fListProcesses)                  81   for(auto proc : fListProcesses)
 82   {                                                82   {
 83     if ( proc != nullptr )                         83     if ( proc != nullptr )
 84     {                                              84     {
 85       G4ProcessType type = proc->GetProcessTyp     85       G4ProcessType type = proc->GetProcessType();
 86       if (type != fTransportation && type != f     86       if (type != fTransportation && type != fParallel
 87        && type != fParameterisation)               87        && type != fParameterisation)
 88       {                                            88       {
 89         delete proc;                               89         delete proc;
 90       }                                            90       } 
 91     }                                              91     } 
 92   }                                                92   }
 93                                                    93 
 94   fListProcesses.clear();                          94   fListProcesses.clear();
 95                                                    95 
 96   if ( fProcNameVector != nullptr )                96   if ( fProcNameVector != nullptr )
 97   {                                                97   {
 98     fProcNameVector ->clear();                     98     fProcNameVector ->clear();
 99     delete fProcNameVector;                        99     delete fProcNameVector;
100     fProcNameVector = nullptr;                    100     fProcNameVector = nullptr;
101   }                                               101   }
102   fProcessTable = nullptr;                        102   fProcessTable = nullptr;
103   delete fProcTblMessenger;                       103   delete fProcTblMessenger;
104 }                                                 104 }
105                                                   105 
106 // -------------------------------------------    106 // --------------------------------------------------------------------
107 //                                                107 //
108 G4ProcessTable* G4ProcessTable::GetProcessTabl    108 G4ProcessTable* G4ProcessTable::GetProcessTable()
109 {                                                 109 {
110   if(fProcessTable == nullptr)                    110   if(fProcessTable == nullptr)
111   {                                               111   {
112     static G4ThreadLocalSingleton<G4ProcessTab    112     static G4ThreadLocalSingleton<G4ProcessTable> inst;
113     fProcessTable = inst.Instance();              113     fProcessTable = inst.Instance();
114   }                                               114   }
115   return fProcessTable;                           115   return fProcessTable;
116 }                                                 116 }
117                                                   117 
118 // -------------------------------------------    118 // --------------------------------------------------------------------
119 //                                                119 //
120 G4int G4ProcessTable::Insert(G4VProcess* aProc    120 G4int G4ProcessTable::Insert(G4VProcess* aProcess, 
121                              G4ProcessManager*    121                              G4ProcessManager* aProcMgr)
122 {                                                 122 {
123   if ( (aProcess == nullptr) || ( aProcMgr ==     123   if ( (aProcess == nullptr) || ( aProcMgr == nullptr ) || !fProcTblVector )
124   {                                               124   {
125 #ifdef G4VERBOSE                                  125 #ifdef G4VERBOSE
126     if (verboseLevel>0)                           126     if (verboseLevel>0)
127     {                                             127     {
128       G4cout << "G4ProcessTable::Insert() - ar    128       G4cout << "G4ProcessTable::Insert() - arguments are null pointer "
129              << aProcess << "," << aProcMgr <<    129              << aProcess << "," << aProcMgr << G4endl;
130     }                                             130     }
131 #endif                                            131 #endif
132     return -1;                                    132     return -1;
133   }                                               133   }
134                                                   134     
135 #ifdef G4VERBOSE                                  135 #ifdef G4VERBOSE
136   if (verboseLevel>1)                             136   if (verboseLevel>1)
137   {                                               137   {
138     G4cout << "G4ProcessTable::Insert() -";       138     G4cout << "G4ProcessTable::Insert() -";
139     G4cout << " Process["  << aProcess->GetPro    139     G4cout << " Process["  << aProcess->GetProcessName() << "]";
140     G4cout << " Particle["  << aProcMgr->GetPa    140     G4cout << " Particle["  << aProcMgr->GetParticleType()->GetParticleName()
141            << "]" << G4endl;                      141            << "]" << G4endl;
142   }                                               142   }
143 #endif                                            143 #endif
144                                                   144 
145   G4int idxTbl = 0;                               145   G4int idxTbl = 0;
146   G4int nidx = (G4int)fProcTblVector->size();  << 146   G4int nidx = fProcTblVector->size();
147   G4ProcTblElement* anElement = nullptr;          147   G4ProcTblElement* anElement = nullptr;
148   // loop over all elements                       148   // loop over all elements
149   for (; idxTbl < nidx; ++idxTbl)                 149   for (; idxTbl < nidx; ++idxTbl)
150   {                                               150   {
151     anElement = (*fProcTblVector)[idxTbl];        151     anElement = (*fProcTblVector)[idxTbl];
152     if(!anElement) { continue; }                  152     if(!anElement) { continue; }
153     // check if this process is included          153     // check if this process is included
154     if (aProcess == anElement->GetProcess())      154     if (aProcess == anElement->GetProcess())
155     {                                             155     {
156       // add the process manager into the elem    156       // add the process manager into the element 
157       // unless  this process manager is inclu    157       // unless  this process manager is included
158       if (!anElement->Contains(aProcMgr))         158       if (!anElement->Contains(aProcMgr))
159       {                                           159       {
160         anElement->Insert(aProcMgr);              160         anElement->Insert(aProcMgr);
161 #ifdef G4VERBOSE                                  161 #ifdef G4VERBOSE
162         if (verboseLevel>2)                       162         if (verboseLevel>2)
163         {                                         163         {
164           G4cout << " This Process Manager is     164           G4cout << " This Process Manager is registered !! " << G4endl;
165         }                                         165         }
166 #endif                                            166 #endif
167       }                                           167       }
168       return idxTbl;                              168       return idxTbl;
169     }                                             169     }
170   }                                               170   }
171   // add this process into the table by creati    171   // add this process into the table by creating a new element
172   if (verboseLevel>2)                             172   if (verboseLevel>2)
173   {                                               173   {
174     G4cout << " New element is created !! " <<    174     G4cout << " New element is created !! " << G4endl;
175   }                                               175   }
176   anElement = new G4ProcTblElement(aProcess);     176   anElement = new G4ProcTblElement(aProcess);
177   anElement->Insert(aProcMgr);                    177   anElement->Insert(aProcMgr);
178   fProcTblVector->push_back(anElement);           178   fProcTblVector->push_back(anElement);
179   fProcNameVector->push_back(aProcess->GetProc    179   fProcNameVector->push_back(aProcess->GetProcessName() );
180   return nidx;                                    180   return nidx;
181 }                                                 181 }
182                                                   182 
183 // -------------------------------------------    183 // --------------------------------------------------------------------
184 //                                                184 //
185 G4int G4ProcessTable::Remove( G4VProcess* aPro    185 G4int G4ProcessTable::Remove( G4VProcess* aProcess, 
186                               G4ProcessManager    186                               G4ProcessManager* aProcMgr )
187 {                                                 187 {
188   if ( (aProcess == nullptr) || ( aProcMgr ==     188   if ( (aProcess == nullptr) || ( aProcMgr == nullptr ) || !fProcTblVector )
189   {                                               189   {
190 #ifdef G4VERBOSE                                  190 #ifdef G4VERBOSE
191     if (verboseLevel>0)                           191     if (verboseLevel>0)
192     {                                             192     {
193       G4cout << "G4ProcessTable::Remove() - ar    193       G4cout << "G4ProcessTable::Remove() - arguments are null pointer "
194              << G4endl;                           194              << G4endl;
195     }                                             195     }
196 #endif                                            196 #endif
197     return -1;                                    197     return -1;
198   }                                               198   }
199                                                   199     
200 #ifdef G4VERBOSE                                  200 #ifdef G4VERBOSE
201   if (verboseLevel>1)                             201   if (verboseLevel>1)
202   {                                               202   {
203     G4cout << "G4ProcessTable::Remove() -";       203     G4cout << "G4ProcessTable::Remove() -";
204     G4cout << " Process["  << aProcess->GetPro    204     G4cout << " Process["  << aProcess->GetProcessName() << "]";
205     G4cout << " Particle[" << aProcMgr->GetPar    205     G4cout << " Particle[" << aProcMgr->GetParticleType()->GetParticleName()
206            << "]" << G4endl;                      206            << "]" << G4endl;
207   }                                               207   }
208 #endif                                            208 #endif
209                                                   209 
210   G4int idxTbl = 0;                               210   G4int idxTbl = 0;
211   G4int nidx = (G4int)fProcTblVector->size();  << 211   G4int nidx = fProcTblVector->size();
212   G4ProcTblElement* anElement =nullptr;           212   G4ProcTblElement* anElement =nullptr;
213   // loop over all elements                       213   // loop over all elements
214   for (; idxTbl < nidx; ++idxTbl)                 214   for (; idxTbl < nidx; ++idxTbl)
215   {                                               215   {
216     anElement = (*fProcTblVector)[idxTbl];        216     anElement = (*fProcTblVector)[idxTbl];
217     if(!anElement) { continue; }                  217     if(!anElement) { continue; }
218                                                   218 
219     // check if this process is included          219     // check if this process is included
220     if (aProcess == anElement->GetProcess())      220     if (aProcess == anElement->GetProcess())
221     {                                             221     {
222       if(anElement->Contains(aProcMgr))           222       if(anElement->Contains(aProcMgr))
223       {                                           223       {
224         // remove the process manager from the    224         // remove the process manager from the element
225         anElement->Remove(aProcMgr);              225         anElement->Remove(aProcMgr);
226 #ifdef G4VERBOSE                                  226 #ifdef G4VERBOSE
227         if (verboseLevel>2)                       227         if (verboseLevel>2)
228         {                                         228         {
229           G4cout << " This Process Manager is     229           G4cout << " This Process Manager is removed !! " << G4endl;
230         }                                         230         }
231 #endif                                            231 #endif
232         if(anElement->Length() == 0)              232         if(anElement->Length() == 0)
233         {                                         233         {
234           delete anElement;                       234           delete anElement;
235           (*fProcTblVector)[idxTbl] = nullptr;    235           (*fProcTblVector)[idxTbl] = nullptr;
236 #ifdef G4VERBOSE                                  236 #ifdef G4VERBOSE
237           if (verboseLevel>1)                     237           if (verboseLevel>1)
238           {                                       238           {
239             G4cout << " This Process is remove    239             G4cout << " This Process is removed !! " << G4endl;
240           }                                       240           }
241 #endif                                            241 #endif
242         }                                         242         }
243         return idxTbl;                            243         return idxTbl;
244       }                                           244       }
245     }                                             245     }
246   }                                               246   }
247 #ifdef G4VERBOSE                                  247 #ifdef G4VERBOSE
248   if (verboseLevel>1)                             248   if (verboseLevel>1)
249   {                                               249   {
250     G4cout << " This Process Manager is not re    250     G4cout << " This Process Manager is not registered to the process!! " 
251            << G4endl;                             251            << G4endl;
252   }                                               252   }
253 #endif                                            253 #endif
254   return -1;                                      254   return -1;
255 }                                                 255 }
256                                                   256 
257 // -------------------------------------------    257 // --------------------------------------------------------------------
258 //                                                258 //
259 void G4ProcessTable::RegisterProcess(G4VProces    259 void G4ProcessTable::RegisterProcess(G4VProcess* ptr)
260 {                                                 260 {
261   for(auto proc : fListProcesses)                 261   for(auto proc : fListProcesses)
262   {                                               262   {
263     if(ptr == proc) { return; }                   263     if(ptr == proc) { return; } 
264   }                                               264   }
265   fListProcesses.push_back(ptr);                  265   fListProcesses.push_back(ptr);
266 }                                                 266 }
267                                                   267 
268 // -------------------------------------------    268 // --------------------------------------------------------------------
269 //                                                269 //
270 void G4ProcessTable::DeRegisterProcess(G4VProc    270 void G4ProcessTable::DeRegisterProcess(G4VProcess* ptr)
271 {                                                 271 {  
272   std::size_t nn = fListProcesses.size();      << 272   G4int nn = fListProcesses.size();
273   for(std::size_t i=0; i<nn; ++i)              << 273   for(G4int i=0; i<nn; ++i)
274   {                                               274   {
275     if(ptr == fListProcesses[i])                  275     if(ptr == fListProcesses[i])
276     {                                             276     { 
277       fListProcesses[i] = nullptr;                277       fListProcesses[i] = nullptr;
278       return;                                     278       return; 
279     }                                             279     }
280   }                                               280   }
281 }                                                 281 }
282                                                   282 
283 // -------------------------------------------    283 // --------------------------------------------------------------------
284 //                                                284 //
285 G4VProcess* G4ProcessTable::FindProcess(const     285 G4VProcess* G4ProcessTable::FindProcess(const G4String& processName, 
286                                         const     286                                         const G4String& particleName) const
287 {                                                 287 {
288   return FindProcess(processName,                 288   return FindProcess(processName,
289           G4ParticleTable::GetParticleTable()-    289           G4ParticleTable::GetParticleTable()->FindParticle(particleName));
290 }                                                 290 }
291                                                   291 
292 // -------------------------------------------    292 // --------------------------------------------------------------------
293 //                                                293 //
294 G4VProcess* G4ProcessTable::FindProcess(const     294 G4VProcess* G4ProcessTable::FindProcess(const G4String& processName, 
295                                         const     295                                         const G4ProcessManager* processManager)
296                                         const     296                                         const
297 {                                                 297 {
298   for (auto anElement : *fProcTblVector)          298   for (auto anElement : *fProcTblVector)
299   {                                               299   {
300     // check name and if the processManage is     300     // check name and if the processManage is included
301     if (anElement && anElement->GetProcessName    301     if (anElement && anElement->GetProcessName() == processName
302         && anElement->Contains(processManager)    302         && anElement->Contains(processManager))
303     {                                             303     {
304       return anElement->GetProcess();             304       return anElement->GetProcess();
305     }                                             305     }
306   }                                               306   }
307 #ifdef G4VERBOSE                                  307 #ifdef G4VERBOSE
308   if (verboseLevel > 1)                           308   if (verboseLevel > 1)
309   {                                               309   {
310     G4cout << " G4ProcessTable::FindProcess()     310     G4cout << " G4ProcessTable::FindProcess() -" ;
311     G4cout << " The Process[" << processName <    311     G4cout << " The Process[" << processName << "] is not found  ";
312     G4cout << " for [" << processManager->GetP    312     G4cout << " for [" << processManager->GetParticleType()->GetParticleName()
313            << "]" << G4endl;                      313            << "]" << G4endl;
314   }                                               314   }
315 #endif                                            315 #endif
316   return nullptr;                                 316   return nullptr;
317 }                                                 317 }
318                                                   318 
319 // -------------------------------------------    319 // --------------------------------------------------------------------
320 //                                                320 //
321 G4VProcess*                                       321 G4VProcess*
322 G4ProcessTable::FindProcess(G4ProcessType proc    322 G4ProcessTable::FindProcess(G4ProcessType processType, 
323                             const G4ParticleDe    323                             const G4ParticleDefinition* particle) const
324 {                                                 324 {
325   // find the first process of given type for     325   // find the first process of given type for this particle
326                                                   326 
327   const G4ProcessManager* processManager = par    327   const G4ProcessManager* processManager = particle->GetProcessManager();
328   for (auto anElement : *fProcTblVector)          328   for (auto anElement : *fProcTblVector)
329   {                                               329   {
330     if (anElement && anElement->GetProcess()->    330     if (anElement && anElement->GetProcess()->GetProcessType() == processType
331         && anElement->Contains(processManager)    331         && anElement->Contains(processManager))
332     {                                             332     {
333       return anElement->GetProcess();             333       return anElement->GetProcess();
334     }                                             334     }
335   }                                               335   }
336 #ifdef G4VERBOSE                                  336 #ifdef G4VERBOSE
337   if (verboseLevel > 1)                           337   if (verboseLevel > 1)
338   {                                               338   {
339     G4cout << " G4ProcessTable::FindProcess()     339     G4cout << " G4ProcessTable::FindProcess() -";
340     G4cout << " The Process Type " << processT    340     G4cout << " The Process Type " << processType << " is not found  ";
341     G4cout << " for [" << particle->GetParticl    341     G4cout << " for [" << particle->GetParticleName() << "]" << G4endl;
342   }                                               342   }
343 #endif                                            343 #endif
344   return nullptr;                                 344   return nullptr;
345 }                                                 345 }
346                                                   346 
347 // -------------------------------------------    347 // --------------------------------------------------------------------
348 //                                                348 //
349 G4VProcess*                                       349 G4VProcess*
350 G4ProcessTable::FindProcess(G4int procSubType,    350 G4ProcessTable::FindProcess(G4int procSubType, 
351                             const G4ParticleDe    351                             const G4ParticleDefinition* particle) const
352 {                                                 352 {
353   // find the first process of given type for     353   // find the first process of given type for this particle
354                                                   354 
355   const G4ProcessManager* processManager = par    355   const G4ProcessManager* processManager = particle->GetProcessManager();
356   for (auto anElement : *fProcTblVector)          356   for (auto anElement : *fProcTblVector)
357   {                                               357   {
358     if ( anElement != nullptr                     358     if ( anElement != nullptr
359       && anElement->GetProcess()->GetProcessSu    359       && anElement->GetProcess()->GetProcessSubType() == procSubType
360       && anElement->Contains(processManager) )    360       && anElement->Contains(processManager) )
361     {                                             361     {
362       return anElement->GetProcess();             362       return anElement->GetProcess();
363     }                                             363     }
364   }                                               364   }
365 #ifdef G4VERBOSE                                  365 #ifdef G4VERBOSE
366   if (verboseLevel > 1)                           366   if (verboseLevel > 1)
367   {                                               367   {
368     G4cout << " G4ProcessTable::FindProcess()     368     G4cout << " G4ProcessTable::FindProcess() -";
369     G4cout << " The Process SubType " << procS    369     G4cout << " The Process SubType " << procSubType << " is not found  ";
370     G4cout << " for [" << particle->GetParticl    370     G4cout << " for [" << particle->GetParticleName() << "]" << G4endl;
371   }                                               371   }
372 #endif                                            372 #endif
373   return nullptr;                                 373   return nullptr;
374 }                                                 374 }
375                                                   375 
376 // -------------------------------------------    376 // --------------------------------------------------------------------
377 //                                                377 //
378 G4ProcessTable::G4ProcTableVector*                378 G4ProcessTable::G4ProcTableVector*
379 G4ProcessTable::Find(const G4String& processNa    379 G4ProcessTable::Find(const G4String& processName)
380 {                                                 380 {
381   tmpTblVector->clear();                          381   tmpTblVector->clear();
382                                                   382 
383   G4bool isFound = false;                         383   G4bool isFound = false;
384   G4ProcTblElement* anElement = nullptr;          384   G4ProcTblElement* anElement = nullptr;
385   for (auto itr=fProcTblVector->cbegin(); itr!    385   for (auto itr=fProcTblVector->cbegin(); itr!=fProcTblVector->cend(); ++itr)
386   {                                               386   {
387     anElement = (*itr);                           387     anElement = (*itr);
388     // check name                                 388     // check name
389     if ( anElement != nullptr && anElement->Ge    389     if ( anElement != nullptr && anElement->GetProcessName() == processName )
390     {                                             390     {
391       isFound = true;                             391       isFound = true;
392       tmpTblVector->push_back(anElement);         392       tmpTblVector->push_back(anElement);
393     }                                             393     }
394   }                                               394   }
395                                                   395 
396   if (!isFound && verboseLevel>0)                 396   if (!isFound && verboseLevel>0)
397   {                                               397   {
398 #ifdef G4VERBOSE                                  398 #ifdef G4VERBOSE
399     G4cout << " G4ProcessTable::Find() -" ;       399     G4cout << " G4ProcessTable::Find() -" ;
400     G4cout << " The Process[" << processName <    400     G4cout << " The Process[" << processName << "] is not found  " << G4endl;
401 #endif                                            401 #endif
402   }                                               402   }
403                                                   403 
404   return tmpTblVector;                            404   return tmpTblVector;
405 }                                                 405 }
406                                                   406 
407 // -------------------------------------------    407 // --------------------------------------------------------------------
408 //                                                408 //
409 G4ProcessTable::G4ProcTableVector*                409 G4ProcessTable::G4ProcTableVector*
410 G4ProcessTable::Find(G4ProcessType processType    410 G4ProcessTable::Find(G4ProcessType processType)
411 {                                                 411 {
412   tmpTblVector->clear();                          412   tmpTblVector->clear();
413                                                   413 
414   G4bool isFound = false;                         414   G4bool isFound = false;
415   G4ProcTblElement* anElement = nullptr;          415   G4ProcTblElement* anElement = nullptr;
416   for (auto itr=fProcTblVector->cbegin(); itr!    416   for (auto itr=fProcTblVector->cbegin(); itr!=fProcTblVector->cend(); ++itr)
417   {                                               417   {
418     anElement = (*itr);                           418     anElement = (*itr);
419     // check name                                 419     // check name
420     if ( anElement != nullptr && anElement->Ge    420     if ( anElement != nullptr && anElement->GetProcess()->GetProcessType() == processType )
421     {                                             421     {
422       isFound = true;                             422       isFound = true;
423       tmpTblVector->push_back(anElement);         423       tmpTblVector->push_back(anElement);
424     }                                             424     }
425   }                                               425   }
426                                                   426 
427   if (!isFound && verboseLevel>0)                 427   if (!isFound && verboseLevel>0)
428   {                                               428   {
429 #ifdef G4VERBOSE                                  429 #ifdef G4VERBOSE
430     G4cout << " G4ProcessTable::Find() -" ;       430     G4cout << " G4ProcessTable::Find() -" ;
431     G4cout << " The ProcessType[" << processTy    431     G4cout << " The ProcessType[" << processType << "] is not found  "
432            << G4endl;                             432            << G4endl;
433 #endif                                            433 #endif
434   }                                               434   }
435                                                   435 
436   return tmpTblVector;                            436   return tmpTblVector;
437 }                                                 437 }     
438                                                   438 
439 // -------------------------------------------    439 // --------------------------------------------------------------------
440 //                                                440 //
441 G4ProcessVector*                                  441 G4ProcessVector*
442 G4ProcessTable::ExtractProcesses(G4ProcTableVe    442 G4ProcessTable::ExtractProcesses(G4ProcTableVector* procTblVector) const
443 {                                                 443 {
444   G4ProcessVector* procList = new G4ProcessVec    444   G4ProcessVector* procList = new G4ProcessVector();
445   // loop over all elements                       445   // loop over all elements
446   for (auto itr=procTblVector->cbegin(); itr!=    446   for (auto itr=procTblVector->cbegin(); itr!=procTblVector->cend(); ++itr)
447   {                                               447   {
448     G4ProcTblElement* anElement = (*itr);         448     G4ProcTblElement* anElement = (*itr);
449     if ( anElement != nullptr) procList->inser    449     if ( anElement != nullptr) procList->insert( anElement->GetProcess() );
450   }                                               450   }
451   return procList;                                451   return procList;
452 }                                                 452 }
453                                                   453 
454 // -------------------------------------------    454 // --------------------------------------------------------------------
455 //                                                455 //
456 void G4ProcessTable::SetProcessActivation(cons    456 void G4ProcessTable::SetProcessActivation(const G4String& processName, 
457                                           cons    457                                           const G4String& particleName, 
458                                                   458                                                 G4bool fActive )
459 {                                                 459 {
460   if (particleName == "ALL" )                     460   if (particleName == "ALL" )
461   {                                               461   {
462     SetProcessActivation( processName, fActive    462     SetProcessActivation( processName, fActive); 
463   }                                               463   }
464   else                                            464   else
465   {                                               465   {
466     SetProcessActivation(processName,             466     SetProcessActivation(processName, 
467         G4ParticleTable::GetParticleTable()->F    467         G4ParticleTable::GetParticleTable()->FindParticle(particleName),
468         fActive );                                468         fActive );
469   }                                               469   }
470 }                                                 470 }
471                                                   471 
472 // -------------------------------------------    472 // --------------------------------------------------------------------
473 //                                                473 //
474 void G4ProcessTable::SetProcessActivation(G4Pr    474 void G4ProcessTable::SetProcessActivation(G4ProcessType processType,
475                                           cons    475                                           const G4String& particleName , 
476                                                   476                                                 G4bool fActive)
477 {                                                 477 {
478   if ((particleName == "ALL" ) || (particleNam    478   if ((particleName == "ALL" ) || (particleName == "all" ))
479   {                                               479   {
480     SetProcessActivation( processType, fActive    480     SetProcessActivation( processType, fActive ); 
481   }                                               481   }
482   else                                            482   else
483   {                                               483   {
484     SetProcessActivation(processType,             484     SetProcessActivation(processType,         
485         G4ParticleTable::GetParticleTable()->F    485         G4ParticleTable::GetParticleTable()->FindParticle(particleName),
486         fActive );                                486         fActive );
487   }                                               487   }
488 }                                                 488 }
489                                                   489 
490 // -------------------------------------------    490 // --------------------------------------------------------------------
491 //                                                491 //
492 void G4ProcessTable::SetProcessActivation( con    492 void G4ProcessTable::SetProcessActivation( const G4String& processName, 
493                                            G4b    493                                            G4bool          fActive  )
494 {                                                 494 {
495 #ifdef G4VERBOSE                                  495 #ifdef G4VERBOSE
496   if (verboseLevel>1)                             496   if (verboseLevel>1)
497   {                                               497   {
498     G4cout << " G4ProcessTable::SetProcessActi    498     G4cout << " G4ProcessTable::SetProcessActivation() -" ;
499     G4cout << " The Process[" << processName <    499     G4cout << " The Process[" << processName << "] "<< G4endl;
500   }                                               500   }
501 #endif                                            501 #endif
502                                                   502 
503   G4ProcTableVector* pTblVector =  Find(proces    503   G4ProcTableVector* pTblVector =  Find(processName);
504   G4ProcTblElement* anElement;                    504   G4ProcTblElement* anElement;  
505    // loop over all elements                      505    // loop over all elements
506   for (auto itr=pTblVector->cbegin(); itr!=pTb    506   for (auto itr=pTblVector->cbegin(); itr!=pTblVector->cend(); ++itr)
507   {                                               507   {
508     anElement = (*itr);                           508     anElement = (*itr);
509     if ( anElement == nullptr ) continue;         509     if ( anElement == nullptr ) continue;
510     G4VProcess* process = anElement->GetProces    510     G4VProcess* process = anElement->GetProcess();
511     for (G4int idx = 0 ; idx < anElement->Leng    511     for (G4int idx = 0 ; idx < anElement->Length(); ++idx)
512     {                                             512     {
513       G4ProcessManager* manager = anElement->G    513       G4ProcessManager* manager = anElement->GetProcessManager(idx);
514       manager->SetProcessActivation(process, f    514       manager->SetProcessActivation(process, fActive);
515 #ifdef G4VERBOSE                                  515 #ifdef G4VERBOSE
516       if (verboseLevel>1)                         516       if (verboseLevel>1)
517       {                                           517       {
518         G4cout << "  for " << manager->GetPart    518         G4cout << "  for " << manager->GetParticleType()->GetParticleName();
519         G4cout << "  Index = " << manager->Get    519         G4cout << "  Index = " << manager->GetProcessIndex(process); 
520         G4cout << G4endl;                         520         G4cout << G4endl;
521       }                                           521       }
522 #endif                                            522 #endif
523     }                                             523     }
524   }                                               524   }
525 }                                                 525 }
526                                                   526 
527 // -------------------------------------------    527 // --------------------------------------------------------------------
528 //                                                528 //
529 void G4ProcessTable::SetProcessActivation(cons    529 void G4ProcessTable::SetProcessActivation(const G4String& processName, 
530                                           G4Pr    530                                           G4ProcessManager* processManager, 
531                                           G4bo    531                                           G4bool fActive  )
532 {                                                 532 {
533 #ifdef G4VERBOSE                                  533 #ifdef G4VERBOSE
534   if (verboseLevel>1)                             534   if (verboseLevel>1)
535   {                                               535   {
536     G4cout << " G4ProcessTable::SetProcessActi    536     G4cout << " G4ProcessTable::SetProcessActivation() -" ;
537     G4cout << " The Process[" << processName <    537     G4cout << " The Process[" << processName << "] "<< G4endl;
538   }                                               538   }
539 #endif                                            539 #endif
540                                                   540   
541   G4VProcess* process = FindProcess( processNa    541   G4VProcess* process = FindProcess( processName,  processManager);
542   if ( process != nullptr)                        542   if ( process != nullptr)
543   {                                               543   {
544     processManager->SetProcessActivation(proce    544     processManager->SetProcessActivation(process, fActive);
545 #ifdef G4VERBOSE                                  545 #ifdef G4VERBOSE
546     if (verboseLevel>1)                           546     if (verboseLevel>1)
547     {                                             547     {
548       G4cout << "  for "                          548       G4cout << "  for "
549              << processManager->GetParticleTyp    549              << processManager->GetParticleType()->GetParticleName();
550       G4cout << "  Index = "                      550       G4cout << "  Index = "
551              << processManager->GetProcessInde    551              << processManager->GetProcessIndex(process) << G4endl;
552     }                                             552     }
553 #endif                                            553 #endif
554   }                                               554   } 
555 }                                                 555 }
556                                                   556 
557 // -------------------------------------------    557 // --------------------------------------------------------------------
558 //                                                558 //
559 void G4ProcessTable::SetProcessActivation( G4P    559 void G4ProcessTable::SetProcessActivation( G4ProcessType processType, 
560                                            G4b    560                                            G4bool        fActive  )
561 {                                                 561 {
562 #ifdef G4VERBOSE                                  562 #ifdef G4VERBOSE
563   if (verboseLevel>1)                             563   if (verboseLevel>1)
564   {                                               564   {
565     G4cout << " G4ProcessTable::SetProcessActi    565     G4cout << " G4ProcessTable::SetProcessActivation() -" ;
566     G4cout << " The ProcessType[" << G4int(pro    566     G4cout << " The ProcessType[" << G4int(processType) << "] "<< G4endl;
567   }                                               567   }
568 #endif                                            568 #endif
569                                                   569 
570   G4ProcTableVector* pTblVector = Find(process    570   G4ProcTableVector* pTblVector = Find(processType);
571   G4ProcTblElement* anElement;                    571   G4ProcTblElement* anElement;  
572   // loop over all elements                       572   // loop over all elements
573   for (auto itr=pTblVector->cbegin(); itr!=pTb    573   for (auto itr=pTblVector->cbegin(); itr!=pTblVector->cend(); ++itr)
574   {                                               574   {
575     anElement = (*itr);                           575     anElement = (*itr);
576     if ( anElement == nullptr ) continue;         576     if ( anElement == nullptr ) continue;
577     G4VProcess* process = anElement->GetProces    577     G4VProcess* process = anElement->GetProcess();
578 #ifdef G4VERBOSE                                  578 #ifdef G4VERBOSE
579     if (verboseLevel>1)                           579     if (verboseLevel>1)
580     {                                             580     {
581       G4cout << " The Process[" << process->Ge    581       G4cout << " The Process[" << process->GetProcessName()<< "] "<< G4endl;
582     }                                             582     }
583 #endif                                            583 #endif
584     for (G4int idx = 0 ; idx < anElement->Leng    584     for (G4int idx = 0 ; idx < anElement->Length(); ++idx)
585     {                                             585     {
586       G4ProcessManager* manager = anElement->G    586       G4ProcessManager* manager = anElement->GetProcessManager(idx);
587       manager->SetProcessActivation(process, f    587       manager->SetProcessActivation(process, fActive);
588 #ifdef G4VERBOSE                                  588 #ifdef G4VERBOSE
589       if (verboseLevel>1)                         589       if (verboseLevel>1)
590       {                                           590       {
591         G4cout << "  for " << manager->GetPart    591         G4cout << "  for " << manager->GetParticleType()->GetParticleName();
592         G4cout << "  Index = " << manager->Get    592         G4cout << "  Index = " << manager->GetProcessIndex(process) << G4endl;
593       }                                           593       }
594 #endif                                            594 #endif
595     }                                             595     }
596   }                                               596   }
597 }                                                 597 }
598                                                   598 
599 // -------------------------------------------    599 // --------------------------------------------------------------------
600 //                                                600 //
601 void G4ProcessTable::SetProcessActivation( G4P    601 void G4ProcessTable::SetProcessActivation( G4ProcessType   processType, 
602                                            G4P    602                                            G4ProcessManager* processManager, 
603                                            G4b    603                                            G4bool          fActive  )
604 {                                                 604 {
605 #ifdef G4VERBOSE                                  605 #ifdef G4VERBOSE
606   if (verboseLevel>1)                             606   if (verboseLevel>1)
607   {                                               607   {
608     G4cout << " G4ProcessTable::SetProcessActi    608     G4cout << " G4ProcessTable::SetProcessActivation() -" ;
609     G4cout << " The ProcessType[" << G4int(pro    609     G4cout << " The ProcessType[" << G4int(processType) << "] "<< G4endl;
610   }                                               610   }
611 #endif                                            611 #endif
612                                                   612   
613   G4ProcessVector* procList =  processManager-    613   G4ProcessVector* procList =  processManager->GetProcessList();
614   for (G4int idx = 0; idx < (G4int)procList->l << 614   for (std::size_t idx = 0; idx < procList->length(); ++idx)
615   {                                               615   {
616     G4VProcess* process = (*procList)(idx);       616     G4VProcess* process = (*procList)(idx);
617     if ( process->GetProcessType() == processT    617     if ( process->GetProcessType() == processType)
618     {                                             618     {
619       processManager->SetProcessActivation(pro    619       processManager->SetProcessActivation(process, fActive);
620 #ifdef G4VERBOSE                                  620 #ifdef G4VERBOSE
621       if (verboseLevel>1)                         621       if (verboseLevel>1)
622       {                                           622       {
623         G4cout << " The Process[" << process->    623         G4cout << " The Process[" << process->GetProcessName()<< "] "<< G4endl;
624         G4cout << "  for "                        624         G4cout << "  for "
625                << processManager->GetParticleT    625                << processManager->GetParticleType()->GetParticleName();
626         G4cout << "  Index = " << idx << G4end    626         G4cout << "  Index = " << idx << G4endl;
627       }                                           627       }
628 #endif                                            628 #endif
629     }                                             629     }
630   }                                               630   }
631 }                                                 631 }
632                                                   632 
633 // -------------------------------------------    633 // --------------------------------------------------------------------
634 //                                                634 //
635 void G4ProcessTable::DumpInfo(G4VProcess* proc    635 void G4ProcessTable::DumpInfo(G4VProcess* process, 
636                               const G4Particle    636                               const G4ParticleDefinition* particle)
637 {                                                 637 {
638   G4int idxTbl=0;                                 638   G4int idxTbl=0;
639   G4ProcTblElement* anElement = nullptr;          639   G4ProcTblElement* anElement = nullptr;
640   G4bool isFoundInTbl = false;                    640   G4bool isFoundInTbl = false;
641   G4ProcessManager* manager = nullptr;            641   G4ProcessManager* manager = nullptr;
642   G4int idx;                                      642   G4int idx;
643   // loop over all elements                       643   // loop over all elements
644   for (auto itr=fProcTblVector->cbegin();         644   for (auto itr=fProcTblVector->cbegin();
645             itr!=fProcTblVector->cend(); ++itr    645             itr!=fProcTblVector->cend(); ++itr, ++idxTbl)
646   {                                               646   {
647     anElement = (*itr);                           647     anElement = (*itr);
648     if ( anElement == nullptr ) continue;         648     if ( anElement == nullptr ) continue;
649     if (process == anElement->GetProcess() )      649     if (process == anElement->GetProcess() )
650     {                                             650     {
651       if (particle != nullptr)                    651       if (particle != nullptr)
652       {                                           652       {
653         for (idx=0; idx<anElement->Length(); +    653         for (idx=0; idx<anElement->Length(); ++idx)
654         {                                         654         {
655           manager = anElement->GetProcessManag    655           manager = anElement->GetProcessManager(idx);
656           if (particle == manager->GetParticle    656           if (particle == manager->GetParticleType())
657           {                                       657           {
658             isFoundInTbl = true;                  658             isFoundInTbl = true;
659             break;                                659             break;
660           }                                       660           }
661         }                                         661         }
662       }                                           662       }
663       else                                        663       else
664       {                                           664       {
665         isFoundInTbl = true;                      665         isFoundInTbl = true;
666       }                                           666       }
667       break;                                      667       break;
668     }                                             668     }
669   }                                               669   }
670   if  (!isFoundInTbl ) return;                    670   if  (!isFoundInTbl ) return;
671                                                   671   
672   G4int tmpVerbose = process->GetVerboseLevel(    672   G4int tmpVerbose = process->GetVerboseLevel();
673   process->SetVerboseLevel(verboseLevel);         673   process->SetVerboseLevel(verboseLevel);
674   process->DumpInfo();                            674   process->DumpInfo();
675   process->SetVerboseLevel(tmpVerbose);           675   process->SetVerboseLevel(tmpVerbose);
676   if (particle == nullptr)                        676   if (particle == nullptr)
677   {                                               677   {
678     for (idx=0; idx<anElement->Length(); ++idx    678     for (idx=0; idx<anElement->Length(); ++idx)
679     {                                             679     {
680       manager = anElement->GetProcessManager(i    680       manager = anElement->GetProcessManager(idx);
681       G4cout << " for " << manager->GetParticl    681       G4cout << " for " << manager->GetParticleType()->GetParticleName();
682       G4cout << G4endl;                           682       G4cout << G4endl;
683 #ifdef G4VERBOSE                                  683 #ifdef G4VERBOSE
684       if (verboseLevel >2)                        684       if (verboseLevel >2)
685       {                                           685       {
686         tmpVerbose = manager->GetVerboseLevel(    686         tmpVerbose = manager->GetVerboseLevel();
687         manager->SetVerboseLevel(verboseLevel)    687         manager->SetVerboseLevel(verboseLevel);
688         manager->DumpInfo();                      688         manager->DumpInfo();
689         manager->SetVerboseLevel(tmpVerbose);     689         manager->SetVerboseLevel(tmpVerbose);
690       }                                           690       }
691 #endif                                            691 #endif
692     }                                             692     }
693   }                                               693   }
694   else                                            694   else
695   {                                               695   {
696     G4cout << " for " << manager->GetParticleT    696     G4cout << " for " << manager->GetParticleType()->GetParticleName();
697     G4cout << G4endl;                             697     G4cout << G4endl;
698 #ifdef G4VERBOSE                                  698 #ifdef G4VERBOSE
699     if (verboseLevel >2)                          699     if (verboseLevel >2)
700     {                                             700     {
701       tmpVerbose = manager->GetVerboseLevel();    701       tmpVerbose = manager->GetVerboseLevel();
702       manager->SetVerboseLevel(verboseLevel);     702       manager->SetVerboseLevel(verboseLevel);
703       manager->DumpInfo();                        703       manager->DumpInfo();
704       manager->SetVerboseLevel(tmpVerbose);       704       manager->SetVerboseLevel(tmpVerbose);
705     }                                             705     }
706 #endif                                            706 #endif
707   }                                               707   }
708 }                                                 708 }
709                                                   709