CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RunManagerMT.h
Go to the documentation of this file.
1 #ifndef SimG4Core_RunManagerMT_H
2 #define SimG4Core_RunManagerMT_H
3 
9 
11 
14 
15 #include <memory>
16 
17 namespace CLHEP {
18  class HepJamesRandom;
19 }
20 
21 namespace sim {
22  class FieldBuilder;
23  class ChordFinderSetter;
24 }
25 
26 class PrimaryTransformer;
27 class Generator;
28 class PhysicsList;
29 
30 class SimWatcher;
31 class SimProducer;
32 class G4SimEvent;
33 
34 class RunAction;
35 
36 class DDCompactView;
37 class DDDWorld;
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:
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  void abortRun(bool softAbort=false) {}
78 
79  const DDDWorld& world() const {
80  return *m_world;
81  }
82 
84  return m_catalog;
85  }
86 
87  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. Should we consider a friend declaration here in order
94  // to avoid misuse?
96  return m_physicsList.get();
97  }
98 
99  // In order to share the ChordFinderSetter (for
100  // G4MonopoleTransportation) with the worker threads, we need a
101  // non-const pointer. Thread-safety is handled inside
102  // ChordFinderStter with TLS. Should we consider a friend
103  // declaration here in order to avoid misuse?
105  return m_chordFinderSetter.get();
106  }
107 
108 private:
109  void terminateRun();
110  void DumpMagneticField( const G4Field*) const;
111 
112  G4MTRunManagerKernel * m_kernel;
113 
114  std::unique_ptr<PhysicsList> m_physicsList;
119  G4Run* m_currentRun;
120  std::unique_ptr<SimRunInterface> m_runInterface;
121 
125  bool m_check;
130  std::vector<std::string> m_G4Commands;
131 
132  std::unique_ptr<DDDWorld> m_world;
135 
137  std::unique_ptr<sim::ChordFinderSetter> m_chordFinderSetter;
138 
142 };
143 
144 #endif
void Connect(RunAction *)
const std::string m_PhysicsTablesDir
Definition: RunManagerMT.h:122
bool m_managerInitialized
Definition: RunManagerMT.h:115
const SensitiveDetectorCatalog & catalog() const
Definition: RunManagerMT.h:83
G4MTRunManagerKernel * m_kernel
Definition: RunManagerMT.h:112
SensitiveDetectorCatalog m_catalog
Definition: RunManagerMT.h:134
edm::ParameterSet m_pRunAction
Definition: RunManagerMT.h:128
HepPDT::ParticleDataTable ParticleDataTable
void initG4(const DDCompactView *pDD, const MagneticField *pMF, const HepPDT::ParticleDataTable *fPDGTable)
Definition: RunManagerMT.cc:95
void terminateRun()
void abortRun(bool softAbort=false)
Definition: RunManagerMT.h:77
bool m_runTerminated
Definition: RunManagerMT.h:116
sim::FieldBuilder * m_fieldBuilder
Definition: RunManagerMT.h:136
std::vector< std::string > m_G4Commands
Definition: RunManagerMT.h:130
G4Run * m_currentRun
Definition: RunManagerMT.h:119
std::string m_RegionFile
Definition: RunManagerMT.h:141
void initializeUserActions()
type of data representation of DDCompactView
Definition: DDCompactView.h:77
Definition: sim.h:19
std::string m_WriteFile
Definition: RunManagerMT.h:140
RunManagerMT(edm::ParameterSet const &p)
Definition: RunManagerMT.cc:60
const DDDWorld & world() const
Definition: RunManagerMT.h:79
bool m_pUseMagneticField
Definition: RunManagerMT.h:117
sim::ChordFinderSetter * chordFinderSetterForWorker() const
Definition: RunManagerMT.h:104
void DumpMagneticField(const G4Field *) const
bool m_StorePhysicsTables
Definition: RunManagerMT.h:123
std::unique_ptr< PhysicsList > m_physicsList
Definition: RunManagerMT.h:114
std::string m_FieldFile
Definition: RunManagerMT.h:139
edm::ParameterSet m_pField
Definition: RunManagerMT.h:126
std::unique_ptr< DDDWorld > m_world
Definition: RunManagerMT.h:132
PhysicsList * physicsListForWorker() const
Definition: RunManagerMT.h:95
edm::ParameterSet m_pPhysics
Definition: RunManagerMT.h:127
bool m_RestorePhysicsTables
Definition: RunManagerMT.h:124
std::unique_ptr< sim::ChordFinderSetter > m_chordFinderSetter
Definition: RunManagerMT.h:137
const std::vector< std::string > & G4Commands() const
Definition: RunManagerMT.h:87
std::unique_ptr< SimRunInterface > m_runInterface
Definition: RunManagerMT.h:120
edm::ParameterSet m_g4overlap
Definition: RunManagerMT.h:129
RunAction * m_userRunAction
Definition: RunManagerMT.h:118
SimActivityRegistry m_registry
Definition: RunManagerMT.h:133