CMS 3D CMS Logo

RunManager.h
Go to the documentation of this file.
1 #ifndef SimG4Core_RunManager_H
2 #define SimG4Core_RunManager_H
3 
6 
8 
14 
17 
18 #include <memory>
19 
20 namespace edm {
21  class ParameterSet;
22  class Event;
23  class EventSetup;
24  class ConsumesCollector;
25  class HepMCProduct;
26 } // namespace edm
27 
28 class PrimaryTransformer;
29 class Generator;
30 class PhysicsList;
31 
32 class SimWatcher;
33 class SimProducer;
34 class G4SimEvent;
35 class SimTrackManager;
36 
37 class RunAction;
38 class EventAction;
39 class TrackingAction;
40 class SteppingAction;
41 class CMSSteppingVerbose;
42 
43 class DDDWorld;
44 class CustomUIsession;
45 
46 class G4RunManagerKernel;
47 class G4Run;
48 class G4Event;
49 class G4Field;
50 class RunAction;
51 
52 class SimRunInterface;
53 
54 class RunManager {
55 public:
57  ~RunManager();
58  void initG4(const edm::EventSetup& es);
59  void initializeUserActions();
60  void initializeRun();
61 
62  void stopG4();
63  void terminateRun();
64  void abortRun(bool softAbort = false);
65 
66  const G4Run* currentRun() const { return m_currentRun; }
67  void produce(edm::Event& inpevt, const edm::EventSetup& es);
68  void abortEvent();
69  const Generator* generator() const { return m_generator; }
70  const G4Event* currentEvent() const { return m_currentEvent; }
71  G4SimEvent* simEvent() { return m_simEvent; }
72  std::vector<SensitiveTkDetector*>& sensTkDetectors() { return m_sensTkDets; }
73  std::vector<SensitiveCaloDetector*>& sensCaloDetectors() { return m_sensCaloDets; }
74  std::vector<std::shared_ptr<SimProducer> > producers() const { return m_producers; }
75 
76  SimTrackManager* GetSimTrackManager();
77  void Connect(RunAction*);
78  void Connect(EventAction*);
79  void Connect(TrackingAction*);
80  void Connect(SteppingAction*);
81 
82 protected:
83  G4Event* generateEvent(edm::Event& inpevt);
84  void resetGenParticleId(edm::Event& inpevt);
85  void DumpMagneticField(const G4Field*) const;
86 
87 private:
88  G4RunManagerKernel* m_kernel;
89 
91 
94 
95  bool m_nonBeam;
96  std::unique_ptr<CustomUIsession> m_UIsession;
97  std::unique_ptr<PhysicsList> m_physicsList;
99 
104  bool firstRun;
107 
108  G4Run* m_currentRun;
109  G4Event* m_currentEvent;
113 
119  bool m_check;
129  std::vector<std::string> m_G4Commands;
131 
132  std::vector<SensitiveTkDetector*> m_sensTkDets;
133  std::vector<SensitiveCaloDetector*> m_sensCaloDets;
134 
135  std::unique_ptr<CMSSteppingVerbose> m_sVerbose;
137  std::vector<std::shared_ptr<SimWatcher> > m_watchers;
138  std::vector<std::shared_ptr<SimProducer> > m_producers;
139 
140  std::unique_ptr<SimTrackManager> m_trackManager;
141 
144 
148 };
149 
150 #endif
std::vector< SensitiveCaloDetector * > & sensCaloDetectors()
Definition: RunManager.h:73
bool m_check
Definition: RunManager.h:119
edm::ParameterSet m_pGenerator
Definition: RunManager.h:121
edm::EDGetTokenT< edm::HepMCProduct > m_HepMC
Definition: RunManager.h:92
std::vector< std::shared_ptr< SimProducer > > producers() const
Definition: RunManager.h:74
edm::ESWatcher< IdealMagneticFieldRecord > idealMagRcdWatcher_
Definition: RunManager.h:143
G4Event * m_currentEvent
Definition: RunManager.h:109
edm::EDGetTokenT< edm::LHCTransportLinkContainer > m_LHCtr
Definition: RunManager.h:93
SimActivityRegistry m_registry
Definition: RunManager.h:136
edm::ParameterSet m_p
Definition: RunManager.h:130
std::vector< std::shared_ptr< SimProducer > > m_producers
Definition: RunManager.h:138
const G4Event * currentEvent() const
Definition: RunManager.h:70
Generator * m_generator
Definition: RunManager.h:90
bool m_hasWatchers
Definition: RunManager.h:106
bool m_pUseMagneticField
Definition: RunManager.h:105
edm::ESWatcher< IdealGeometryRecord > idealGeomRcdWatcher_
Definition: RunManager.h:142
const Generator * generator() const
Definition: RunManager.h:69
std::vector< SensitiveTkDetector * > & sensTkDetectors()
Definition: RunManager.h:72
std::vector< SensitiveCaloDetector * > m_sensCaloDets
Definition: RunManager.h:133
std::vector< SensitiveTkDetector * > m_sensTkDets
Definition: RunManager.h:132
bool m_nonBeam
Definition: RunManager.h:95
int m_EvtMgrVerbosity
Definition: RunManager.h:118
std::string m_WriteFile
Definition: RunManager.h:146
const G4Run * currentRun() const
Definition: RunManager.h:66
bool firstRun
Definition: RunManager.h:104
SimRunInterface * m_runInterface
Definition: RunManager.h:112
bool m_UseParametrisedEMPhysics
Definition: RunManager.h:117
bool m_RestorePhysicsTables
Definition: RunManager.h:116
std::vector< std::shared_ptr< SimWatcher > > m_watchers
Definition: RunManager.h:137
std::unique_ptr< CMSSteppingVerbose > m_sVerbose
Definition: RunManager.h:135
G4Run * m_currentRun
Definition: RunManager.h:108
edm::ParameterSet m_pStackingAction
Definition: RunManager.h:125
edm::ParameterSet m_pEventAction
Definition: RunManager.h:124
bool m_runTerminated
Definition: RunManager.h:102
edm::ParameterSet m_pField
Definition: RunManager.h:120
edm::ParameterSet m_pPhysics
Definition: RunManager.h:122
edm::ParameterSet m_pSteppingAction
Definition: RunManager.h:127
edm::ParameterSet m_g4overlap
Definition: RunManager.h:128
RunAction * m_userRunAction
Definition: RunManager.h:111
bool m_runInitialized
Definition: RunManager.h:101
HLT enums.
G4SimEvent * simEvent()
Definition: RunManager.h:71
std::string m_RegionFile
Definition: RunManager.h:147
PrimaryTransformer * m_primaryTransformer
Definition: RunManager.h:98
std::string m_PhysicsTablesDir
Definition: RunManager.h:114
bool m_StorePhysicsTables
Definition: RunManager.h:115
std::unique_ptr< CustomUIsession > m_UIsession
Definition: RunManager.h:96
edm::ParameterSet m_pRunAction
Definition: RunManager.h:123
std::unique_ptr< SimTrackManager > m_trackManager
Definition: RunManager.h:140
edm::ParameterSet m_pTrackingAction
Definition: RunManager.h:126
std::vector< std::string > m_G4Commands
Definition: RunManager.h:129
std::string m_FieldFile
Definition: RunManager.h:145
std::unique_ptr< PhysicsList > m_physicsList
Definition: RunManager.h:97
G4SimEvent * m_simEvent
Definition: RunManager.h:110
bool m_managerInitialized
Definition: RunManager.h:100
G4RunManagerKernel * m_kernel
Definition: RunManager.h:88
bool m_runAborted
Definition: RunManager.h:103