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