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 class DDDWorld;
29 class DDG4ProductionCuts;
30 class MagneticField;
31 
32 class G4MTRunManagerKernel;
33 class G4Run;
34 class G4Event;
35 class G4Field;
36 class G4StateManager;
37 class G4GeometryManager;
38 class RunAction;
39 
40 class SimRunInterface;
41 
42 namespace HepPDT {
43  class ParticleDataTable;
44 }
45 
51 class RunManagerMTWorker;
52 
54 {
55  friend class RunManagerMTWorker;
56 
57 public:
58  explicit RunManagerMT(edm::ParameterSet const & p);
59  ~RunManagerMT();
60 
61  void initG4(const DDCompactView *pDD, const MagneticField *pMF, const HepPDT::ParticleDataTable *fPDGTable);
62 
63  void initializeUserActions();
64 
65  void stopG4();
66 
67  void Connect(RunAction*);
68 
69  // Keep this to keep ExceptionHandler to compile, probably removed
70  // later (or functionality moved to RunManagerMTWorker)
71  inline void abortRun(bool softAbort=false) {}
72 
73  inline const DDDWorld& world() const {
74  return *m_world;
75  }
76 
77  inline const SensitiveDetectorCatalog& catalog() const {
78  return m_catalog;
79  }
80 
81  inline const std::vector<std::string>& G4Commands() const {
82  return m_G4Commands;
83  }
84 
85  // In order to share the physics list with the worker threads, we
86  // need a non-const pointer. Thread-safety is handled inside Geant4
87  // with TLS.
89  return m_physicsList.get();
90  }
91 
92 private:
93  void terminateRun();
94  void DumpMagneticField( const G4Field*) const;
95 
96  G4MTRunManagerKernel * m_kernel;
97 
98  std::unique_ptr<CustomUIsession> m_UIsession;
99  std::unique_ptr<PhysicsList> m_physicsList;
104  G4Run* m_currentRun;
105  G4StateManager* m_stateManager;
106  G4GeometryManager* m_geometryManager;
107 
108  std::unique_ptr<SimRunInterface> m_runInterface;
109 
113  bool m_check;
118  std::vector<std::string> m_G4Commands;
120 
121  std::unique_ptr<DDDWorld> m_world;
122  std::unique_ptr<DDG4ProductionCuts> m_prodCuts;
125 
129 };
130 
131 #endif
const std::string m_PhysicsTablesDir
Definition: RunManagerMT.h:110
bool m_managerInitialized
Definition: RunManagerMT.h:100
const SensitiveDetectorCatalog & catalog() const
Definition: RunManagerMT.h:77
std::unique_ptr< DDG4ProductionCuts > m_prodCuts
Definition: RunManagerMT.h:122
G4MTRunManagerKernel * m_kernel
Definition: RunManagerMT.h:96
SensitiveDetectorCatalog m_catalog
Definition: RunManagerMT.h:124
edm::ParameterSet m_pRunAction
Definition: RunManagerMT.h:116
HepPDT::ParticleDataTable ParticleDataTable
void abortRun(bool softAbort=false)
Definition: RunManagerMT.h:71
bool m_runTerminated
Definition: RunManagerMT.h:101
G4StateManager * m_stateManager
Definition: RunManagerMT.h:105
std::vector< std::string > m_G4Commands
Definition: RunManagerMT.h:118
std::unique_ptr< CustomUIsession > m_UIsession
Definition: RunManagerMT.h:98
G4Run * m_currentRun
Definition: RunManagerMT.h:104
std::string m_RegionFile
Definition: RunManagerMT.h:128
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:80
std::string m_WriteFile
Definition: RunManagerMT.h:127
const DDDWorld & world() const
Definition: RunManagerMT.h:73
bool m_pUseMagneticField
Definition: RunManagerMT.h:102
edm::ParameterSet m_p
Definition: RunManagerMT.h:119
bool m_StorePhysicsTables
Definition: RunManagerMT.h:111
G4GeometryManager * m_geometryManager
Definition: RunManagerMT.h:106
std::unique_ptr< PhysicsList > m_physicsList
Definition: RunManagerMT.h:99
std::string m_FieldFile
Definition: RunManagerMT.h:126
edm::ParameterSet m_pField
Definition: RunManagerMT.h:114
std::unique_ptr< DDDWorld > m_world
Definition: RunManagerMT.h:121
PhysicsList * physicsListForWorker() const
Definition: RunManagerMT.h:88
edm::ParameterSet m_pPhysics
Definition: RunManagerMT.h:115
bool m_RestorePhysicsTables
Definition: RunManagerMT.h:112
const std::vector< std::string > & G4Commands() const
Definition: RunManagerMT.h:81
std::unique_ptr< SimRunInterface > m_runInterface
Definition: RunManagerMT.h:108
edm::ParameterSet m_g4overlap
Definition: RunManagerMT.h:117
RunAction * m_userRunAction
Definition: RunManagerMT.h:103
void Connect(RunAction *)
SimActivityRegistry m_registry
Definition: RunManagerMT.h:123