CMS 3D CMS Logo

GEMPadDigiProducer.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<GEMDigiCollection>(digis_);
19 
20  produces<GEMPadDigiCollection>();
21  consumes<GEMDigiCollection>(digis_);
22 }
23 
24 
26 {}
27 
28 
30 {
32  eventSetup.get<MuonGeometryRecord>().get(hGeom);
33  geometry_ = &*hGeom;
34 }
35 
36 
38 {
40  e.getByToken(digi_token_, hdigis);
41 
42  // Create empty output
43  std::unique_ptr<GEMPadDigiCollection> pPads(new GEMPadDigiCollection());
44 
45  // build the pads
46  buildPads(*(hdigis.product()), *pPads);
47 
48  // store them in the event
49  e.put(std::move(pPads));
50 }
51 
52 
54 {
55  for(const auto& p: geometry_->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 = static_cast<int>(p->padOfStrip(d->strip()));
66  proto_pads.emplace(pad_num, d->bx());
67  }
68 
69  // in the future, do some dead-time handling
70  // emulateDeadTime(proto_pads)
71 
72  // fill the output collections
73  for (const auto& d: proto_pads)
74  {
75  GEMPadDigi pad_digi(d.first, d.second);
76  out_pads.insertDigi(p->id(), pad_digi);
77  }
78  }
79 }
void produce(edm::Event &, const edm::EventSetup &) override
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
const GEMGeometry * geometry_
GEMPadDigiProducer(const edm::ParameterSet &ps)
#define nullptr
const std::vector< const GEMEtaPartition * > & etaPartitions() const
Return a vector of all GEM eta partitions.
Definition: GEMGeometry.cc:63
void buildPads(const GEMDigiCollection &digis, GEMPadDigiCollection &out_pads) const
T const * product() const
Definition: Handle.h:81
MuonDigiCollection< GEMDetId, GEMPadDigi > GEMPadDigiCollection
~GEMPadDigiProducer() override
T get() const
Definition: EventSetup.h:68
edm::EDGetTokenT< GEMDigiCollection > digi_token_
Name of input digi Collection.
void beginRun(const edm::Run &, const edm::EventSetup &) override
def move(src, dest)
Definition: eostools.py:511
Definition: Run.h:44