test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 FieldBuilder;
34  class ChordFinderSetter;
35 }
36 
37 class PrimaryTransformer;
38 class Generator;
39 class PhysicsList;
40 
41 class SimWatcher;
42 class SimProducer;
43 class G4SimEvent;
44 class SimTrackManager;
45 
46 class RunAction;
47 class EventAction;
48 class TrackingAction;
49 class SteppingAction;
50 class CMSSteppingVerbose;
51 
52 class DDDWorld;
53 class DDG4ProductionCuts;
54 class CustomUIsession;
55 
56 class G4RunManagerKernel;
57 class G4Run;
58 class G4Event;
59 class G4Field;
60 class RunAction;
61 
62 class SimRunInterface;
63 
65 {
66 public:
67 
69  ~RunManager();
70  void initG4(const edm::EventSetup & es);
71  void initializeUserActions();
72  void initializeRun();
73 
74  void stopG4();
75  void terminateRun();
76  void abortRun(bool softAbort=false);
77 
78  const G4Run * currentRun() const { return m_currentRun; }
79  void produce(edm::Event& inpevt, const edm::EventSetup& es);
80  void abortEvent();
81  const Generator * generator() const { return m_generator; }
82  const G4Event * currentEvent() const { return m_currentEvent; }
83  G4SimEvent * simEvent() { return m_simEvent; }
84  std::vector<SensitiveTkDetector*>& sensTkDetectors() {
85  return m_sensTkDets;
86  }
87  std::vector<SensitiveCaloDetector*>& sensCaloDetectors() {
88  return m_sensCaloDets;
89  }
90  std::vector<std::shared_ptr<SimProducer> > producers() const {
91  return m_producers;
92  }
93 
95  void Connect(RunAction*);
96  void Connect(EventAction*);
97  void Connect(TrackingAction*);
98  void Connect(SteppingAction*);
99 
100 protected:
101 
102  G4Event * generateEvent( edm::Event& inpevt );
103  void resetGenParticleId( edm::Event& inpevt );
104  void DumpMagneticField( const G4Field*) const;
105 
106 private:
107 
108  G4RunManagerKernel * m_kernel;
109 
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;
165 
168 
172 };
173 
174 #endif
std::vector< SensitiveCaloDetector * > & sensCaloDetectors()
Definition: RunManager.h:87
bool m_check
Definition: RunManager.h:137
edm::ParameterSet m_pGenerator
Definition: RunManager.h:140
int i
Definition: DBlmapReader.cc:9
edm::EDGetTokenT< edm::HepMCProduct > m_HepMC
Definition: RunManager.h:111
std::vector< std::shared_ptr< SimProducer > > producers() const
Definition: RunManager.h:90
SimTrackManager * GetSimTrackManager()
Definition: RunManager.cc:533
edm::ESWatcher< IdealMagneticFieldRecord > idealMagRcdWatcher_
Definition: RunManager.h:167
RunManager(edm::ParameterSet const &p, edm::ConsumesCollector &&i)
Definition: RunManager.cc:114
G4Event * m_currentEvent
Definition: RunManager.h:128
void abortRun(bool softAbort=false)
Definition: RunManager.cc:515
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
void initializeRun()
Definition: RunManager.cc:488
const G4Event * currentEvent() const
Definition: RunManager.h:82
void initializeUserActions()
Definition: RunManager.cc:451
Generator * m_generator
Definition: RunManager.h:110
bool m_hasWatchers
Definition: RunManager.h:125
bool m_pUseMagneticField
Definition: RunManager.h:124
edm::ESWatcher< IdealGeometryRecord > idealGeomRcdWatcher_
Definition: RunManager.h:166
const Generator * generator() const
Definition: RunManager.h:81
std::vector< SensitiveTkDetector * > & sensTkDetectors()
Definition: RunManager.h:84
Definition: sim.h:19
void abortEvent()
Definition: RunManager.cc:430
std::vector< SensitiveCaloDetector * > m_sensCaloDets
Definition: RunManager.h:154
Definition: Event.h:16
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:170
const G4Run * currentRun() const
Definition: RunManager.h:78
bool firstRun
Definition: RunManager.h:123
SimRunInterface * m_runInterface
Definition: RunManager.h:131
void terminateRun()
Definition: RunManager.cc:498
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
void resetGenParticleId(edm::Event &inpevt)
Definition: RunManager.cc:524
edm::ParameterSet m_pStackingAction
Definition: RunManager.h:145
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
void stopG4()
Definition: RunManager.cc:355
RunAction * m_userRunAction
Definition: RunManager.h:130
G4Event * generateEvent(edm::Event &inpevt)
Definition: RunManager.cc:396
void DumpMagneticField(const G4Field *) const
Definition: RunManager.cc:561
bool m_runInitialized
Definition: RunManager.h:120
sim::ChordFinderSetter * m_chordFinderSetter
Definition: RunManager.h:164
void Connect(RunAction *)
Definition: RunManager.cc:538
G4SimEvent * simEvent()
Definition: RunManager.h:83
std::string m_RegionFile
Definition: RunManager.h:171
AttachSD * m_attach
Definition: RunManager.h:152
PrimaryTransformer * m_primaryTransformer
Definition: RunManager.h:117
sim::FieldBuilder * m_fieldBuilder
Definition: RunManager.h:163
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:169
std::unique_ptr< PhysicsList > m_physicsList
Definition: RunManager.h:116
G4SimEvent * m_simEvent
Definition: RunManager.h:129
bool m_managerInitialized
Definition: RunManager.h:119
void initG4(const edm::EventSetup &es)
Definition: RunManager.cc:179
G4RunManagerKernel * m_kernel
Definition: RunManager.h:108
bool m_runAborted
Definition: RunManager.h:122
void produce(edm::Event &inpevt, const edm::EventSetup &es)
Definition: RunManager.cc:361