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