Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:58

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 // G4ProcessTable
0027 //
0028 // Class description:
0029 //
0030 // This class is used for "book keeping" of all processes 
0031 // which are registered for all particles
0032 
0033 // Author: H.Kurashige, 4 August 1998
0034 // --------------------------------------------------------------------
0035 #ifndef G4ProcessTable_hh
0036 #define G4ProcessTable_hh 1
0037 
0038 #include <vector>
0039 
0040 #include "globals.hh"
0041 #include "G4ProcTblElement.hh"
0042 #include "G4ProcessVector.hh"
0043 #include "G4ThreadLocalSingleton.hh"
0044 
0045 class G4UImessenger;
0046 class G4ProcessTableMessenger;
0047 
0048 class G4ProcessTable
0049 {
0050   friend class G4ThreadLocalSingleton<G4ProcessTable>;
0051 
0052   public:
0053 
0054     using G4ProcTableVector = std::vector<G4ProcTblElement*>;
0055     using G4ProcNameVector = std::vector<G4String>;
0056 
0057     ~G4ProcessTable();
0058       // Destructor
0059   
0060     G4ProcessTable(const G4ProcessTable&) = delete;
0061     G4ProcessTable& operator=(const G4ProcessTable&) = delete;
0062     G4bool operator==(const G4ProcessTable &right) const = delete;
0063     G4bool operator!=(const G4ProcessTable &right) const = delete;
0064       // Copy constructor and operators not allowed  
0065  
0066     static G4ProcessTable* GetProcessTable();
0067       // Return the pointer to the G4ProcessTable object
0068       // As "singleton" one can get the instance pointer by this function
0069 
0070     inline G4int Length() const;
0071       // Return the number of processes in the table
0072 
0073     G4int Insert(G4VProcess* aProcess, G4ProcessManager* aProcMgr);
0074     G4int Remove(G4VProcess* aProcess, G4ProcessManager* aProcMgr);  
0075       // Each process object is registered with information of process
0076       // managers that use it
0077 
0078     G4VProcess* FindProcess(const G4String& processName, 
0079                             const G4String& particleName) const;
0080     inline G4VProcess* FindProcess(const G4String& processName, 
0081                                    const G4ParticleDefinition* particle) const;
0082     G4VProcess* FindProcess(const G4String& processName, 
0083                             const G4ProcessManager* processManager) const;
0084     G4VProcess* FindProcess(G4ProcessType processType, 
0085                             const G4ParticleDefinition* particle) const;
0086     G4VProcess* FindProcess(G4int processSubType, 
0087                             const G4ParticleDefinition* particle) const;
0088       // Return the process pointer
0089 
0090     void RegisterProcess(G4VProcess*);
0091     void DeRegisterProcess(G4VProcess*);
0092       // Implementation of registration mechanism
0093   
0094     inline G4ProcessVector* FindProcesses();
0095     inline G4ProcessVector* FindProcesses( const G4ProcessManager* pManager );
0096     inline G4ProcessVector* FindProcesses( const G4String& processName );
0097     inline G4ProcessVector* FindProcesses( G4ProcessType processType );
0098       // Return pointer of a process vector which includes processes specified
0099       // Note: user is responsible to delete this process vector object  
0100 
0101     void SetProcessActivation( const G4String& processName, 
0102                                G4bool          fActive );
0103     void SetProcessActivation( const G4String& processName, 
0104                                const G4String& particleName, 
0105                                G4bool          fActive );
0106     inline void SetProcessActivation( const G4String& processName, 
0107                                       const G4ParticleDefinition* particle, 
0108                                       G4bool          fActive );
0109     void SetProcessActivation( const G4String& processName, 
0110                                G4ProcessManager* processManager, 
0111                                G4bool          fActive );
0112     void SetProcessActivation( G4ProcessType   processType, 
0113                                G4bool          fActive );
0114     void SetProcessActivation( G4ProcessType   processType,
0115                                const G4String& particleName, 
0116                                G4bool          fActive );
0117     inline void SetProcessActivation( G4ProcessType   processType,
0118                                       const G4ParticleDefinition* particle, 
0119                                       G4bool          fActive );
0120     void SetProcessActivation( G4ProcessType   processType,
0121                                G4ProcessManager* processManager, 
0122                                G4bool          fActive );
0123       // These methods are provided to activate or inactivate processes
0124 
0125     inline G4ProcNameVector* GetNameList();
0126       // Return pointer of the list of process name
0127 
0128     inline G4ProcTableVector* GetProcTableVector();
0129       // Return pointer of the vector of G4ProcTblElement
0130 
0131     void DumpInfo(G4VProcess* process, 
0132                   const G4ParticleDefinition* particle = nullptr);
0133       // Dump out information of the process table. The second argument
0134       // is used to specify processes designated by a particle 
0135     
0136     inline void  SetVerboseLevel(G4int value);
0137     inline G4int GetVerboseLevel() const;
0138       // Set/Get control flag for output message
0139       //  0: Silent
0140       //  1: Warning message
0141       //  2: More
0142 
0143   private:
0144 
0145     G4ProcessTable();
0146       // Private default constructor
0147   
0148     G4ProcTableVector* Find(const G4String& processName );
0149     G4ProcTableVector* Find(G4ProcessType   processType );
0150       // Return pointer of a ProcTableVector which includes
0151       // ProcTbleElement specified
0152 
0153     G4ProcessVector* ExtractProcesses(G4ProcTableVector*) const;
0154       // Extract all process objects from the process table 
0155  
0156   private:
0157 
0158     static G4ThreadLocal G4ProcessTable* fProcessTable;
0159     G4ProcessTableMessenger* fProcTblMessenger = nullptr;
0160 
0161     G4ProcTableVector* fProcTblVector = nullptr;
0162     G4ProcNameVector* fProcNameVector = nullptr;
0163   
0164     G4ProcTableVector* tmpTblVector = nullptr;
0165       // Used only internally as temporary buffer
0166 
0167     std::vector<G4VProcess*> fListProcesses;
0168       // Used for registration of process instances
0169 
0170     G4int verboseLevel = 1;
0171       // Control flag for output message
0172 };
0173 
0174 #include "G4ProcessTable.icc"
0175 
0176 #endif