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<ME0DigiPreRecoCollection>(digis_);
19 
20  produces<ME0PadDigiCollection>();
21  consumes<ME0DigiPreRecoCollection>(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<ME0PadDigiCollection> pPads(new ME0PadDigiCollection());
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 strip_num = p->strip(LocalPoint(d->x(),d->y(),0));
67  int pad_num = 1 + static_cast<int>( p->padOfStrip(strip_num) );
68  auto pad = std::make_pair(pad_num, d->tof());
69  proto_pads.insert(pad);
70  }
71 
72  // fill the output collections
73  for (const auto & d: proto_pads)
74  {
75  ME0PadDigi pad_digi(d.first, d.second);
76  out_pads.insertDigi(p->id(), pad_digi);
77  }
78  }
79 }
T getParameter(std::string const &) const
void buildPads(const ME0DigiPreRecoCollection &digis, ME0PadDigiCollection &out_pads) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:32
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
virtual void beginRun(const edm::Run &, const edm::EventSetup &) override
#define nullptr
edm::EDGetTokenT< ME0DigiPreRecoCollection > digi_token_
Name of input digi Collection.
MuonDigiCollection< ME0DetId, ME0PadDigi > ME0PadDigiCollection
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
virtual void produce(edm::Event &, const edm::EventSetup &) override
const ME0Geometry * geometry_
def move(src, dest)
Definition: eostools.py:510
Definition: Run.h:42