CMS 3D CMS Logo

ME0PadDigiProducer.cc
Go to the documentation of this file.
12 
16 
19 
20 #include <set>
21 
23 
25 public:
26  explicit ME0PadDigiProducer(const edm::ParameterSet& ps);
27 
28  void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override;
29 
30 private:
32 
38 };
39 
41  digis_ = ps.getParameter<edm::InputTag>("InputCollection");
42 
43  digi_token_ = consumes<ME0DigiCollection>(digis_);
44  geom_token_ = esConsumes<ME0Geometry, MuonGeometryRecord>();
45 
46  put_token_ = produces<ME0PadDigiCollection>();
47 }
48 
50  auto const& geometry = eventSetup.getData(geom_token_);
51 
53  e.getByToken(digi_token_, hdigis);
54 
55  // build the pads and store them in the event
56  e.emplace(put_token_, buildPads(*(hdigis.product()), geometry));
57 }
58 
60  const ME0Geometry& geometry) const {
61  ME0PadDigiCollection out_pads;
62  for (const auto& p : geometry.etaPartitions()) {
63  // set of <pad, bx> pairs, sorted first by pad then by bx
64  std::set<std::pair<int, int> > proto_pads;
65 
66  // walk over digis in this partition,
67  // and stuff them into a set of unique pads (equivalent of OR operation)
68  auto digis = det_digis.get(p->id());
69  for (auto d = digis.first; d != digis.second; ++d) {
70  int pad_num = 1 + static_cast<int>(p->padOfStrip(d->strip()));
71  proto_pads.emplace(pad_num, d->bx());
72  }
73 
74  // fill the output collections
75  for (const auto& d : proto_pads) {
76  ME0PadDigi pad_digi(d.first, d.second);
77  out_pads.insertDigi(p->id(), pad_digi);
78  }
79  }
80  return out_pads;
81 }
82 
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
ME0PadDigiCollection buildPads(const ME0DigiCollection &digis, const ME0Geometry &geometry) const
edm::ESGetToken< ME0Geometry, MuonGeometryRecord > geom_token_
T const * product() const
Definition: Handle.h:70
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
edm::EDGetTokenT< ME0DigiCollection > digi_token_
Name of input digi Collection.
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
d
Definition: ztail.py:151
ME0PadDigiProducer(const edm::ParameterSet &ps)
edm::EDPutTokenT< ME0PadDigiCollection > put_token_