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 namespace sim {
17  class ChordFinderSetter;
18 }
19 
20 class PrimaryTransformer;
21 class Generator;
22 class PhysicsList;
23 class CustomUIsession;
24 
25 class SimWatcher;
26 class SimProducer;
27 class G4SimEvent;
28 
29 class RunAction;
30 
31 class DDCompactView;
32 class DDDWorld;
33 class DDG4ProductionCuts;
34 class MagneticField;
35 
36 class G4MTRunManagerKernel;
37 class G4Run;
38 class G4Event;
39 class G4Field;
40 class RunAction;
41 
42 class SimRunInterface;
43 
44 namespace HepPDT {
45  class ParticleDataTable;
46 }
47 
53 class RunManagerMTWorker;
54 
56 {
57  friend class RunManagerMTWorker;
58 
59 public:
60  explicit RunManagerMT(edm::ParameterSet const & p);
61  ~RunManagerMT();
62 
63  void initG4(const DDCompactView *pDD, const MagneticField *pMF, const HepPDT::ParticleDataTable *fPDGTable);
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 {
76  return *m_world;
77  }
78 
79  inline const SensitiveDetectorCatalog& catalog() const {
80  return m_catalog;
81  }
82 
83  inline const std::vector<std::string>& G4Commands() const {
84  return m_G4Commands;
85  }
86 
87  // In order to share the physics list with the worker threads, we
88  // need a non-const pointer. Thread-safety is handled inside Geant4
89  // with TLS.
91  return m_physicsList.get();
92  }
93 
94 private:
95  void terminateRun();
96  void DumpMagneticField( const G4Field*) const;
97 
98  G4MTRunManagerKernel * m_kernel;
99 
100  std::unique_ptr<CustomUIsession> m_UIsession;
101  std::unique_ptr<PhysicsList> m_physicsList;
106  G4Run* m_currentRun;
107  std::unique_ptr<SimRunInterface> m_runInterface;
108 
112  bool m_check;
117  std::vector<std::string> m_G4Commands;
119 
120  std::unique_ptr<DDDWorld> m_world;
121  std::unique_ptr<DDG4ProductionCuts> m_prodCuts;
124 
125  std::unique_ptr<sim::ChordFinderSetter> m_chordFinderSetter;
126 
130 };
131 
132 #endif
const std::string m_PhysicsTablesDir
Definition: RunManagerMT.h:109
bool m_managerInitialized
Definition: RunManagerMT.h:102
const SensitiveDetectorCatalog & catalog() const
Definition: RunManagerMT.h:79
std::unique_ptr< DDG4ProductionCuts > m_prodCuts
Definition: RunManagerMT.h:121
G4MTRunManagerKernel * m_kernel
Definition: RunManagerMT.h:98
SensitiveDetectorCatalog m_catalog
Definition: RunManagerMT.h:123
edm::ParameterSet m_pRunAction
Definition: RunManagerMT.h:115
HepPDT::ParticleDataTable ParticleDataTable
void abortRun(bool softAbort=false)
Definition: RunManagerMT.h:73
bool m_runTerminated
Definition: RunManagerMT.h:103
std::vector< std::string > m_G4Commands
Definition: RunManagerMT.h:117
std::unique_ptr< CustomUIsession > m_UIsession
Definition: RunManagerMT.h:100
G4Run * m_currentRun
Definition: RunManagerMT.h:106
std::string m_RegionFile
Definition: RunManagerMT.h:129
type of data representation of DDCompactView
Definition: DDCompactView.h:90
std::string m_WriteFile
Definition: RunManagerMT.h:128
const DDDWorld & world() const
Definition: RunManagerMT.h:75
bool m_pUseMagneticField
Definition: RunManagerMT.h:104
edm::ParameterSet m_p
Definition: RunManagerMT.h:118
Definition: RunManager.h:28
bool m_StorePhysicsTables
Definition: RunManagerMT.h:110
std::unique_ptr< PhysicsList > m_physicsList
Definition: RunManagerMT.h:101
std::string m_FieldFile
Definition: RunManagerMT.h:127
edm::ParameterSet m_pField
Definition: RunManagerMT.h:113
std::unique_ptr< DDDWorld > m_world
Definition: RunManagerMT.h:120
PhysicsList * physicsListForWorker() const
Definition: RunManagerMT.h:90
edm::ParameterSet m_pPhysics
Definition: RunManagerMT.h:114
bool m_RestorePhysicsTables
Definition: RunManagerMT.h:111
std::unique_ptr< sim::ChordFinderSetter > m_chordFinderSetter
Definition: RunManagerMT.h:125
const std::vector< std::string > & G4Commands() const
Definition: RunManagerMT.h:83
std::unique_ptr< SimRunInterface > m_runInterface
Definition: RunManagerMT.h:107
edm::ParameterSet m_g4overlap
Definition: RunManagerMT.h:116
RunAction * m_userRunAction
Definition: RunManagerMT.h:105
void Connect(RunAction *)
SimActivityRegistry m_registry
Definition: RunManagerMT.h:122