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 
112 
113  bool m_nonBeam;
114  std::unique_ptr<CustomUIsession> m_UIsession;
115  std::unique_ptr<PhysicsList> m_physicsList;
117 
122  bool firstRun;
125 
126  G4Run * m_currentRun;
127  G4Event * m_currentEvent;
131 
136  bool m_check;
148  std::vector<std::string> m_G4Commands;
150 
152  std::vector<SensitiveTkDetector*> m_sensTkDets;
153  std::vector<SensitiveCaloDetector*> m_sensCaloDets;
154 
155  std::unique_ptr<DDG4ProductionCuts> m_prodCuts;
156  std::unique_ptr<CMSSteppingVerbose> m_sVerbose;
158  std::vector<std::shared_ptr<SimWatcher> > m_watchers;
159  std::vector<std::shared_ptr<SimProducer> > m_producers;
160 
161  std::unique_ptr<SimTrackManager> m_trackManager;
163 
166 
170 };
171 
172 #endif
std::vector< SensitiveCaloDetector * > & sensCaloDetectors()
Definition: RunManager.h:86
bool m_check
Definition: RunManager.h:136
edm::ParameterSet m_pGenerator
Definition: RunManager.h:139
edm::EDGetTokenT< edm::HepMCProduct > m_HepMC
Definition: RunManager.h:110
std::vector< std::shared_ptr< SimProducer > > producers() const
Definition: RunManager.h:89
edm::ESWatcher< IdealMagneticFieldRecord > idealMagRcdWatcher_
Definition: RunManager.h:165
G4Event * m_currentEvent
Definition: RunManager.h:127
edm::EDGetTokenT< edm::LHCTransportLinkContainer > m_LHCtr
Definition: RunManager.h:111
SimActivityRegistry m_registry
Definition: RunManager.h:157
edm::ParameterSet m_p
Definition: RunManager.h:149
std::vector< std::shared_ptr< SimProducer > > m_producers
Definition: RunManager.h:159
const G4Event * currentEvent() const
Definition: RunManager.h:81
Generator * m_generator
Definition: RunManager.h:109
bool m_hasWatchers
Definition: RunManager.h:124
bool m_pUseMagneticField
Definition: RunManager.h:123
edm::ESWatcher< IdealGeometryRecord > idealGeomRcdWatcher_
Definition: RunManager.h:164
const Generator * generator() const
Definition: RunManager.h:80
std::vector< SensitiveTkDetector * > & sensTkDetectors()
Definition: RunManager.h:83
std::vector< SensitiveCaloDetector * > m_sensCaloDets
Definition: RunManager.h:153
std::vector< SensitiveTkDetector * > m_sensTkDets
Definition: RunManager.h:152
bool m_nonBeam
Definition: RunManager.h:113
int m_EvtMgrVerbosity
Definition: RunManager.h:135
std::string m_WriteFile
Definition: RunManager.h:168
const G4Run * currentRun() const
Definition: RunManager.h:77
bool firstRun
Definition: RunManager.h:122
SimRunInterface * m_runInterface
Definition: RunManager.h:130
bool m_RestorePhysicsTables
Definition: RunManager.h:134
std::vector< std::shared_ptr< SimWatcher > > m_watchers
Definition: RunManager.h:158
std::unique_ptr< CMSSteppingVerbose > m_sVerbose
Definition: RunManager.h:156
G4Run * m_currentRun
Definition: RunManager.h:126
edm::ParameterSet m_pStackingAction
Definition: RunManager.h:144
Definition: RunManager.h:32
edm::ParameterSet m_pEventAction
Definition: RunManager.h:143
bool m_runTerminated
Definition: RunManager.h:120
edm::ParameterSet m_pField
Definition: RunManager.h:138
edm::ParameterSet m_pPhysics
Definition: RunManager.h:141
edm::ParameterSet m_pVertexGenerator
Definition: RunManager.h:140
edm::ParameterSet m_pSteppingAction
Definition: RunManager.h:146
edm::ParameterSet m_g4overlap
Definition: RunManager.h:147
RunAction * m_userRunAction
Definition: RunManager.h:129
bool m_runInitialized
Definition: RunManager.h:119
sim::ChordFinderSetter * m_chordFinderSetter
Definition: RunManager.h:162
HLT enums.
G4SimEvent * simEvent()
Definition: RunManager.h:82
std::string m_RegionFile
Definition: RunManager.h:169
AttachSD * m_attach
Definition: RunManager.h:151
PrimaryTransformer * m_primaryTransformer
Definition: RunManager.h:116
std::string m_PhysicsTablesDir
Definition: RunManager.h:132
bool m_StorePhysicsTables
Definition: RunManager.h:133
std::unique_ptr< CustomUIsession > m_UIsession
Definition: RunManager.h:114
std::unique_ptr< DDG4ProductionCuts > m_prodCuts
Definition: RunManager.h:155
edm::ParameterSet m_pGeometry
Definition: RunManager.h:137
edm::ParameterSet m_pRunAction
Definition: RunManager.h:142
std::unique_ptr< SimTrackManager > m_trackManager
Definition: RunManager.h:161
edm::ParameterSet m_pTrackingAction
Definition: RunManager.h:145
std::vector< std::string > m_G4Commands
Definition: RunManager.h:148
std::string m_FieldFile
Definition: RunManager.h:167
std::unique_ptr< PhysicsList > m_physicsList
Definition: RunManager.h:115
G4SimEvent * m_simEvent
Definition: RunManager.h:128
bool m_managerInitialized
Definition: RunManager.h:118
G4RunManagerKernel * m_kernel
Definition: RunManager.h:107
bool m_runAborted
Definition: RunManager.h:121