CMS 3D CMS Logo

RunManagerMT.h
Go to the documentation of this file.
1 #ifndef SimG4Core_RunManagerMT_H
2 #define SimG4Core_RunManagerMT_H
3 
9 
11 
13 
14 #include <memory>
15 
16 class PrimaryTransformer;
17 class Generator;
18 class PhysicsList;
19 class CustomUIsession;
20 
21 class SimWatcher;
22 class SimProducer;
23 class G4SimEvent;
24 
25 class RunAction;
26 
27 class DDCompactView;
28 
29 namespace cms {
30  class DDCompactView;
31 }
32 
33 class DDDWorld;
34 
35 class G4MTRunManagerKernel;
36 class G4Run;
37 class G4Event;
38 class G4StateManager;
39 class G4GeometryManager;
40 class RunAction;
41 
42 class SimRunInterface;
43 
44 namespace HepPDT {
45  class ParticleDataTable;
46 }
47 
53 class RunManagerMTWorker;
54 
55 class RunManagerMT {
56  friend class RunManagerMTWorker;
57 
58 public:
59  explicit RunManagerMT(edm::ParameterSet const&);
60  ~RunManagerMT();
61 
62  // void initG4(const DDCompactView*, const cms::DDCompactView*, const MagneticField*, const HepPDT::ParticleDataTable*);
63  void initG4(const DDCompactView*, const cms::DDCompactView*, const HepPDT::ParticleDataTable*);
64 
65  void initializeUserActions();
66 
67  void stopG4();
68 
69  void Connect(RunAction*);
70 
71  // Keep this to keep ExceptionHandler to compile, probably removed
72  // later (or functionality moved to RunManagerMTWorker)
73  inline void abortRun(bool softAbort = false) {}
74 
75  inline const DDDWorld& world() const { return *m_world; }
76 
77  inline const SensitiveDetectorCatalog& catalog() const { return m_catalog; }
78 
79  inline const std::vector<std::string>& G4Commands() const { return m_G4Commands; }
80 
81  // In order to share the physics list with the worker threads, we
82  // need a non-const pointer. Thread-safety is handled inside Geant4
83  // with TLS.
84  inline PhysicsList* physicsListForWorker() const { return m_physicsList.get(); }
85 
86 private:
87  void terminateRun();
88 
89  G4MTRunManagerKernel* m_kernel;
90 
91  std::unique_ptr<CustomUIsession> m_UIsession;
92  std::unique_ptr<PhysicsList> m_physicsList;
96  G4Run* m_currentRun;
97  G4StateManager* m_stateManager;
98  G4GeometryManager* m_geometryManager;
99 
100  std::unique_ptr<SimRunInterface> m_runInterface;
101 
106  bool m_check;
110  std::vector<std::string> m_G4Commands;
112 
113  std::unique_ptr<DDDWorld> m_world;
116 };
117 
118 #endif
bool m_UseParametrisedEMPhysics
Definition: RunManagerMT.h:105
const std::string m_PhysicsTablesDir
Definition: RunManagerMT.h:102
bool m_managerInitialized
Definition: RunManagerMT.h:93
const SensitiveDetectorCatalog & catalog() const
Definition: RunManagerMT.h:77
G4MTRunManagerKernel * m_kernel
Definition: RunManagerMT.h:89
SensitiveDetectorCatalog m_catalog
Definition: RunManagerMT.h:115
edm::ParameterSet m_pRunAction
Definition: RunManagerMT.h:108
HepPDT::ParticleDataTable ParticleDataTable
void abortRun(bool softAbort=false)
Definition: RunManagerMT.h:73
bool m_runTerminated
Definition: RunManagerMT.h:94
G4StateManager * m_stateManager
Definition: RunManagerMT.h:97
std::vector< std::string > m_G4Commands
Definition: RunManagerMT.h:110
std::unique_ptr< CustomUIsession > m_UIsession
Definition: RunManagerMT.h:91
G4Run * m_currentRun
Definition: RunManagerMT.h:96
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:80
const DDDWorld & world() const
Definition: RunManagerMT.h:75
edm::ParameterSet m_p
Definition: RunManagerMT.h:111
Namespace of DDCMS conversion namespace.
bool m_StorePhysicsTables
Definition: RunManagerMT.h:103
G4GeometryManager * m_geometryManager
Definition: RunManagerMT.h:98
std::unique_ptr< PhysicsList > m_physicsList
Definition: RunManagerMT.h:92
std::unique_ptr< DDDWorld > m_world
Definition: RunManagerMT.h:113
PhysicsList * physicsListForWorker() const
Definition: RunManagerMT.h:84
edm::ParameterSet m_pPhysics
Definition: RunManagerMT.h:107
bool m_RestorePhysicsTables
Definition: RunManagerMT.h:104
const std::vector< std::string > & G4Commands() const
Definition: RunManagerMT.h:79
std::unique_ptr< SimRunInterface > m_runInterface
Definition: RunManagerMT.h:100
edm::ParameterSet m_g4overlap
Definition: RunManagerMT.h:109
RunAction * m_userRunAction
Definition: RunManagerMT.h:95
void Connect(RunAction *)
SimActivityRegistry m_registry
Definition: RunManagerMT.h:114