CMS 3D CMS Logo

ME0PadDigiProducer.cc
Go to the documentation of this file.
12 
16 
19 
20 #include <set>
21 
23 
25 public:
26  explicit ME0PadDigiProducer(const edm::ParameterSet& ps);
27 
28  ~ME0PadDigiProducer() override;
29 
30  void beginRun(const edm::Run&, const edm::EventSetup&) override;
31 
32  void produce(edm::Event&, const edm::EventSetup&) override;
33 
34 private:
35  void buildPads(const ME0DigiCollection& digis, ME0PadDigiCollection& out_pads) const;
36 
41 
43 };
44 
46  digis_ = ps.getParameter<edm::InputTag>("InputCollection");
47 
48  digi_token_ = consumes<ME0DigiCollection>(digis_);
49  geom_token_ = esConsumes<ME0Geometry, MuonGeometryRecord, edm::Transition::BeginRun>();
50 
51  produces<ME0PadDigiCollection>();
52 }
53 
55 
56 void ME0PadDigiProducer::beginRun(const edm::Run& run, const edm::EventSetup& eventSetup) {
58  geometry_ = &*hGeom;
59 }
60 
63  e.getByToken(digi_token_, hdigis);
64 
65  // Create empty output
66  std::unique_ptr<ME0PadDigiCollection> pPads(new ME0PadDigiCollection());
67 
68  // build the pads
69  buildPads(*(hdigis.product()), *pPads);
70 
71  // store them in the event
72  e.put(std::move(pPads));
73 }
74 
75 void ME0PadDigiProducer::buildPads(const ME0DigiCollection& det_digis, ME0PadDigiCollection& out_pads) const {
76  for (const auto& p : geometry_->etaPartitions()) {
77  // set of <pad, bx> pairs, sorted first by pad then by bx
78  std::set<std::pair<int, int> > proto_pads;
79 
80  // walk over digis in this partition,
81  // and stuff them into a set of unique pads (equivalent of OR operation)
82  auto digis = det_digis.get(p->id());
83  for (auto d = digis.first; d != digis.second; ++d) {
84  int pad_num = 1 + static_cast<int>(p->padOfStrip(d->strip()));
85  proto_pads.emplace(pad_num, d->bx());
86  }
87 
88  // fill the output collections
89  for (const auto& d : proto_pads) {
90  ME0PadDigi pad_digi(d.first, d.second);
91  out_pads.insertDigi(p->id(), pad_digi);
92  }
93  }
94 }
95 
ME0Geometry::etaPartitions
const std::vector< ME0EtaPartition const * > & etaPartitions() const
Return a vector of all ME0 eta partitions.
Definition: ME0Geometry.cc:33
Handle.h
ME0DigiCollection.h
MessageLogger.h
edm::Handle::product
T const * product() const
Definition: Handle.h:70
ME0PadDigiCollection
ESHandle.h
edm::Run
Definition: Run.h:45
ME0PadDigiCollection
MuonDigiCollection< ME0DetId, ME0PadDigi > ME0PadDigiCollection
Definition: ME0PadDigiCollection.h:13
edm::EDGetTokenT< ME0DigiCollection >
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
ME0Geometry
Definition: ME0Geometry.h:12
EDProducer.h
edm::Handle
Definition: AssociativeIterator.h:50
ESGetToken.h
ME0DigiCollection
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
ME0PadDigiProducer::digis_
edm::InputTag digis_
Definition: ME0PadDigiProducer.cc:39
edm::ESHandle< ME0Geometry >
ME0PadDigiCollection.h
ME0PadDigiProducer::buildPads
void buildPads(const ME0DigiCollection &digis, ME0PadDigiCollection &out_pads) const
Definition: ME0PadDigiProducer.cc:75
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
ME0PadDigiProducer::~ME0PadDigiProducer
~ME0PadDigiProducer() override
Definition: ME0PadDigiProducer.cc:54
ME0PadDigiProducer::geom_token_
edm::ESGetToken< ME0Geometry, MuonGeometryRecord > geom_token_
Definition: ME0PadDigiProducer.cc:40
edm::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:148
edm::stream::EDProducer
Definition: EDProducer.h:38
edm::EventSetup
Definition: EventSetup.h:57
edm::ESGetToken< ME0Geometry, MuonGeometryRecord >
InputTag.h
ME0Geometry.h
ME0PadDigiProducer::beginRun
void beginRun(const edm::Run &, const edm::EventSetup &) override
Definition: ME0PadDigiProducer.cc:56
eostools.move
def move(src, dest)
Definition: eostools.py:511
writedatasetfile.run
run
Definition: writedatasetfile.py:27
ME0PadDigiProducer
Definition: ME0PadDigiProducer.cc:24
ME0PadDigiProducer::ME0PadDigiProducer
ME0PadDigiProducer(const edm::ParameterSet &ps)
Definition: ME0PadDigiProducer.cc:45
ME0PadDigiProducer::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition: ME0PadDigiProducer.cc:61
EventSetup.h
ME0PadDigiProducer::geometry_
const ME0Geometry * geometry_
Definition: ME0PadDigiProducer.cc:42
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
Exception.h
ztail.d
d
Definition: ztail.py:151
ConsumesCollector.h
ParameterSet.h
MuonGeometryRecord.h
ME0PadDigi
Definition: ME0PadDigi.h:15
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
ME0PadDigiProducer::digi_token_
edm::EDGetTokenT< ME0DigiCollection > digi_token_
Name of input digi Collection.
Definition: ME0PadDigiProducer.cc:38