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