Geant4 Cross Reference |
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 26 // G4ProcessTable 27 // 27 // 28 // Class description: 28 // Class description: 29 // 29 // 30 // This class is used for "book keeping" of al 30 // This class is used for "book keeping" of all processes 31 // which are registered for all particles 31 // which are registered for all particles 32 32 33 // Author: H.Kurashige, 4 August 1998 33 // Author: H.Kurashige, 4 August 1998 34 // ------------------------------------------- 34 // -------------------------------------------------------------------- 35 #ifndef G4ProcessTable_hh 35 #ifndef G4ProcessTable_hh 36 #define G4ProcessTable_hh 1 36 #define G4ProcessTable_hh 1 37 37 38 #include <vector> 38 #include <vector> 39 39 40 #include "globals.hh" 40 #include "globals.hh" 41 #include "G4ProcTblElement.hh" 41 #include "G4ProcTblElement.hh" 42 #include "G4ProcessVector.hh" 42 #include "G4ProcessVector.hh" 43 #include "G4ThreadLocalSingleton.hh" 43 #include "G4ThreadLocalSingleton.hh" 44 44 45 class G4UImessenger; 45 class G4UImessenger; 46 class G4ProcessTableMessenger; 46 class G4ProcessTableMessenger; 47 47 48 class G4ProcessTable 48 class G4ProcessTable 49 { 49 { 50 friend class G4ThreadLocalSingleton<G4Proces 50 friend class G4ThreadLocalSingleton<G4ProcessTable>; 51 51 52 public: 52 public: 53 53 54 using G4ProcTableVector = std::vector<G4Pr 54 using G4ProcTableVector = std::vector<G4ProcTblElement*>; 55 using G4ProcNameVector = std::vector<G4Str 55 using G4ProcNameVector = std::vector<G4String>; 56 56 57 ~G4ProcessTable(); 57 ~G4ProcessTable(); 58 // Destructor 58 // Destructor 59 59 60 G4ProcessTable(const G4ProcessTable&) = de 60 G4ProcessTable(const G4ProcessTable&) = delete; 61 G4ProcessTable& operator=(const G4ProcessT 61 G4ProcessTable& operator=(const G4ProcessTable&) = delete; 62 G4bool operator==(const G4ProcessTable &ri 62 G4bool operator==(const G4ProcessTable &right) const = delete; 63 G4bool operator!=(const G4ProcessTable &ri 63 G4bool operator!=(const G4ProcessTable &right) const = delete; 64 // Copy constructor and operators not al 64 // Copy constructor and operators not allowed 65 65 66 static G4ProcessTable* GetProcessTable(); 66 static G4ProcessTable* GetProcessTable(); 67 // Return the pointer to the G4ProcessTa 67 // Return the pointer to the G4ProcessTable object 68 // As "singleton" one can get the instan 68 // As "singleton" one can get the instance pointer by this function 69 69 70 inline G4int Length() const; 70 inline G4int Length() const; 71 // Return the number of processes in the 71 // Return the number of processes in the table 72 72 73 G4int Insert(G4VProcess* aProcess, G4Proce 73 G4int Insert(G4VProcess* aProcess, G4ProcessManager* aProcMgr); 74 G4int Remove(G4VProcess* aProcess, G4Proce 74 G4int Remove(G4VProcess* aProcess, G4ProcessManager* aProcMgr); 75 // Each process object is registered wit 75 // Each process object is registered with information of process 76 // managers that use it 76 // managers that use it 77 77 78 G4VProcess* FindProcess(const G4String& pr 78 G4VProcess* FindProcess(const G4String& processName, 79 const G4String& pa 79 const G4String& particleName) const; 80 inline G4VProcess* FindProcess(const G4Str 80 inline G4VProcess* FindProcess(const G4String& processName, 81 const G4Par 81 const G4ParticleDefinition* particle) const; 82 G4VProcess* FindProcess(const G4String& pr 82 G4VProcess* FindProcess(const G4String& processName, 83 const G4ProcessMan 83 const G4ProcessManager* processManager) const; 84 G4VProcess* FindProcess(G4ProcessType proc 84 G4VProcess* FindProcess(G4ProcessType processType, 85 const G4ParticleDe 85 const G4ParticleDefinition* particle) const; 86 G4VProcess* FindProcess(G4int processSubTy 86 G4VProcess* FindProcess(G4int processSubType, 87 const G4ParticleDe 87 const G4ParticleDefinition* particle) const; 88 // Return the process pointer 88 // Return the process pointer 89 89 90 void RegisterProcess(G4VProcess*); 90 void RegisterProcess(G4VProcess*); 91 void DeRegisterProcess(G4VProcess*); 91 void DeRegisterProcess(G4VProcess*); 92 // Implementation of registration mechan 92 // Implementation of registration mechanism 93 93 94 inline G4ProcessVector* FindProcesses(); 94 inline G4ProcessVector* FindProcesses(); 95 inline G4ProcessVector* FindProcesses( con 95 inline G4ProcessVector* FindProcesses( const G4ProcessManager* pManager ); 96 inline G4ProcessVector* FindProcesses( con 96 inline G4ProcessVector* FindProcesses( const G4String& processName ); 97 inline G4ProcessVector* FindProcesses( G4P 97 inline G4ProcessVector* FindProcesses( G4ProcessType processType ); 98 // Return pointer of a process vector wh 98 // Return pointer of a process vector which includes processes specified 99 // Note: user is responsible to delete t 99 // Note: user is responsible to delete this process vector object 100 100 101 void SetProcessActivation( const G4String& 101 void SetProcessActivation( const G4String& processName, 102 G4bool 102 G4bool fActive ); 103 void SetProcessActivation( const G4String& 103 void SetProcessActivation( const G4String& processName, 104 const G4String& 104 const G4String& particleName, 105 G4bool 105 G4bool fActive ); 106 inline void SetProcessActivation( const G4 106 inline void SetProcessActivation( const G4String& processName, 107 const G4 107 const G4ParticleDefinition* particle, 108 G4bool 108 G4bool fActive ); 109 void SetProcessActivation( const G4String& 109 void SetProcessActivation( const G4String& processName, 110 G4ProcessManage 110 G4ProcessManager* processManager, 111 G4bool 111 G4bool fActive ); 112 void SetProcessActivation( G4ProcessType 112 void SetProcessActivation( G4ProcessType processType, 113 G4bool 113 G4bool fActive ); 114 void SetProcessActivation( G4ProcessType 114 void SetProcessActivation( G4ProcessType processType, 115 const G4String& 115 const G4String& particleName, 116 G4bool 116 G4bool fActive ); 117 inline void SetProcessActivation( G4Proces 117 inline void SetProcessActivation( G4ProcessType processType, 118 const G4 118 const G4ParticleDefinition* particle, 119 G4bool 119 G4bool fActive ); 120 void SetProcessActivation( G4ProcessType 120 void SetProcessActivation( G4ProcessType processType, 121 G4ProcessManage 121 G4ProcessManager* processManager, 122 G4bool 122 G4bool fActive ); 123 // These methods are provided to activat 123 // These methods are provided to activate or inactivate processes 124 124 125 inline G4ProcNameVector* GetNameList(); 125 inline G4ProcNameVector* GetNameList(); 126 // Return pointer of the list of process 126 // Return pointer of the list of process name 127 127 128 inline G4ProcTableVector* GetProcTableVect 128 inline G4ProcTableVector* GetProcTableVector(); 129 // Return pointer of the vector of G4Pro 129 // Return pointer of the vector of G4ProcTblElement 130 130 131 void DumpInfo(G4VProcess* process, 131 void DumpInfo(G4VProcess* process, 132 const G4ParticleDefinition* 132 const G4ParticleDefinition* particle = nullptr); 133 // Dump out information of the process t 133 // Dump out information of the process table. The second argument 134 // is used to specify processes designat 134 // is used to specify processes designated by a particle 135 135 136 inline void SetVerboseLevel(G4int value); 136 inline void SetVerboseLevel(G4int value); 137 inline G4int GetVerboseLevel() const; 137 inline G4int GetVerboseLevel() const; 138 // Set/Get control flag for output messa 138 // Set/Get control flag for output message 139 // 0: Silent 139 // 0: Silent 140 // 1: Warning message 140 // 1: Warning message 141 // 2: More 141 // 2: More 142 142 143 private: 143 private: 144 144 145 G4ProcessTable(); 145 G4ProcessTable(); 146 // Private default constructor 146 // Private default constructor 147 147 148 G4ProcTableVector* Find(const G4String& pr 148 G4ProcTableVector* Find(const G4String& processName ); 149 G4ProcTableVector* Find(G4ProcessType pr 149 G4ProcTableVector* Find(G4ProcessType processType ); 150 // Return pointer of a ProcTableVector w 150 // Return pointer of a ProcTableVector which includes 151 // ProcTbleElement specified 151 // ProcTbleElement specified 152 152 153 G4ProcessVector* ExtractProcesses(G4ProcTa 153 G4ProcessVector* ExtractProcesses(G4ProcTableVector*) const; 154 // Extract all process objects from the 154 // Extract all process objects from the process table 155 155 156 private: 156 private: 157 157 158 static G4ThreadLocal G4ProcessTable* fProc 158 static G4ThreadLocal G4ProcessTable* fProcessTable; 159 G4ProcessTableMessenger* fProcTblMessenger 159 G4ProcessTableMessenger* fProcTblMessenger = nullptr; 160 160 161 G4ProcTableVector* fProcTblVector = nullpt 161 G4ProcTableVector* fProcTblVector = nullptr; 162 G4ProcNameVector* fProcNameVector = nullpt 162 G4ProcNameVector* fProcNameVector = nullptr; 163 163 164 G4ProcTableVector* tmpTblVector = nullptr; 164 G4ProcTableVector* tmpTblVector = nullptr; 165 // Used only internally as temporary buf 165 // Used only internally as temporary buffer 166 166 167 std::vector<G4VProcess*> fListProcesses; 167 std::vector<G4VProcess*> fListProcesses; 168 // Used for registration of process inst 168 // Used for registration of process instances 169 169 170 G4int verboseLevel = 1; 170 G4int verboseLevel = 1; 171 // Control flag for output message 171 // Control flag for output message 172 }; 172 }; 173 173 174 #include "G4ProcessTable.icc" 174 #include "G4ProcessTable.icc" 175 175 176 #endif 176 #endif 177 177