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