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 
5 
8 
11 
14 
15 #include <memory>
16 #include <unordered_map>
17 #include <string>
18 
19 namespace edm {
20  class ParameterSet;
21  class Event;
22  class EventSetup;
23  class ConsumesCollector;
24  class HepMCProduct;
25 } // namespace edm
26 
27 class Generator;
28 class RunManagerMT;
29 
30 class G4Event;
31 class G4Run;
32 class SimTrackManager;
33 class CustomUIsession;
34 
35 class RunAction;
36 class EventAction;
37 class TrackingAction;
38 class SteppingAction;
40 class CMSSteppingVerbose;
41 class CMSSimEventManager;
42 class G4Field;
43 
47 
48 class SimWatcher;
49 class SimProducer;
50 
52 public:
53  explicit RunManagerMTWorker(const edm::ParameterSet& iConfig, edm::ConsumesCollector&& iC);
55 
56  void beginRun(const edm::EventSetup&);
57  void endRun();
58 
59  TmpSimEvent* produce(const edm::Event& inpevt, const edm::EventSetup& es, RunManagerMT& runManagerMaster);
60 
61  void abortEvent();
62  void abortRun(bool softAbort = false);
63 
64  void Connect(RunAction*);
65  void Connect(EventAction*);
66  void Connect(TrackingAction*);
67  void Connect(SteppingAction*);
69 
71  std::vector<SensitiveTkDetector*>& sensTkDetectors();
72  std::vector<SensitiveCaloDetector*>& sensCaloDetectors();
73  std::vector<std::shared_ptr<SimProducer>>& producers();
74 
75  void initializeG4(RunManagerMT* runManagerMaster, const edm::EventSetup& es);
76 
77  inline TmpSimEvent* simEvent() { return &m_simEvent; }
78  inline int getThreadIndex() const { return m_thread_index; }
79 
80 private:
81  void initializeTLS();
82  void initializeUserActions();
83  void initializeRun();
84  void terminateRun();
85 
86  G4Event* generateEvent(const edm::Event& inpevt);
87  void resetGenParticleId(const edm::Event& inpevt);
88 
89  void DumpMagneticField(const G4Field*, const std::string&) const;
90 
96  const MagneticField* m_pMagField{nullptr};
97 
98  bool m_nonBeam{false};
99  bool m_UseG4EventManager{true};
101  bool m_hasWatchers{false};
102  bool m_LHCTransport{false};
103  bool m_dumpMF{false};
104  bool m_dumpGDML{false};
105  bool m_endOfRun{false};
106  bool m_isPhase2{false};
107 
108  const int m_thread_index{-1};
109 
116  std::vector<std::string> m_G4Commands;
117  std::vector<std::string> m_G4CommandsEndRun;
119 
120  struct TLSData;
121  TLSData* m_tls{nullptr};
122 
125  std::unique_ptr<CMSSimEventManager> m_evtManager;
126  std::unique_ptr<CMSSteppingVerbose> m_sVerbose;
127  std::unordered_map<std::string, std::unique_ptr<SensitiveDetectorMakerBase>> m_sdMakers;
128 };
129 
130 #endif
edm::ParameterSet m_pSteppingAction
CustomUIsession * m_UIsession
std::unique_ptr< CMSSteppingVerbose > m_sVerbose
std::vector< std::string > m_G4Commands
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.
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 *)