CMS 3D CMS Logo

MtdRecoClusterToSimLayerClusterAssociatorByHitsProducer.cc
Go to the documentation of this file.
1 // system include files
2 #include <memory>
3 #include <string>
4 
5 // user include files
13 
17 
19 
20 //
21 // Class declaration
22 //
23 
25 public:
28 
29  static void fillDescriptions(edm::ConfigurationDescriptions &descriptions);
30 
31 private:
32  void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override;
33  const double energyCut_;
34  const double timeCut_;
37 };
38 
40  const edm::ParameterSet &ps)
41  : energyCut_(ps.getParameter<double>("energyCut")), timeCut_(ps.getParameter<double>("timeCut")) {
42  geomToken_ = esConsumes<MTDGeometry, MTDDigiGeometryRecord>();
43  topoToken_ = esConsumes<MTDTopology, MTDTopologyRcd>();
44 
45  // Register the product
46  produces<reco::MtdRecoClusterToSimLayerClusterAssociator>();
47 }
48 
50 
53  const edm::EventSetup &es) const {
54  auto geometryHandle = es.getTransientHandle(geomToken_);
55  const MTDGeometry *geom = geometryHandle.product();
56 
57  auto topologyHandle = es.getTransientHandle(topoToken_);
58  const MTDTopology *topology = topologyHandle.product();
59 
60  mtd::MTDGeomUtil geomTools_;
61  geomTools_.setGeometry(geom);
62  geomTools_.setTopology(topology);
63 
64  auto impl = std::make_unique<MtdRecoClusterToSimLayerClusterAssociatorByHitsImpl>(
65  iEvent.productGetter(), energyCut_, timeCut_, geomTools_);
66  auto toPut = std::make_unique<reco::MtdRecoClusterToSimLayerClusterAssociator>(std::move(impl));
67  iEvent.put(std::move(toPut));
68 }
69 
72  desc.add<double>("energyCut", 5.);
73  desc.add<double>("timeCut", 10.);
74 
75  cfg.add("mtdRecoClusterToSimLayerClusterAssociatorByHits", desc);
76 }
77 
78 //define this as a plug-in
void setTopology(MTDTopology const *topo)
Definition: MTDGeomUtil.cc:12
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void setGeometry(MTDGeometry const *geom)
Definition: MTDGeomUtil.cc:10
ESTransientHandle< T > getTransientHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:141
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
def move(src, dest)
Definition: eostools.py:511