CMS 3D CMS Logo

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