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  for(const auto& p: geometry_->etaPartitions())
55  {
56  // set of <pad, bx> pairs, sorted first by pad then by bx
57  std::set<std::pair<int, int> > proto_pads;
58 
59  // walk over digis in this partition,
60  // and stuff them into a set of unique pads (equivalent of OR operation)
61  auto digis = det_digis.get(p->id());
62  for (auto d = digis.first; d != digis.second; ++d)
63  {
64  int pad_num = 1 + static_cast<int>( p->padOfStrip(d->strip()) );
65  proto_pads.emplace(pad_num, d->bx());
66  }
67 
68  // fill the output collections
69  for (const auto & d: proto_pads)
70  {
71  ME0PadDigi pad_digi(d.first, d.second);
72  out_pads.insertDigi(p->id(), pad_digi);
73  }
74  }
75 }
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:55
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