CMS 3D CMS Logo

ME0PadDigiProducer.cc
Go to the documentation of this file.
2 
9 
10 #include <set>
11 
12 
14 : geometry_(nullptr)
15 {
16  digis_ = ps.getParameter<edm::InputTag>("InputCollection");
17 
18  digi_token_ = consumes<ME0DigiCollection>(digis_);
19 
20  produces<ME0PadDigiCollection>();
21 }
22 
23 
25 {}
26 
27 
29 {
31  eventSetup.get<MuonGeometryRecord>().get(hGeom);
32  geometry_ = &*hGeom;
33 }
34 
35 
37 {
39  e.getByToken(digi_token_, hdigis);
40 
41  // Create empty output
42  std::unique_ptr<ME0PadDigiCollection> pPads(new ME0PadDigiCollection());
43 
44  // build the pads
45  buildPads(*(hdigis.product()), *pPads);
46 
47  // store them in the event
48  e.put(std::move(pPads));
49 }
50 
51 
53 {
54  auto etaPartitions = geometry_->etaPartitions();
55  for(const auto& p: etaPartitions)
56  {
57  // set of <pad, bx> pairs, sorted first by pad then by bx
58  std::set<std::pair<int, int> > proto_pads;
59 
60  // walk over digis in this partition,
61  // and stuff them into a set of unique pads (equivalent of OR operation)
62  auto digis = det_digis.get(p->id());
63  for (auto d = digis.first; d != digis.second; ++d)
64  {
65  int pad_num = 1 + static_cast<int>( p->padOfStrip(d->strip()) );
66  proto_pads.emplace(pad_num, d->bx());
67  }
68 
69  // fill the output collections
70  for (const auto & d: proto_pads)
71  {
72  ME0PadDigi pad_digi(d.first, d.second);
73  out_pads.insertDigi(p->id(), pad_digi);
74  }
75  }
76 }
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
virtual void beginRun(const edm::Run &, const edm::EventSetup &) override
#define nullptr
MuonDigiCollection< ME0DetId, ME0PadDigi > ME0PadDigiCollection
edm::EDGetTokenT< ME0DigiCollection > digi_token_
Name of input digi Collection.
const std::vector< ME0EtaPartition const * > & etaPartitions() const
Return a vector of all ME0 eta partitions.
Definition: ME0Geometry.cc:59
T const * product() const
Definition: Handle.h:81
ME0PadDigiProducer(const edm::ParameterSet &ps)
const T & get() const
Definition: EventSetup.h:56
void buildPads(const ME0DigiCollection &digis, ME0PadDigiCollection &out_pads) const
virtual void produce(edm::Event &, const edm::EventSetup &) override
const ME0Geometry * geometry_
def move(src, dest)
Definition: eostools.py:510
Definition: Run.h:42