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 class DDG4ProductionCuts;
49 
50 class G4RunManagerKernel;
51 class G4Run;
52 class G4Event;
53 class G4Field;
54 class RunAction;
55 
56 class SimRunInterface;
57 
59 {
60 public:
61 
63  ~RunManager();
64  void initG4(const edm::EventSetup & es);
65  void initializeUserActions();
66  void initializeRun();
67 
68  void stopG4();
69  void terminateRun();
70  void abortRun(bool softAbort=false);
71 
72  const G4Run * currentRun() const { return m_currentRun; }
73  void produce(edm::Event& inpevt, const edm::EventSetup& es);
74  void abortEvent();
75  const Generator * generator() const { return m_generator; }
76  const G4Event * currentEvent() const { return m_currentEvent; }
77  G4SimEvent * simEvent() { return m_simEvent; }
78  std::vector<SensitiveTkDetector*>& sensTkDetectors() {
79  return m_sensTkDets;
80  }
81  std::vector<SensitiveCaloDetector*>& sensCaloDetectors() {
82  return m_sensCaloDets;
83  }
84  std::vector<std::shared_ptr<SimProducer> > producers() const {
85  return m_producers;
86  }
87 
89  void Connect(RunAction*);
90  void Connect(EventAction*);
91  void Connect(TrackingAction*);
92  void Connect(SteppingAction*);
93 
94 protected:
95 
96  G4Event * generateEvent( edm::Event& inpevt );
97  void resetGenParticleId( edm::Event& inpevt );
98  void DumpMagneticField( const G4Field*) const;
99 
100 private:
101 
102  G4RunManagerKernel * m_kernel;
103 
106 
107  bool m_nonBeam;
108  std::auto_ptr<PhysicsList> m_physicsList;
114  bool firstRun;
116  G4Run * m_currentRun;
117  G4Event * m_currentEvent;
121 
122  //edm::EDGetTokenT<edm::HepMCProduct> m_HepMC;
123 
128  bool m_check;
140  std::vector<std::string> m_G4Commands;
142 
144  std::vector<SensitiveTkDetector*> m_sensTkDets;
145  std::vector<SensitiveCaloDetector*> m_sensCaloDets;
146 
147  std::unique_ptr<DDG4ProductionCuts> m_prodCuts;
149  std::vector<std::shared_ptr<SimWatcher> > m_watchers;
150  std::vector<std::shared_ptr<SimProducer> > m_producers;
151 
152  std::auto_ptr<SimTrackManager> m_trackManager;
155 
158 
160 
164 };
165 
166 #endif
std::vector< SensitiveCaloDetector * > & sensCaloDetectors()
Definition: RunManager.h:81
bool m_check
Definition: RunManager.h:128
edm::ParameterSet m_pGenerator
Definition: RunManager.h:131
std::auto_ptr< SimTrackManager > m_trackManager
Definition: RunManager.h:152
std::vector< std::shared_ptr< SimProducer > > producers() const
Definition: RunManager.h:84
SimTrackManager * GetSimTrackManager()
Definition: RunManager.cc:516
edm::ESWatcher< IdealMagneticFieldRecord > idealMagRcdWatcher_
Definition: RunManager.h:157
G4Event * m_currentEvent
Definition: RunManager.h:117
void abortRun(bool softAbort=false)
Definition: RunManager.cc:497
SimActivityRegistry m_registry
Definition: RunManager.h:148
edm::ParameterSet m_p
Definition: RunManager.h:141
std::vector< std::shared_ptr< SimProducer > > m_producers
Definition: RunManager.h:150
void initializeRun()
Definition: RunManager.cc:469
const G4Event * currentEvent() const
Definition: RunManager.h:76
void initializeUserActions()
Definition: RunManager.cc:433
Generator * m_generator
Definition: RunManager.h:104
bool m_pUseMagneticField
Definition: RunManager.h:115
edm::ESWatcher< IdealGeometryRecord > idealGeomRcdWatcher_
Definition: RunManager.h:156
const Generator * generator() const
Definition: RunManager.h:75
std::vector< SensitiveTkDetector * > & sensTkDetectors()
Definition: RunManager.h:78
Definition: sim.h:19
void abortEvent()
Definition: RunManager.cc:400
std::vector< SensitiveCaloDetector * > m_sensCaloDets
Definition: RunManager.h:145
std::vector< SensitiveTkDetector * > m_sensTkDets
Definition: RunManager.h:144
bool m_nonBeam
Definition: RunManager.h:107
int m_EvtMgrVerbosity
Definition: RunManager.h:127
std::auto_ptr< PhysicsList > m_physicsList
Definition: RunManager.h:108
std::string m_WriteFile
Definition: RunManager.h:162
const G4Run * currentRun() const
Definition: RunManager.h:72
bool firstRun
Definition: RunManager.h:114
SimRunInterface * m_runInterface
Definition: RunManager.h:120
void terminateRun()
Definition: RunManager.cc:479
bool m_RestorePhysicsTables
Definition: RunManager.h:126
std::vector< std::shared_ptr< SimWatcher > > m_watchers
Definition: RunManager.h:149
G4Run * m_currentRun
Definition: RunManager.h:116
void resetGenParticleId(edm::Event &inpevt)
Definition: RunManager.cc:507
edm::ParameterSet m_pStackingAction
Definition: RunManager.h:136
edm::ParameterSet m_pEventAction
Definition: RunManager.h:135
bool m_runTerminated
Definition: RunManager.h:112
edm::ParameterSet m_pField
Definition: RunManager.h:130
edm::ParameterSet m_pPhysics
Definition: RunManager.h:133
edm::ParameterSet m_pVertexGenerator
Definition: RunManager.h:132
edm::ParameterSet m_pSteppingAction
Definition: RunManager.h:138
edm::ParameterSet m_g4overlap
Definition: RunManager.h:139
void stopG4()
Definition: RunManager.cc:329
RunAction * m_userRunAction
Definition: RunManager.h:119
std::string m_InTag
Definition: RunManager.h:105
G4Event * generateEvent(edm::Event &inpevt)
Definition: RunManager.cc:366
void DumpMagneticField(const G4Field *) const
Definition: RunManager.cc:544
bool m_runInitialized
Definition: RunManager.h:111
sim::ChordFinderSetter * m_chordFinderSetter
Definition: RunManager.h:154
void Connect(RunAction *)
Definition: RunManager.cc:521
G4SimEvent * simEvent()
Definition: RunManager.h:77
std::string m_RegionFile
Definition: RunManager.h:163
AttachSD * m_attach
Definition: RunManager.h:143
PrimaryTransformer * m_primaryTransformer
Definition: RunManager.h:109
sim::FieldBuilder * m_fieldBuilder
Definition: RunManager.h:153
std::string m_PhysicsTablesDir
Definition: RunManager.h:124
bool m_StorePhysicsTables
Definition: RunManager.h:125
std::unique_ptr< DDG4ProductionCuts > m_prodCuts
Definition: RunManager.h:147
edm::ParameterSet m_pGeometry
Definition: RunManager.h:129
edm::ParameterSet m_pRunAction
Definition: RunManager.h:134
RunManager(edm::ParameterSet const &p)
Definition: RunManager.cc:109
edm::ParameterSet m_pTrackingAction
Definition: RunManager.h:137
std::vector< std::string > m_G4Commands
Definition: RunManager.h:140
std::string m_FieldFile
Definition: RunManager.h:161
G4SimEvent * m_simEvent
Definition: RunManager.h:118
bool m_managerInitialized
Definition: RunManager.h:110
void initG4(const edm::EventSetup &es)
Definition: RunManager.cc:167
edm::InputTag m_theLHCTlinkTag
Definition: RunManager.h:159
G4RunManagerKernel * m_kernel
Definition: RunManager.h:102
bool m_runAborted
Definition: RunManager.h:113
void produce(edm::Event &inpevt, const edm::EventSetup &es)
Definition: RunManager.cc:335