CMS 3D CMS Logo

GEMPadDigiProducer.cc
Go to the documentation of this file.
12 
16 
19 
20 #include <set>
21 
24 
26 public:
27  explicit GEMPadDigiProducer(const edm::ParameterSet& ps);
28 
29  ~GEMPadDigiProducer() override;
30 
31  void beginRun(const edm::Run&, const edm::EventSetup&) override;
32 
33  void produce(edm::Event&, const edm::EventSetup&) override;
34 
35  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
36 
37 private:
38  void buildPads(const GEMDigiCollection& digis, GEMPadDigiCollection& out_pads) const;
39  void buildPads16GE21(const GEMDigiCollection& digis, GEMPadDigiCollection& out_pads) const;
40  void checkValid(const GEMPadDigi& pad, const GEMDetId& id) const;
41  void checkGeometry() const;
42 
47  bool use16GE21_;
48 
50 };
51 
53  digis_ = ps.getParameter<edm::InputTag>("InputCollection");
54 
55  digi_token_ = consumes<GEMDigiCollection>(digis_);
56  geom_token_ = esConsumes<GEMGeometry, MuonGeometryRecord, edm::Transition::BeginRun>();
57 
58  produces<GEMPadDigiCollection>();
59  consumes<GEMDigiCollection>(digis_);
60 }
61 
63 
66  desc.add<edm::InputTag>("InputCollection", edm::InputTag("simMuonGEMDigis"));
67 
68  descriptions.add("simMuonGEMPadDigisDef", desc);
69 }
70 
71 void GEMPadDigiProducer::beginRun(const edm::Run& run, const edm::EventSetup& eventSetup) {
73  geometry_ = &*hGeom;
74  // check the number of parititions
75  if (geometry_->hasGE21()) {
76  use16GE21_ = (geometry_->chamber(GEMDetId(1, 1, 2, 1, 1, 0))->nEtaPartitions() ==
77  GEMPadDigi::NumberPartitions::GE21SplitStrip);
78  }
79 
80  checkGeometry();
81 }
82 
85  e.getByToken(digi_token_, hdigis);
86 
87  // Create empty output
88  std::unique_ptr<GEMPadDigiCollection> pPads(new GEMPadDigiCollection());
89 
90  // build the pads
91  buildPads(*(hdigis.product()), *pPads);
92  if (use16GE21_)
93  buildPads16GE21(*(hdigis.product()), *pPads);
94 
95  // store them in the event
96  e.put(std::move(pPads));
97 }
98 
99 void GEMPadDigiProducer::buildPads(const GEMDigiCollection& det_digis, GEMPadDigiCollection& out_pads) const {
100  for (const auto& p : geometry_->etaPartitions()) {
101  // when using the GE2/1 geometry with 16 eta partitions
102  // ->ignore GE2/1
103  if (use16GE21_ and p->isGE21())
104  continue;
105 
106  // set of <pad, bx, part> pairs, sorted first by pad then by bx
107  std::set<std::tuple<int, int, unsigned> > proto_pads;
108 
109  // walk over digis in this partition,
110  // and stuff them into a set of unique pads (equivalent of OR operation)
111  auto digis = det_digis.get(p->id());
112  for (auto d = digis.first; d != digis.second; ++d) {
113  unsigned pad_num = static_cast<unsigned>(p->padOfStrip(d->strip()));
114 
115  auto nPart = GEMPadDigi::NumberPartitions::GE11;
116  if (p->isME0()) {
118  } else if (p->isGE21()) {
119  nPart = GEMPadDigi::NumberPartitions::GE21;
120  }
121  // check that the input digi is valid
122  if ((p->isGE11() and pad_num == GEMPadDigi::GE11InValid) or
123  (p->isGE21() and pad_num == GEMPadDigi::GE21InValid) or (p->isME0() and pad_num == GEMPadDigi::ME0InValid)) {
124  edm::LogWarning("GEMPadDigiProducer") << "Invalid " << pad_num << " from " << *d << " in " << p->id();
125  }
126  proto_pads.emplace(pad_num, d->bx(), nPart);
127  }
128 
129  // fill the output collections
130  for (const auto& d : proto_pads) {
131  GEMPadDigi pad_digi(std::get<0>(d), std::get<1>(d), p->subsystem(), std::get<2>(d));
132  checkValid(pad_digi, p->id());
133  out_pads.insertDigi(p->id(), pad_digi);
134  }
135  }
136 }
137 
139  for (const auto& p : geometry_->etaPartitions()) {
140  // when using the GE2/1 geometry with 16 eta partitions
141  // ->ignore GE1/1
142  if (!p->isGE21())
143  continue;
144 
145  // ignore eta partition with even numbers
146  // these are included in the odd numbered pads
147  if (p->id().roll() % 2 == 0)
148  continue;
149 
150  // set of <pad, bx> pairs, sorted first by pad then by bx
151  std::set<std::pair<int, int> > proto_pads;
152 
153  // walk over digis in the first partition,
154  // and stuff them into a set of unique pads (equivalent of OR operation)
155  auto digis = det_digis.get(p->id());
156 
157  GEMDetId gemId2(
158  p->id().region(), p->id().ring(), p->id().station(), p->id().layer(), p->id().chamber(), p->id().roll() + 1);
159  auto digis2 = det_digis.get(gemId2);
160 
161  for (auto d = digis.first; d != digis.second; ++d) {
162  // check if the strip digi in the eta partition below also has a digi
163  for (auto d2 = digis2.first; d2 != digis2.second; ++d2) {
164  if (d->strip() == d2->strip()) {
165  proto_pads.emplace(d->strip(), d->bx());
166  }
167  }
168  }
169 
170  // fill the output collections
171  for (const auto& d : proto_pads) {
172  GEMPadDigi pad_digi(d.first, d.second, p->subsystem(), GEMPadDigi::NumberPartitions::GE21SplitStrip);
173  checkValid(pad_digi, p->id());
174  out_pads.insertDigi(p->id(), pad_digi);
175  }
176  }
177 }
178 
179 void GEMPadDigiProducer::checkValid(const GEMPadDigi& pad, const GEMDetId& id) const {
180  // check if the pad is valid
181  // in principle, invalid pads can appear in the CMS raw data
182  if (!pad.isValid()) {
183  edm::LogWarning("GEMPadDigiProducer") << "Invalid " << pad << " in " << id;
184  }
185 }
186 
188  // check that ME0 has 8-eta partitions
189  if (geometry_->hasME0()) {
191  edm::LogError("GEMPadDigiProducer") << "ME0 geometry appears corrupted";
192  }
193  }
194 
195  // check that GE1/1 has 8-eta partitions
196  if (geometry_->hasGE11()) {
197  if (geometry_->chamber(GEMDetId(1, 1, 1, 1, 1, 0))->nEtaPartitions() != GEMPadDigi::NumberPartitions::GE11) {
198  edm::LogError("GEMPadDigiProducer") << "GE1/1 geometry appears corrupted";
199  }
200  }
201 
202  if (geometry_->hasGE21()) {
203  if (!use16GE21_) {
204  // check that GE2/1 has 8-eta partitions
205  if (geometry_->chamber(GEMDetId(1, 1, 2, 1, 1, 0))->nEtaPartitions() != GEMPadDigi::NumberPartitions::GE21) {
206  edm::LogError("GEMPadDigiProducer") << "GE2/1 geometry (8 partition) appears corrupted";
207  }
208  } else {
209  // check that GE2/1 has 16-eta partitions
210  if (geometry_->chamber(GEMDetId(1, 1, 2, 1, 1, 0))->nEtaPartitions() !=
211  GEMPadDigi::NumberPartitions::GE21SplitStrip) {
212  edm::LogError("GEMPadDigiProducer") << "GE2/1 geometry (16 partition) appears corrupted";
213  }
214  }
215  }
216 }
217 
GEMPadDigiProducer::checkValid
void checkValid(const GEMPadDigi &pad, const GEMDetId &id) const
Definition: GEMPadDigiProducer.cc:179
l1t::mtf7::ME0
ME0 Data Record : block->header().getID() = 6.
Definition: Block.h:23
Handle.h
GEMPadDigi::ME0InValid
Definition: GEMPadDigi.h:19
GEMPadDigiProducer::use16GE21_
bool use16GE21_
Definition: GEMPadDigiProducer.cc:47
MessageLogger.h
edm::Handle::product
T const * product() const
Definition: Handle.h:70
ESHandle.h
GEMPadDigi
Definition: GEMPadDigi.h:17
edm::Run
Definition: Run.h:45
edm::EDGetTokenT< GEMDigiCollection >
GEMPadDigi::GE11InValid
Definition: GEMPadDigi.h:19
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89287
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
GEMPadDigiCollection
MuonDigiCollection< GEMDetId, GEMPadDigi > GEMPadDigiCollection
Definition: GEMPadDigiCollection.h:13
EDProducer.h
GEMGeometry::hasME0
bool hasME0() const
Definition: GEMGeometry.cc:111
edm::Handle< GEMDigiCollection >
ESGetToken.h
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
GEMPadDigiProducer::checkGeometry
void checkGeometry() const
Definition: GEMPadDigiProducer.cc:187
MakerMacros.h
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:44
GEMPadDigiProducer::~GEMPadDigiProducer
~GEMPadDigiProducer() override
Definition: GEMPadDigiProducer.cc:62
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
nPart
TString nPart(Int_t part, TString string, TString delimit=";", Bool_t removerest=true)
GEMPadDigiProducer::buildPads16GE21
void buildPads16GE21(const GEMDigiCollection &digis, GEMPadDigiCollection &out_pads) const
Definition: GEMPadDigiProducer.cc:138
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
GEMDetId
Definition: GEMDetId.h:18
GEMPadDigiProducer::buildPads
void buildPads(const GEMDigiCollection &digis, GEMPadDigiCollection &out_pads) const
Definition: GEMPadDigiProducer.cc:99
GEMPadDigiProducer::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition: GEMPadDigiProducer.cc:83
edm::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:148
GEMGeometry::hasGE21
bool hasGE21() const
Definition: GEMGeometry.cc:115
edm::stream::EDProducer
Definition: EDProducer.h:38
edm::EventSetup
Definition: EventSetup.h:57
GEMPadDigi::GE21InValid
Definition: GEMPadDigi.h:19
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
GEMGeometry::hasGE11
bool hasGE11() const
Definition: GEMGeometry.cc:113
GEMPadDigiProducer::GEMPadDigiProducer
GEMPadDigiProducer(const edm::ParameterSet &ps)
Definition: GEMPadDigiProducer.cc:52
edm::ESGetToken< GEMGeometry, MuonGeometryRecord >
GEMPadDigiProducer::geometry_
const GEMGeometry * geometry_
Definition: GEMPadDigiProducer.cc:49
GEMChamber::nEtaPartitions
int nEtaPartitions() const
Retunr numbers of eta partitions.
Definition: GEMChamber.cc:31
InputTag.h
GEMPadDigiProducer::digis_
edm::InputTag digis_
Definition: GEMPadDigiProducer.cc:46
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
GEMGeometry.h
eostools.move
def move(src, dest)
Definition: eostools.py:511
GEMPadDigiProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: GEMPadDigiProducer.cc:64
writedatasetfile.run
run
Definition: writedatasetfile.py:27
GEMPadDigiProducer
Definition: GEMPadDigiProducer.cc:25
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
GEMDigiCollection
GEMPadDigiCollection.h
EventSetup.h
or
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
GEMPadDigiProducer::beginRun
void beginRun(const edm::Run &, const edm::EventSetup &) override
Definition: GEMPadDigiProducer.cc:71
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
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
GEMPadDigi::isValid
bool isValid() const
Definition: GEMPadDigi.cc:26
ParameterSet.h
GEMGeometry::chamber
const GEMChamber * chamber(GEMDetId id) const
Definition: GEMGeometry.cc:73
MuonGeometryRecord.h
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
GEMPadDigiProducer::geom_token_
edm::ESGetToken< GEMGeometry, MuonGeometryRecord > geom_token_
Definition: GEMPadDigiProducer.cc:45
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37