CMS 3D CMS Logo

RunManagerMTWorker.h
Go to the documentation of this file.
1 #ifndef SimG4Core_Application_RunManagerMTWorker_H
2 #define SimG4Core_Application_RunManagerMTWorker_H
3 
6 
9 
13 
14 #include <memory>
15 #include <unordered_map>
16 #include <string>
17 
18 namespace edm {
19  class ParameterSet;
20  class Event;
21  class EventSetup;
22  class ConsumesCollector;
23  class HepMCProduct;
24 } // namespace edm
25 
26 class Generator;
27 class RunManagerMT;
28 
29 class G4Event;
30 class G4Run;
31 class SimTrackManager;
32 class CustomUIsession;
33 
34 class RunAction;
35 class EventAction;
36 class TrackingAction;
37 class SteppingAction;
39 class CMSSteppingVerbose;
40 class CMSSimEventManager;
41 class G4Field;
42 
46 
47 class SimWatcher;
48 class SimProducer;
49 
51 public:
52  explicit RunManagerMTWorker(const edm::ParameterSet& iConfig, edm::ConsumesCollector&& iC);
54 
55  void beginRun(const edm::EventSetup&);
56  void endRun();
57 
58  TmpSimEvent* produce(const edm::Event& inpevt, const edm::EventSetup& es, RunManagerMT& runManagerMaster);
59 
60  void abortEvent();
61  void abortRun(bool softAbort = false);
62 
63  void Connect(RunAction*);
64  void Connect(EventAction*);
65  void Connect(TrackingAction*);
66  void Connect(SteppingAction*);
68 
70  std::vector<SensitiveTkDetector*>& sensTkDetectors();
71  std::vector<SensitiveCaloDetector*>& sensCaloDetectors();
72  std::vector<std::shared_ptr<SimProducer>>& producers();
73 
74  void initializeG4(RunManagerMT* runManagerMaster, const edm::EventSetup& es);
75 
76  inline TmpSimEvent* simEvent() { return &m_simEvent; }
77  inline int getThreadIndex() const { return m_thread_index; }
78 
79 private:
80  void initializeTLS();
81  void initializeUserActions();
82  void initializeRun();
83  void terminateRun();
84 
85  G4Event* generateEvent(const edm::Event& inpevt);
86  void resetGenParticleId(const edm::Event& inpevt);
87 
88  void DumpMagneticField(const G4Field*, const std::string&) const;
89 
95  const MagneticField* m_pMagField{nullptr};
96 
97  bool m_nonBeam{false};
98  bool m_UseG4EventManager{true};
99  bool m_pUseMagneticField{true};
100  bool m_hasWatchers{false};
101  bool m_LHCTransport{false};
102  bool m_dumpMF{false};
103  bool m_endOfRun{false};
104  bool m_isPhase2{false};
105 
106  const int m_thread_index{-1};
107 
115  std::vector<std::string> m_G4CommandsEndRun;
117 
118  struct TLSData;
119  TLSData* m_tls{nullptr};
120 
123  std::unique_ptr<CMSSimEventManager> m_evtManager;
124  std::unique_ptr<CMSSteppingVerbose> m_sVerbose;
125  std::unordered_map<std::string, std::unique_ptr<SensitiveDetectorMakerBase>> m_sdMakers;
126 };
127 
128 #endif
edm::ParameterSet m_pSteppingAction
CustomUIsession * m_UIsession
std::unique_ptr< CMSSteppingVerbose > m_sVerbose
void beginRun(const edm::EventSetup &)
edm::EDGetTokenT< edm::HepMCProduct > m_InToken
std::vector< std::string > m_G4CommandsEndRun
std::unique_ptr< CMSSimEventManager > m_evtManager
edm::EDGetTokenT< edm::HepMCProduct > m_LHCToken
edm::ParameterSet m_pEventAction
edm::ParameterSet m_pRunAction
std::unordered_map< std::string, std::unique_ptr< SensitiveDetectorMakerBase > > m_sdMakers
std::vector< SensitiveTkDetector * > & sensTkDetectors()
void resetGenParticleId(const edm::Event &inpevt)
RunManagerMTWorker(const edm::ParameterSet &iConfig, edm::ConsumesCollector &&iC)
void abortRun(bool softAbort=false)
TmpSimEvent * produce(const edm::Event &inpevt, const edm::EventSetup &es, RunManagerMT &runManagerMaster)
std::vector< SensitiveCaloDetector * > & sensCaloDetectors()
edm::ParameterSet m_pTrackingAction
SimTrackManager * getSimTrackManager()
edm::ParameterSet m_pField
G4Event * generateEvent(const edm::Event &inpevt)
std::vector< std::shared_ptr< SimProducer > > & producers()
edm::EDGetTokenT< edm::LHCTransportLinkContainer > m_theLHCTlinkToken
HLT enums.
edm::ParameterSet m_pCustomUIsession
const MagneticField * m_pMagField
TmpSimEvent * simEvent()
void initializeG4(RunManagerMT *runManagerMaster, const edm::EventSetup &es)
edm::ParameterSet m_p
void DumpMagneticField(const G4Field *, const std::string &) const
int getThreadIndex() const
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > m_MagField
edm::ParameterSet m_pStackingAction
void Connect(RunAction *)