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