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