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>
6 // #include "DataFormats/Common/interface/Handle.h"
11 
16 
18 
19 #include <memory>
20 #include "boost/shared_ptr.hpp"
21 
24 
26 
27 namespace CLHEP {
28  class HepJamesRandom;
29 }
30 
31 namespace sim {
32  class FieldBuilder;
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 DDDWorld;
45 
46 class G4RunManagerKernel;
47 class G4Run;
48 class G4Event;
49 class G4UserRunAction;
50 
51 class ExceptionHandler ;
52 
54 {
55 public:
57  //static RunManager * instance();
58  //static RunManager * init(edm::ParameterSet const & p);
59  virtual ~RunManager();
60  void initG4(const edm::EventSetup & es);
61  void initializeUserActions();
62  void initializeRun();
63  void terminateRun();
64  void abortRun(bool softAbort=false);
65  const G4Run * currentRun() const { return m_currentRun; }
66  void produce(edm::Event& inpevt, const edm::EventSetup& es);
67  void abortEvent();
68  const Generator * generator() const { return m_generator; }
69  const G4Event * currentEvent() const { return m_currentEvent; }
70  G4SimEvent * simEvent() { return m_simEvent; }
71  std::vector<SensitiveTkDetector*>& sensTkDetectors() { return m_sensTkDets; }
72  std::vector<SensitiveCaloDetector*>& sensCaloDetectors() { return m_sensCaloDets; }
73 
74  std::vector<boost::shared_ptr<SimProducer> > producers() const {
75  return m_producers;
76  }
77 protected:
78  G4Event * generateEvent( edm::Event& inpevt );
79 
80  void resetGenParticleId( edm::Event& inpevt );
81 private:
82 
83  // static RunManager * me;
84  // explicit RunManager(edm::ParameterSet const & p);
85 
86  G4RunManagerKernel * m_kernel;
87 
89  // edm::InputTag m_InTag ;
91 
92  bool m_nonBeam;
93  std::auto_ptr<PhysicsList> m_physicsList;
96  // bool m_geometryInitialized;
97  // bool m_physicsInitialized;
101  bool firstRun;
103  G4Run * m_currentRun;
104  G4Event * m_currentEvent;
106  G4UserRunAction * m_userRunAction;
112  bool m_check;
123  std::vector<std::string> m_G4Commands;
126 
128  std::vector<SensitiveTkDetector*> m_sensTkDets;
129  std::vector<SensitiveCaloDetector*> m_sensCaloDets;
130 
132  std::vector<boost::shared_ptr<SimWatcher> > m_watchers;
133  std::vector<boost::shared_ptr<SimProducer> > m_producers;
134 
135  std::auto_ptr<SimTrackManager> m_trackManager;
137 
140 
142 
144 };
145 
146 #endif
std::vector< SensitiveCaloDetector * > & sensCaloDetectors()
Definition: RunManager.h:72
bool m_check
Definition: RunManager.h:112
edm::ParameterSet m_pGenerator
Definition: RunManager.h:115
std::auto_ptr< SimTrackManager > m_trackManager
Definition: RunManager.h:135
edm::ESWatcher< IdealMagneticFieldRecord > idealMagRcdWatcher_
Definition: RunManager.h:139
G4UserRunAction * m_userRunAction
Definition: RunManager.h:106
G4Event * m_currentEvent
Definition: RunManager.h:104
void abortRun(bool softAbort=false)
Definition: RunManager.cc:484
SimActivityRegistry m_registry
Definition: RunManager.h:131
edm::ParameterSet m_p
Definition: RunManager.h:124
void initializeRun()
Definition: RunManager.cc:451
const G4Event * currentEvent() const
Definition: RunManager.h:69
void initializeUserActions()
Definition: RunManager.cc:411
Generator * m_generator
Definition: RunManager.h:88
bool m_pUseMagneticField
Definition: RunManager.h:102
edm::ESWatcher< IdealGeometryRecord > idealGeomRcdWatcher_
Definition: RunManager.h:138
const Generator * generator() const
Definition: RunManager.h:68
std::vector< SensitiveTkDetector * > & sensTkDetectors()
Definition: RunManager.h:71
Definition: sim.h:19
ExceptionHandler * m_CustomExceptionHandler
Definition: RunManager.h:125
void abortEvent()
Definition: RunManager.cc:375
std::vector< SensitiveCaloDetector * > m_sensCaloDets
Definition: RunManager.h:129
std::vector< SensitiveTkDetector * > m_sensTkDets
Definition: RunManager.h:128
bool m_nonBeam
Definition: RunManager.h:92
bool m_Override
Definition: RunManager.h:111
int m_EvtMgrVerbosity
Definition: RunManager.h:110
std::auto_ptr< PhysicsList > m_physicsList
Definition: RunManager.h:93
std::string m_WriteFile
Definition: RunManager.h:143
const G4Run * currentRun() const
Definition: RunManager.h:65
bool firstRun
Definition: RunManager.h:101
void terminateRun()
Definition: RunManager.cc:466
virtual ~RunManager()
Definition: RunManager.cc:162
bool m_RestorePhysicsTables
Definition: RunManager.h:109
G4Run * m_currentRun
Definition: RunManager.h:103
void resetGenParticleId(edm::Event &inpevt)
Definition: RunManager.cc:497
edm::ParameterSet m_pStackingAction
Definition: RunManager.h:120
edm::ParameterSet m_pEventAction
Definition: RunManager.h:119
bool m_runTerminated
Definition: RunManager.h:99
edm::ParameterSet m_pField
Definition: RunManager.h:114
edm::ParameterSet m_pPhysics
Definition: RunManager.h:117
edm::ParameterSet m_pVertexGenerator
Definition: RunManager.h:116
edm::ParameterSet m_pSteppingAction
Definition: RunManager.h:122
std::vector< boost::shared_ptr< SimProducer > > producers() const
Definition: RunManager.h:74
std::string m_InTag
Definition: RunManager.h:90
G4Event * generateEvent(edm::Event &inpevt)
Definition: RunManager.cc:331
bool m_runInitialized
Definition: RunManager.h:98
G4SimEvent * simEvent()
Definition: RunManager.h:70
AttachSD * m_attach
Definition: RunManager.h:127
PrimaryTransformer * m_primaryTransformer
Definition: RunManager.h:94
sim::FieldBuilder * m_fieldBuilder
Definition: RunManager.h:136
std::string m_PhysicsTablesDir
Definition: RunManager.h:107
bool m_StorePhysicsTables
Definition: RunManager.h:108
edm::ParameterSet m_pGeometry
Definition: RunManager.h:113
std::vector< boost::shared_ptr< SimProducer > > m_producers
Definition: RunManager.h:133
std::vector< boost::shared_ptr< SimWatcher > > m_watchers
Definition: RunManager.h:132
edm::ParameterSet m_pRunAction
Definition: RunManager.h:118
RunManager(edm::ParameterSet const &p)
Definition: RunManager.cc:118
edm::ParameterSet m_pTrackingAction
Definition: RunManager.h:121
std::vector< std::string > m_G4Commands
Definition: RunManager.h:123
G4SimEvent * m_simEvent
Definition: RunManager.h:105
bool m_managerInitialized
Definition: RunManager.h:95
void initG4(const edm::EventSetup &es)
Definition: RunManager.cc:167
edm::InputTag m_theLHCTlinkTag
Definition: RunManager.h:141
G4RunManagerKernel * m_kernel
Definition: RunManager.h:86
bool m_runAborted
Definition: RunManager.h:100
void produce(edm::Event &inpevt, const edm::EventSetup &es)
Definition: RunManager.cc:299