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