CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GeometryProducer.h
Go to the documentation of this file.
1 #ifndef SimG4Core_GeometryProducer_H
2 #define SimG4Core_GeometryProducer_H
3 
11 
16 
19 
21 
24 
25 #include <memory>
26 #include <unordered_map>
27 
28 namespace sim {
29  class FieldBuilder;
30 }
31 
32 namespace cms {
33  class DDCompactView;
34 }
35 
36 class SimWatcher;
37 class SimProducer;
38 class DDDWorld;
39 class G4RunManagerKernel;
40 class SimTrackManager;
42 class DDCompactView;
43 
44 class GeometryProducer : public edm::one::EDProducer<edm::one::SharedResources, edm::one::WatchRuns> {
45 public:
46  typedef std::vector<std::shared_ptr<SimProducer>> Producers;
47 
48  explicit GeometryProducer(edm::ParameterSet const &p);
49  ~GeometryProducer() override;
50  void beginRun(const edm::Run &r, const edm::EventSetup &c) override;
51  void endRun(const edm::Run &r, const edm::EventSetup &c) override;
52  void produce(edm::Event &e, const edm::EventSetup &c) override;
54 
55  std::vector<std::shared_ptr<SimProducer>> producers() const { return m_producers; }
56  std::vector<SensitiveTkDetector *> &sensTkDetectors() { return m_sensTkDets; }
57  std::vector<SensitiveCaloDetector *> &sensCaloDetectors() { return m_sensCaloDets; }
58 
59 private:
60  void updateMagneticField(edm::EventSetup const &es);
61 
62  G4RunManagerKernel *m_kernel;
65  std::vector<std::shared_ptr<SimWatcher>> m_watchers;
66  std::vector<std::shared_ptr<SimProducer>> m_producers;
67  std::unique_ptr<sim::FieldBuilder> m_fieldBuilder;
68  std::unique_ptr<SimTrackManager> m_trackManager;
69  std::vector<SensitiveTkDetector *> m_sensTkDets;
70  std::vector<SensitiveCaloDetector *> m_sensCaloDets;
71  std::unordered_map<std::string, std::unique_ptr<SensitiveDetectorMakerBase>> m_sdMakers;
73 
74  mutable const DDCompactView *m_pDD;
75  mutable const cms::DDCompactView *m_pDD4hep;
76 
77  bool m_firstRun;
81 
85 };
86 
87 #endif
std::vector< SensitiveTkDetector * > m_sensTkDets
GeometryProducer(edm::ParameterSet const &p)
void endRun(const edm::Run &r, const edm::EventSetup &c) override
const edm::EventSetup & c
std::vector< std::shared_ptr< SimProducer > > Producers
const DDCompactView * m_pDD
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > tokMF_
edm::ParameterSet m_pField
std::vector< SensitiveCaloDetector * > & sensCaloDetectors()
~GeometryProducer() override
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:81
Definition: sim.h:19
void beginRun(const edm::Run &r, const edm::EventSetup &c) override
std::vector< std::shared_ptr< SimWatcher > > m_watchers
std::vector< SensitiveCaloDetector * > m_sensCaloDets
G4RunManagerKernel * m_kernel
edm::ESGetToken< cms::DDCompactView, IdealGeometryRecord > tokDD4hep_
std::vector< std::shared_ptr< SimProducer > > m_producers
SimActivityRegistry m_registry
void produce(edm::Event &e, const edm::EventSetup &c) override
edm::ESGetToken< DDCompactView, IdealGeometryRecord > tokDDD_
void updateMagneticField(edm::EventSetup const &es)
std::vector< std::shared_ptr< SimProducer > > producers() const
std::unordered_map< std::string, std::unique_ptr< SensitiveDetectorMakerBase > > m_sdMakers
std::unique_ptr< SimTrackManager > m_trackManager
void beginLuminosityBlock(edm::LuminosityBlock &, edm::EventSetup const &)
const cms::DDCompactView * m_pDD4hep
std::unique_ptr< sim::FieldBuilder > m_fieldBuilder
std::vector< SensitiveTkDetector * > & sensTkDetectors()
edm::ParameterSet m_p
Definition: Run.h:45