CMS 3D CMS Logo

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  void makeGeom(const edm::EventSetup &c);
63 
64  G4RunManagerKernel *m_kernel;
67  std::vector<std::shared_ptr<SimWatcher>> m_watchers;
68  std::vector<std::shared_ptr<SimProducer>> m_producers;
69  std::unique_ptr<sim::FieldBuilder> m_fieldBuilder;
70  std::unique_ptr<SimTrackManager> m_trackManager;
71  std::vector<SensitiveTkDetector *> m_sensTkDets;
72  std::vector<SensitiveCaloDetector *> m_sensCaloDets;
73  std::unordered_map<std::string, std::unique_ptr<SensitiveDetectorMakerBase>> m_sdMakers;
75 
76  mutable const DDCompactView *m_pDD;
77  mutable const cms::DDCompactView *m_pDD4hep;
78 
79  bool m_firstRun;
83 
87 };
88 
89 #endif
std::vector< SensitiveTkDetector * > m_sensTkDets
GeometryProducer(edm::ParameterSet const &p)
void endRun(const edm::Run &r, const edm::EventSetup &c) override
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
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
Namespace of DDCMS conversion namespace.
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
void makeGeom(const edm::EventSetup &c)