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