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