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  auto etaPartitions = geometry_->etaPartitions();
56  for(const auto& p: etaPartitions)
57  {
58  // set of <pad, bx> pairs, sorted first by pad then by bx
59  std::set<std::pair<int, int> > proto_pads;
60 
61  // walk over digis in this partition,
62  // and stuff them into a set of unique pads (equivalent of OR operation)
63  auto digis = det_digis.get(p->id());
64  for (auto d = digis.first; d != digis.second; ++d)
65  {
66  int pad_num = 1 + static_cast<int>( p->padOfStrip(d->strip()) );
67  proto_pads.emplace(pad_num, d->bx());
68  }
69 
70  // in the future, do some dead-time handling
71  // emulateDeadTime(proto_pads)
72 
73  // fill the output collections
74  for (const auto& d: proto_pads)
75  {
76  GEMPadDigi pad_digi(d.first, d.second);
77  out_pads.insertDigi(p->id(), pad_digi);
78  }
79  }
80 }
virtual 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:122
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
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
const T & get() const
Definition: EventSetup.h:56
MuonDigiCollection< GEMDetId, GEMPadDigi > GEMPadDigiCollection
edm::EDGetTokenT< GEMDigiCollection > digi_token_
Name of input digi Collection.
virtual void beginRun(const edm::Run &, const edm::EventSetup &) override
def move(src, dest)
Definition: eostools.py:510
Definition: Run.h:42