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 }
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 DDG4ProductionCuts;
45 class CustomUIsession;
46 
47 class G4RunManagerKernel;
48 class G4Run;
49 class G4Event;
50 class G4Field;
51 class RunAction;
52 
53 class SimRunInterface;
54 
56 {
57 public:
58 
60  ~RunManager();
61  void initG4(const edm::EventSetup & es);
62  void initializeUserActions();
63  void initializeRun();
64 
65  void stopG4();
66  void terminateRun();
67  void abortRun(bool softAbort=false);
68 
69  const G4Run * currentRun() const { return m_currentRun; }
70  void produce(edm::Event& inpevt, const edm::EventSetup& es);
71  void abortEvent();
72  const Generator * generator() const { return m_generator; }
73  const G4Event * currentEvent() const { return m_currentEvent; }
74  G4SimEvent * simEvent() { return m_simEvent; }
75  std::vector<SensitiveTkDetector*>& sensTkDetectors() {
76  return m_sensTkDets;
77  }
78  std::vector<SensitiveCaloDetector*>& sensCaloDetectors() {
79  return m_sensCaloDets;
80  }
81  std::vector<std::shared_ptr<SimProducer> > producers() const {
82  return m_producers;
83  }
84 
85  SimTrackManager* GetSimTrackManager();
86  void Connect(RunAction*);
87  void Connect(EventAction*);
88  void Connect(TrackingAction*);
89  void Connect(SteppingAction*);
90 
91 protected:
92 
93  G4Event * generateEvent( edm::Event& inpevt );
94  void resetGenParticleId( edm::Event& inpevt );
95  void DumpMagneticField( const G4Field*) const;
96 
97 private:
98 
99  G4RunManagerKernel * m_kernel;
100 
102 
105 
106  bool m_nonBeam;
107  std::unique_ptr<CustomUIsession> m_UIsession;
108  std::unique_ptr<PhysicsList> m_physicsList;
110 
115  bool firstRun;
118 
119  G4Run * m_currentRun;
120  G4Event * m_currentEvent;
124 
129  bool m_check;
139  std::vector<std::string> m_G4Commands;
141 
143  std::vector<SensitiveTkDetector*> m_sensTkDets;
144  std::vector<SensitiveCaloDetector*> m_sensCaloDets;
145 
146  std::unique_ptr<DDG4ProductionCuts> m_prodCuts;
147  std::unique_ptr<CMSSteppingVerbose> m_sVerbose;
149  std::vector<std::shared_ptr<SimWatcher> > m_watchers;
150  std::vector<std::shared_ptr<SimProducer> > m_producers;
151 
152  std::unique_ptr<SimTrackManager> m_trackManager;
153 
156 
160 };
161 
162 #endif
std::vector< SensitiveCaloDetector * > & sensCaloDetectors()
Definition: RunManager.h:78
bool m_check
Definition: RunManager.h:129
edm::ParameterSet m_pGenerator
Definition: RunManager.h:131
edm::EDGetTokenT< edm::HepMCProduct > m_HepMC
Definition: RunManager.h:103
std::vector< std::shared_ptr< SimProducer > > producers() const
Definition: RunManager.h:81
edm::ESWatcher< IdealMagneticFieldRecord > idealMagRcdWatcher_
Definition: RunManager.h:155
G4Event * m_currentEvent
Definition: RunManager.h:120
edm::EDGetTokenT< edm::LHCTransportLinkContainer > m_LHCtr
Definition: RunManager.h:104
SimActivityRegistry m_registry
Definition: RunManager.h:148
edm::ParameterSet m_p
Definition: RunManager.h:140
std::vector< std::shared_ptr< SimProducer > > m_producers
Definition: RunManager.h:150
const G4Event * currentEvent() const
Definition: RunManager.h:73
Generator * m_generator
Definition: RunManager.h:101
bool m_hasWatchers
Definition: RunManager.h:117
bool m_pUseMagneticField
Definition: RunManager.h:116
edm::ESWatcher< IdealGeometryRecord > idealGeomRcdWatcher_
Definition: RunManager.h:154
const Generator * generator() const
Definition: RunManager.h:72
std::vector< SensitiveTkDetector * > & sensTkDetectors()
Definition: RunManager.h:75
std::vector< SensitiveCaloDetector * > m_sensCaloDets
Definition: RunManager.h:144
std::vector< SensitiveTkDetector * > m_sensTkDets
Definition: RunManager.h:143
bool m_nonBeam
Definition: RunManager.h:106
int m_EvtMgrVerbosity
Definition: RunManager.h:128
std::string m_WriteFile
Definition: RunManager.h:158
const G4Run * currentRun() const
Definition: RunManager.h:69
bool firstRun
Definition: RunManager.h:115
SimRunInterface * m_runInterface
Definition: RunManager.h:123
bool m_RestorePhysicsTables
Definition: RunManager.h:127
std::vector< std::shared_ptr< SimWatcher > > m_watchers
Definition: RunManager.h:149
std::unique_ptr< CMSSteppingVerbose > m_sVerbose
Definition: RunManager.h:147
G4Run * m_currentRun
Definition: RunManager.h:119
edm::ParameterSet m_pStackingAction
Definition: RunManager.h:135
edm::ParameterSet m_pEventAction
Definition: RunManager.h:134
bool m_runTerminated
Definition: RunManager.h:113
edm::ParameterSet m_pField
Definition: RunManager.h:130
edm::ParameterSet m_pPhysics
Definition: RunManager.h:132
edm::ParameterSet m_pSteppingAction
Definition: RunManager.h:137
edm::ParameterSet m_g4overlap
Definition: RunManager.h:138
RunAction * m_userRunAction
Definition: RunManager.h:122
bool m_runInitialized
Definition: RunManager.h:112
HLT enums.
G4SimEvent * simEvent()
Definition: RunManager.h:74
std::string m_RegionFile
Definition: RunManager.h:159
AttachSD * m_attach
Definition: RunManager.h:142
PrimaryTransformer * m_primaryTransformer
Definition: RunManager.h:109
std::string m_PhysicsTablesDir
Definition: RunManager.h:125
bool m_StorePhysicsTables
Definition: RunManager.h:126
std::unique_ptr< CustomUIsession > m_UIsession
Definition: RunManager.h:107
std::unique_ptr< DDG4ProductionCuts > m_prodCuts
Definition: RunManager.h:146
edm::ParameterSet m_pRunAction
Definition: RunManager.h:133
std::unique_ptr< SimTrackManager > m_trackManager
Definition: RunManager.h:152
edm::ParameterSet m_pTrackingAction
Definition: RunManager.h:136
std::vector< std::string > m_G4Commands
Definition: RunManager.h:139
std::string m_FieldFile
Definition: RunManager.h:157
std::unique_ptr< PhysicsList > m_physicsList
Definition: RunManager.h:108
G4SimEvent * m_simEvent
Definition: RunManager.h:121
bool m_managerInitialized
Definition: RunManager.h:111
G4RunManagerKernel * m_kernel
Definition: RunManager.h:99
bool m_runAborted
Definition: RunManager.h:114