CMS 3D CMS Logo

GEMPadDigiProducer.cc
Go to the documentation of this file.
11 
15 
18 
19 #include <set>
20 
23 
25 public:
26  explicit GEMPadDigiProducer(const edm::ParameterSet& ps);
27 
28  ~GEMPadDigiProducer() override;
29 
30  void beginRun(const edm::Run&, const edm::EventSetup&) override;
31 
32  void produce(edm::Event&, const edm::EventSetup&) override;
33 
34  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
35 
36 private:
37  void buildPads(const GEMDigiCollection& digis, GEMPadDigiCollection& out_pads) const;
38 
42 
44 };
45 
47  digis_ = ps.getParameter<edm::InputTag>("InputCollection");
48 
49  digi_token_ = consumes<GEMDigiCollection>(digis_);
50 
51  produces<GEMPadDigiCollection>();
52  consumes<GEMDigiCollection>(digis_);
53 }
54 
56 
59  desc.add<edm::InputTag>("InputCollection", edm::InputTag("simMuonGEMDigis"));
60 
61  descriptions.add("simMuonGEMPadDigisDef", desc);
62 }
63 
64 void GEMPadDigiProducer::beginRun(const edm::Run& run, const edm::EventSetup& eventSetup) {
66  eventSetup.get<MuonGeometryRecord>().get(hGeom);
67  geometry_ = &*hGeom;
68 }
69 
72  e.getByToken(digi_token_, hdigis);
73 
74  // Create empty output
75  std::unique_ptr<GEMPadDigiCollection> pPads(new GEMPadDigiCollection());
76 
77  // build the pads
78  buildPads(*(hdigis.product()), *pPads);
79 
80  // store them in the event
81  e.put(std::move(pPads));
82 }
83 
84 void GEMPadDigiProducer::buildPads(const GEMDigiCollection& det_digis, GEMPadDigiCollection& out_pads) const {
85  for (const auto& p : geometry_->etaPartitions()) {
86  // set of <pad, bx> pairs, sorted first by pad then by bx
87  std::set<std::pair<int, int> > proto_pads;
88 
89  // walk over digis in this partition,
90  // and stuff them into a set of unique pads (equivalent of OR operation)
91  auto digis = det_digis.get(p->id());
92  for (auto d = digis.first; d != digis.second; ++d) {
93  int pad_num = static_cast<int>(p->padOfStrip(d->strip()));
94  proto_pads.emplace(pad_num, d->bx());
95  }
96 
97  // fill the output collections
98  for (const auto& d : proto_pads) {
99  GEMPadDigi pad_digi(d.first, d.second);
100  out_pads.insertDigi(p->id(), pad_digi);
101  }
102  }
103 }
104 
Handle.h
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
MessageLogger.h
edm::Handle::product
T const * product() const
Definition: Handle.h:70
ESHandle.h
GEMPadDigi
Definition: GEMPadDigi.h:15
edm::Run
Definition: Run.h:45
edm::EDGetTokenT< GEMDigiCollection >
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
GEMPadDigiCollection
MuonDigiCollection< GEMDetId, GEMPadDigi > GEMPadDigiCollection
Definition: GEMPadDigiCollection.h:13
EDProducer.h
edm::Handle< GEMDigiCollection >
MakerMacros.h
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
edm::ESHandle< GEMGeometry >
GEMPadDigiCollection
GEMPadDigiProducer::digi_token_
edm::EDGetTokenT< GEMDigiCollection > digi_token_
Name of input digi Collection.
Definition: GEMPadDigiProducer.cc:40
GEMPadDigiProducer::~GEMPadDigiProducer
~GEMPadDigiProducer() override
Definition: GEMPadDigiProducer.cc:55
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
edm::ParameterSet
Definition: ParameterSet.h:36
Event.h
GEMPadDigiProducer::buildPads
void buildPads(const GEMDigiCollection &digis, GEMPadDigiCollection &out_pads) const
Definition: GEMPadDigiProducer.cc:84
GEMPadDigiProducer::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition: GEMPadDigiProducer.cc:70
edm::stream::EDProducer
Definition: EDProducer.h:38
edm::EventSetup
Definition: EventSetup.h:57
get
#define get
GEMPadDigiProducer::GEMPadDigiProducer
GEMPadDigiProducer(const edm::ParameterSet &ps)
Definition: GEMPadDigiProducer.cc:46
GEMPadDigiProducer::geometry_
const GEMGeometry * geometry_
Definition: GEMPadDigiProducer.cc:43
InputTag.h
GEMPadDigiProducer::digis_
edm::InputTag digis_
Definition: GEMPadDigiProducer.cc:41
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
GEMGeometry.h
eostools.move
def move(src, dest)
Definition: eostools.py:511
GEMPadDigiProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: GEMPadDigiProducer.cc:57
writedatasetfile.run
run
Definition: writedatasetfile.py:27
GEMPadDigiProducer
Definition: GEMPadDigiProducer.cc:24
GEMDigiCollection
GEMPadDigiCollection.h
EventSetup.h
GEMPadDigiProducer::beginRun
void beginRun(const edm::Run &, const edm::EventSetup &) override
Definition: GEMPadDigiProducer.cc:64
Exception.h
GEMDigiCollection.h
GEMGeometry::etaPartitions
const std::vector< const GEMEtaPartition * > & etaPartitions() const
Return a vector of all GEM eta partitions.
Definition: GEMGeometry.cc:40
GEMGeometry
Definition: GEMGeometry.h:24
ztail.d
d
Definition: ztail.py:151
ConsumesCollector.h
ParameterSet.h
MuonGeometryRecord.h
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