Geant4 Cross Reference |
1 // 2 // ******************************************************************** 3 // * License and Disclaimer * 4 // * * 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. * 10 // * * 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitation of liability. * 17 // * * 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************************************** 25 // 26 // G4ProcessTable 27 // 28 // Class description: 29 // 30 // This class is used for "book keeping" of all processes 31 // which are registered for all particles 32 33 // Author: H.Kurashige, 4 August 1998 34 // -------------------------------------------------------------------- 35 #ifndef G4ProcessTable_hh 36 #define G4ProcessTable_hh 1 37 38 #include <vector> 39 40 #include "globals.hh" 41 #include "G4ProcTblElement.hh" 42 #include "G4ProcessVector.hh" 43 #include "G4ThreadLocalSingleton.hh" 44 45 class G4UImessenger; 46 class G4ProcessTableMessenger; 47 48 class G4ProcessTable 49 { 50 friend class G4ThreadLocalSingleton<G4ProcessTable>; 51 52 public: 53 54 using G4ProcTableVector = std::vector<G4ProcTblElement*>; 55 using G4ProcNameVector = std::vector<G4String>; 56 57 ~G4ProcessTable(); 58 // Destructor 59 60 G4ProcessTable(const G4ProcessTable&) = delete; 61 G4ProcessTable& operator=(const G4ProcessTable&) = delete; 62 G4bool operator==(const G4ProcessTable &right) const = delete; 63 G4bool operator!=(const G4ProcessTable &right) const = delete; 64 // Copy constructor and operators not allowed 65 66 static G4ProcessTable* GetProcessTable(); 67 // Return the pointer to the G4ProcessTable object 68 // As "singleton" one can get the instance pointer by this function 69 70 inline G4int Length() const; 71 // Return the number of processes in the table 72 73 G4int Insert(G4VProcess* aProcess, G4ProcessManager* aProcMgr); 74 G4int Remove(G4VProcess* aProcess, G4ProcessManager* aProcMgr); 75 // Each process object is registered with information of process 76 // managers that use it 77 78 G4VProcess* FindProcess(const G4String& processName, 79 const G4String& particleName) const; 80 inline G4VProcess* FindProcess(const G4String& processName, 81 const G4ParticleDefinition* particle) const; 82 G4VProcess* FindProcess(const G4String& processName, 83 const G4ProcessManager* processManager) const; 84 G4VProcess* FindProcess(G4ProcessType processType, 85 const G4ParticleDefinition* particle) const; 86 G4VProcess* FindProcess(G4int processSubType, 87 const G4ParticleDefinition* particle) const; 88 // Return the process pointer 89 90 void RegisterProcess(G4VProcess*); 91 void DeRegisterProcess(G4VProcess*); 92 // Implementation of registration mechanism 93 94 inline G4ProcessVector* FindProcesses(); 95 inline G4ProcessVector* FindProcesses( const G4ProcessManager* pManager ); 96 inline G4ProcessVector* FindProcesses( const G4String& processName ); 97 inline G4ProcessVector* FindProcesses( G4ProcessType processType ); 98 // Return pointer of a process vector which includes processes specified 99 // Note: user is responsible to delete this process vector object 100 101 void SetProcessActivation( const G4String& processName, 102 G4bool fActive ); 103 void SetProcessActivation( const G4String& processName, 104 const G4String& particleName, 105 G4bool fActive ); 106 inline void SetProcessActivation( const G4String& processName, 107 const G4ParticleDefinition* particle, 108 G4bool fActive ); 109 void SetProcessActivation( const G4String& processName, 110 G4ProcessManager* processManager, 111 G4bool fActive ); 112 void SetProcessActivation( G4ProcessType processType, 113 G4bool fActive ); 114 void SetProcessActivation( G4ProcessType processType, 115 const G4String& particleName, 116 G4bool fActive ); 117 inline void SetProcessActivation( G4ProcessType processType, 118 const G4ParticleDefinition* particle, 119 G4bool fActive ); 120 void SetProcessActivation( G4ProcessType processType, 121 G4ProcessManager* processManager, 122 G4bool fActive ); 123 // These methods are provided to activate or inactivate processes 124 125 inline G4ProcNameVector* GetNameList(); 126 // Return pointer of the list of process name 127 128 inline G4ProcTableVector* GetProcTableVector(); 129 // Return pointer of the vector of G4ProcTblElement 130 131 void DumpInfo(G4VProcess* process, 132 const G4ParticleDefinition* particle = nullptr); 133 // Dump out information of the process table. The second argument 134 // is used to specify processes designated by a particle 135 136 inline void SetVerboseLevel(G4int value); 137 inline G4int GetVerboseLevel() const; 138 // Set/Get control flag for output message 139 // 0: Silent 140 // 1: Warning message 141 // 2: More 142 143 private: 144 145 G4ProcessTable(); 146 // Private default constructor 147 148 G4ProcTableVector* Find(const G4String& processName ); 149 G4ProcTableVector* Find(G4ProcessType processType ); 150 // Return pointer of a ProcTableVector which includes 151 // ProcTbleElement specified 152 153 G4ProcessVector* ExtractProcesses(G4ProcTableVector*) const; 154 // Extract all process objects from the process table 155 156 private: 157 158 static G4ThreadLocal G4ProcessTable* fProcessTable; 159 G4ProcessTableMessenger* fProcTblMessenger = nullptr; 160 161 G4ProcTableVector* fProcTblVector = nullptr; 162 G4ProcNameVector* fProcNameVector = nullptr; 163 164 G4ProcTableVector* tmpTblVector = nullptr; 165 // Used only internally as temporary buffer 166 167 std::vector<G4VProcess*> fListProcesses; 168 // Used for registration of process instances 169 170 G4int verboseLevel = 1; 171 // Control flag for output message 172 }; 173 174 #include "G4ProcessTable.icc" 175 176 #endif 177