CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GEMPadDigiProducer.cc
Go to the documentation of this file.
2 
9 
10 #include <string>
11 #include <map>
12 #include <vector>
13 
14 
16 : geometry_(nullptr)
17 {
18  digis_ = ps.getParameter<edm::InputTag>("InputCollection");
19 
20  digi_token_ = consumes<GEMDigiCollection>(digis_);
21 
22  produces<GEMPadDigiCollection>();
23  consumes<GEMDigiCollection>(digis_);
24 }
25 
26 
28 {}
29 
30 
32 {
34  eventSetup.get<MuonGeometryRecord>().get(hGeom);
35  geometry_ = &*hGeom;
36 }
37 
38 
40 {
42  e.getByToken(digi_token_, hdigis);
43 
44  // Create empty output
45  std::auto_ptr<GEMPadDigiCollection> pPads(new GEMPadDigiCollection());
46 
47  // build the pads
48  buildPads(*(hdigis.product()), *pPads);
49 
50  // store them in the event
51  e.put(pPads);
52 }
53 
54 
56 {
57  auto etaPartitions = geometry_->etaPartitions();
58  for(auto p: etaPartitions)
59  {
60  // set of <pad, bx> pairs, sorted first by pad then by bx
61  std::set<std::pair<int, int> > proto_pads;
62 
63  // walk over digis in this partition,
64  // and stuff them into a set of unique pads (equivalent of OR operation)
65  auto digis = det_digis.get(p->id());
66  for (auto d = digis.first; d != digis.second; ++d)
67  {
68  int pad_num = 1 + static_cast<int>( p->padOfStrip(d->strip()) );
69  auto pad = std::make_pair(pad_num, d->bx());
70  proto_pads.insert(pad);
71  }
72 
73  // in the future, do some dead-time handling
74  // emulateDeadTime(proto_pads)
75 
76  // fill the output collections
77  for (auto & d: proto_pads)
78  {
79  GEMPadDigi pad_digi(d.first, d.second);
80  out_pads.insertDigi(p->id(), pad_digi);
81  }
82  }
83 }
virtual void produce(edm::Event &, const edm::EventSetup &) override
T getParameter(std::string const &) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
const GEMGeometry * geometry_
GEMPadDigiProducer(const edm::ParameterSet &ps)
#define nullptr
tuple d
Definition: ztail.py:151
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
const std::vector< const GEMEtaPartition * > & etaPartitions() const
Return a vector of all GEM eta partitions.
Definition: GEMGeometry.cc:63
T const * product() const
Definition: Handle.h:81
const T & get() const
Definition: EventSetup.h:56
MuonDigiCollection< GEMDetId, GEMPadDigi > GEMPadDigiCollection
void buildPads(const GEMDigiCollection &digis, GEMPadDigiCollection &out_pads)
edm::EDGetTokenT< GEMDigiCollection > digi_token_
Name of input digi Collection.
virtual void beginRun(const edm::Run &, const edm::EventSetup &) override
Definition: Run.h:43