CMS 3D CMS Logo

PFRecHitQTests.h
Go to the documentation of this file.
1 #ifndef RecoParticleFlow_PFClusterProducer_PFEcalRecHitQTests_h
2 #define RecoParticleFlow_PFClusterProducer_PFEcalRecHitQTests_h
3 
4 #include <memory>
13 
14 #include <iostream>
15 
16 //
17 // Quality test that checks threshold
18 //
20 public:
22 
24  : PFRecHitQTestBase(iConfig, cc), threshold_(iConfig.getParameter<double>("threshold")) {}
25 
26  void beginEvent(const edm::Event& event, const edm::EventSetup& iSetup) override {}
27 
28  bool test(reco::PFRecHit& hit, const EcalRecHit& rh, bool& clean, bool fullReadOut) override {
29  return fullReadOut or pass(hit);
30  }
31  bool test(reco::PFRecHit& hit, const HBHERecHit& rh, bool& clean) override { return pass(hit); }
32 
33  bool test(reco::PFRecHit& hit, const HFRecHit& rh, bool& clean) override { return pass(hit); }
34  bool test(reco::PFRecHit& hit, const HORecHit& rh, bool& clean) override { return pass(hit); }
35 
36  bool test(reco::PFRecHit& hit, const CaloTower& rh, bool& clean) override { return pass(hit); }
37 
38  bool test(reco::PFRecHit& hit, const HGCRecHit& rh, bool& clean) override { return pass(hit); }
39 
40 protected:
41  double threshold_;
42 
43  bool pass(const reco::PFRecHit& hit) { return hit.energy() > threshold_; }
44 };
45 
46 //
47 // Quality test that checks threshold read from the DB
48 //
50 public:
52 
54  : PFRecHitQTestBase(iConfig, cc),
55  applySelectionsToAllCrystals_(iConfig.getParameter<bool>("applySelectionsToAllCrystals")),
57 
58  void beginEvent(const edm::Event& event, const edm::EventSetup& iSetup) override {
59  ths_ = iSetup.getHandle(threshToken_);
60  }
61 
62  bool test(reco::PFRecHit& hit, const EcalRecHit& rh, bool& clean, bool fullReadOut) override {
64  return pass(hit);
65  return fullReadOut or pass(hit);
66  }
67  bool test(reco::PFRecHit& hit, const HBHERecHit& rh, bool& clean) override { return pass(hit); }
68 
69  bool test(reco::PFRecHit& hit, const HFRecHit& rh, bool& clean) override { return pass(hit); }
70  bool test(reco::PFRecHit& hit, const HORecHit& rh, bool& clean) override { return pass(hit); }
71 
72  bool test(reco::PFRecHit& hit, const CaloTower& rh, bool& clean) override { return pass(hit); }
73 
74  bool test(reco::PFRecHit& hit, const HGCRecHit& rh, bool& clean) override { return pass(hit); }
75 
76 protected:
79 
80  bool pass(const reco::PFRecHit& hit) {
81  float threshold = (*ths_)[hit.detId()];
82  return hit.energy() > threshold;
83  }
84 
85 private:
87 };
88 
89 //
90 // Quality test that checks kHCAL Severity
91 //
93 public:
95 
97  : PFRecHitQTestBase(iConfig, cc),
98  flagStr_(iConfig.getParameter<std::vector<std::string>>("flags")),
99  thresholds_(iConfig.getParameter<std::vector<int>>("maxSeverities")),
100  cleanThresholds_(iConfig.getParameter<std::vector<double>>("cleaningThresholds")),
102  qualityToken_(cc.esConsumes(edm::ESInputTag("", "withTopo"))),
104  for (auto& flag : flagStr_) {
105  if (flag == "Standard") {
106  flags_.push_back(-1);
107  depths_.push_back(-1);
108  } else if (flag == "HFInTime") {
110  depths_.push_back(-1);
111  } else if (flag == "HFDigi") {
112  flags_.push_back(1 << HcalCaloFlagLabels::HFDigiTime);
113  depths_.push_back(-1);
114  } else if (flag == "HFLong") {
115  flags_.push_back(1 << HcalCaloFlagLabels::HFLongShort);
116  depths_.push_back(1);
117  } else if (flag == "HFShort") {
118  flags_.push_back(1 << HcalCaloFlagLabels::HFLongShort);
119  depths_.push_back(2);
120  } else if (flag == "HFSignalAsymmetry") {
122  depths_.push_back(-1);
123  } else {
124  flags_.push_back(-1);
125  depths_.push_back(-1);
126  }
127  }
128  }
129 
130  void beginEvent(const edm::Event& event, const edm::EventSetup& iSetup) override {
134  }
135 
136  bool test(reco::PFRecHit& hit, const EcalRecHit& rh, bool& clean, bool fullReadOut) override { return true; }
137  bool test(reco::PFRecHit& hit, const HBHERecHit& rh, bool& clean) override {
138  return test(rh.detid(), rh.energy(), rh.flags(), clean);
139  }
140 
141  bool test(reco::PFRecHit& hit, const HFRecHit& rh, bool& clean) override {
142  return test(rh.detid(), rh.energy(), rh.flags(), clean);
143  }
144  bool test(reco::PFRecHit& hit, const HORecHit& rh, bool& clean) override {
145  return test(rh.detid(), rh.energy(), rh.flags(), clean);
146  }
147 
148  bool test(reco::PFRecHit& hit, const CaloTower& rh, bool& clean) override { return true; }
149 
150  bool test(reco::PFRecHit& hit, const HGCRecHit& rh, bool& clean) override { return true; }
151 
152 protected:
153  std::vector<std::string> flagStr_;
154  std::vector<int> thresholds_;
155  std::vector<double> cleanThresholds_;
156  std::vector<int> flags_;
157  std::vector<int> depths_;
161 
162  bool test(unsigned aDETID, double energy, int flags, bool& clean) {
163  HcalDetId detid = (HcalDetId)aDETID;
164  if (theHcalTopology_->getMergePositionFlag() and detid.subdet() == HcalEndcap) {
165  detid = theHcalTopology_->idFront(detid);
166  }
167 
168  const HcalChannelStatus* theStatus = theHcalChStatus_->getValues(detid);
169  unsigned theStatusValue = theStatus->getValue();
170  // Now get severity of problems for the given detID, based on the rechit flag word and the channel quality status value
171  for (unsigned int i = 0; i < thresholds_.size(); ++i) {
172  int hitSeverity = 0;
173  if (energy < cleanThresholds_[i])
174  continue;
175 
176  if (flags_[i] < 0) {
177  hitSeverity = hcalSevLvlComputer_->getSeverityLevel(detid, flags, theStatusValue);
178  } else {
179  hitSeverity = hcalSevLvlComputer_->getSeverityLevel(detid, flags & flags_[i], theStatusValue);
180  }
181 
182  if (hitSeverity > thresholds_[i] and ((depths_[i] < 0 or (depths_[i] == detid.depth())))) {
183  clean = true;
184  return false;
185  }
186  }
187  return true;
188  }
189 
190 private:
194 };
195 
196 //
197 // Quality test that applies threshold and timing as a function of depth
198 //
200 public:
202 
204  : PFRecHitQTestBase(iConfig, cc), psets_(iConfig.getParameter<std::vector<edm::ParameterSet>>("cuts")) {
205  for (auto& pset : psets_) {
206  depths_.push_back(pset.getParameter<int>("depth"));
207  minTimes_.push_back(pset.getParameter<double>("minTime"));
208  maxTimes_.push_back(pset.getParameter<double>("maxTime"));
209  thresholds_.push_back(pset.getParameter<double>("threshold"));
210  }
211  }
212 
213  void beginEvent(const edm::Event& event, const edm::EventSetup& iSetup) override {}
214 
215  bool test(reco::PFRecHit& hit, const EcalRecHit& rh, bool& clean, bool fullReadOut) override { return true; }
216  bool test(reco::PFRecHit& hit, const HBHERecHit& rh, bool& clean) override {
217  return test(rh.detid(), rh.energy(), rh.time(), clean);
218  }
219 
220  bool test(reco::PFRecHit& hit, const HFRecHit& rh, bool& clean) override {
221  return test(rh.detid(), rh.energy(), rh.time(), clean);
222  }
223  bool test(reco::PFRecHit& hit, const HORecHit& rh, bool& clean) override {
224  return test(rh.detid(), rh.energy(), rh.time(), clean);
225  }
226 
227  bool test(reco::PFRecHit& hit, const CaloTower& rh, bool& clean) override { return true; }
228 
229  bool test(reco::PFRecHit& hit, const HGCRecHit& rh, bool& clean) override { return true; }
230 
231 protected:
232  std::vector<edm::ParameterSet> psets_;
233  std::vector<int> depths_;
234  std::vector<double> minTimes_;
235  std::vector<double> maxTimes_;
236  std::vector<double> thresholds_;
237 
238  bool test(unsigned aDETID, double energy, double time, bool& clean) {
239  HcalDetId detid(aDETID);
240  for (unsigned int i = 0; i < depths_.size(); ++i) {
241  if (detid.depth() == depths_[i]) {
242  if ((time < minTimes_[i] or time > maxTimes_[i]) and energy > thresholds_[i]) {
243  clean = true;
244  return false;
245  }
246  break;
247  }
248  }
249  return true;
250  }
251 };
252 
253 //
254 // Quality test that applies threshold as a function of depth
255 //
257 public:
259 
261  : PFRecHitQTestBase(iConfig, cc), psets_(iConfig.getParameter<std::vector<edm::ParameterSet>>("cuts")) {
262  for (auto& pset : psets_) {
263  depths_.push_back(pset.getParameter<std::vector<int>>("depth"));
264  thresholds_.push_back(pset.getParameter<std::vector<double>>("threshold"));
265  detector_.push_back(pset.getParameter<int>("detectorEnum"));
266  if (thresholds_[thresholds_.size() - 1].size() != depths_[depths_.size() - 1].size()) {
267  throw cms::Exception("InvalidPFRecHitThreshold") << "PFRecHitThreshold mismatch with the numbers of depths";
268  }
269  }
270  }
271 
272  void beginEvent(const edm::Event& event, const edm::EventSetup& iSetup) override {}
273 
274  bool test(reco::PFRecHit& hit, const EcalRecHit& rh, bool& clean, bool fullReadOut) override { return true; }
275  bool test(reco::PFRecHit& hit, const HBHERecHit& rh, bool& clean) override {
276  return test(rh.detid(), rh.energy(), rh.time(), clean);
277  }
278 
279  bool test(reco::PFRecHit& hit, const HFRecHit& rh, bool& clean) override {
280  return test(rh.detid(), rh.energy(), rh.time(), clean);
281  }
282  bool test(reco::PFRecHit& hit, const HORecHit& rh, bool& clean) override {
283  return test(rh.detid(), rh.energy(), rh.time(), clean);
284  }
285 
286  bool test(reco::PFRecHit& hit, const CaloTower& rh, bool& clean) override { return true; }
287 
288  bool test(reco::PFRecHit& hit, const HGCRecHit& rh, bool& clean) override { return true; }
289 
290 protected:
291  std::vector<edm::ParameterSet> psets_;
292  std::vector<std::vector<int>> depths_;
293  std::vector<std::vector<double>> thresholds_;
294  std::vector<int> detector_;
295 
296  bool test(unsigned aDETID, double energy, double time, bool& clean) {
297  HcalDetId detid(aDETID);
298 
299  for (unsigned int d = 0; d < detector_.size(); ++d) {
300  if (detid.subdet() != detector_[d])
301  continue;
302  for (unsigned int i = 0; i < thresholds_[d].size(); ++i) {
303  if (detid.depth() == depths_[d][i]) {
304  if (energy < thresholds_[d][i]) {
305  clean = false;
306  return false;
307  }
308  break;
309  }
310  }
311  }
312  return true;
313  }
314 };
315 
316 //
317 // Quality test that checks HO threshold applying different threshold in rings
318 //
320 public:
322 
324  : PFRecHitQTestBase(iConfig, cc),
325  threshold0_(iConfig.getParameter<double>("threshold_ring0")),
326  threshold12_(iConfig.getParameter<double>("threshold_ring12")) {}
327 
328  void beginEvent(const edm::Event& event, const edm::EventSetup& iSetup) override {}
329 
330  bool test(reco::PFRecHit& hit, const EcalRecHit& rh, bool& clean, bool fullReadOut) override { return true; }
331 
332  bool test(reco::PFRecHit& hit, const HBHERecHit& rh, bool& clean) override { return true; }
333 
334  bool test(reco::PFRecHit& hit, const HFRecHit& rh, bool& clean) override { return true; }
335 
336  bool test(reco::PFRecHit& hit, const HORecHit& rh, bool& clean) override {
337  HcalDetId detid(rh.detid());
338  if (abs(detid.ieta()) <= 4 and hit.energy() > threshold0_)
339  return true;
340  if (abs(detid.ieta()) > 4 and hit.energy() > threshold12_)
341  return true;
342 
343  return false;
344  }
345 
346  bool test(reco::PFRecHit& hit, const CaloTower& rh, bool& clean) override { return true; }
347 
348  bool test(reco::PFRecHit& hit, const HGCRecHit& rh, bool& clean) override { return true; }
349 
350 protected:
351  const double threshold0_;
352  const double threshold12_;
353 };
354 
355 //
356 // Quality test that checks threshold as a function of ECAL eta-ring
357 //
363 public:
365 
367  : PFRecHitQTestBase(iConfig, cc),
368  thresholds_(iConfig.getParameter<std::vector<double>>("thresholds")),
369  applySelectionsToAllCrystals_(iConfig.getParameter<bool>("applySelectionsToAllCrystals")),
372  throw edm::Exception(edm::errors::Configuration, "ValueError")
373  << "thresholds is expected to have " << EcalRingCalibrationTools::N_RING_TOTAL << " elements but has "
374  << thresholds_.size();
375  }
376 
377  void beginEvent(const edm::Event& event, const edm::EventSetup& iSetup) override {
380  endcapGeometrySet_ = false;
381  if (endcapGeometry) {
383  endcapGeometrySet_ = true;
384  }
385  }
386 
387  bool test(reco::PFRecHit& hit, const EcalRecHit& rh, bool& clean, bool fullReadOut) override {
389  return pass(hit);
390  else
391  return fullReadOut or pass(hit);
392  }
393  bool test(reco::PFRecHit& hit, const HBHERecHit& rh, bool& clean) override { return true; }
394 
395  bool test(reco::PFRecHit& hit, const HFRecHit& rh, bool& clean) override { return true; }
396  bool test(reco::PFRecHit& hit, const HORecHit& rh, bool& clean) override { return true; }
397 
398  bool test(reco::PFRecHit& hit, const CaloTower& rh, bool& clean) override { return true; }
399 
400  bool test(reco::PFRecHit& hit, const HGCRecHit& rh, bool& clean) override { return true; }
401 
402 protected:
403  const std::vector<double> thresholds_;
405 
406  // apply selections to all crystals
408 
409  bool pass(const reco::PFRecHit& hit) {
410  DetId detId(hit.detId());
411 
412  // this is to skip endcap ZS for Phase2 until there is a defined geometry
413  // apply the loosest ZS threshold, for the first eta-ring in EB
414  if (not endcapGeometrySet_) {
415  // there is only ECAL EB in Phase 2
416  if (detId.subdetId() != EcalBarrel)
417  return true;
418 
419  // 0-169: EB eta-rings
420  // 170-208: EE- eta rings
421  // 209-247: EE+ eta rings
422  int firstEBRing = 0;
423  return (hit.energy() > thresholds_[firstEBRing]);
424  }
425 
427  if (hit.energy() > thresholds_[iring])
428  return true;
429 
430  return false;
431  }
432 
433 private:
435 };
436 
437 //
438 // Quality test that checks ecal quality cuts
439 //
441 public:
443 
445  : PFRecHitQTestBase(iConfig, cc),
446  thresholdCleaning_(iConfig.getParameter<double>("cleaningThreshold")),
447  timingCleaning_(iConfig.getParameter<bool>("timingCleaning")),
448  topologicalCleaning_(iConfig.getParameter<bool>("topologicalCleaning")),
449  skipTTRecoveredHits_(iConfig.getParameter<bool>("skipTTRecoveredHits")) {}
450 
451  void beginEvent(const edm::Event& event, const edm::EventSetup& iSetup) override {}
452 
453  bool test(reco::PFRecHit& hit, const EcalRecHit& rh, bool& clean, bool fullReadOut) override {
455  clean = true;
456  return false;
457  }
459  clean = true;
460  return false;
461  }
462 
464  clean = true;
465  return false;
466  }
467 
468  return true;
469  }
470 
471  bool test(reco::PFRecHit& hit, const HBHERecHit& rh, bool& clean) override { return true; }
472 
473  bool test(reco::PFRecHit& hit, const HFRecHit& rh, bool& clean) override { return true; }
474 
475  bool test(reco::PFRecHit& hit, const HORecHit& rh, bool& clean) override { return true; }
476 
477  bool test(reco::PFRecHit& hit, const CaloTower& rh, bool& clean) override { return true; }
478 
479  bool test(reco::PFRecHit& hit, const HGCRecHit& rh, bool& clean) override { return true; }
480 
481 protected:
486 };
487 
488 //
489 // Quality test that checks ES quality cuts
490 //
492 public:
494 
496  : PFRecHitQTestBase(iConfig, cc),
497  thresholdCleaning_(iConfig.getParameter<double>("cleaningThreshold")),
498  topologicalCleaning_(iConfig.getParameter<bool>("topologicalCleaning")) {}
499 
500  void beginEvent(const edm::Event& event, const edm::EventSetup& iSetup) override {}
501 
502  bool test(reco::PFRecHit& hit, const EcalRecHit& rh, bool& clean, bool fullReadOut) override {
503  if (rh.energy() < thresholdCleaning_) {
504  clean = false;
505  return false;
506  }
507 
508  if (topologicalCleaning_ and
513  clean = false;
514  return false;
515  }
516 
517  return true;
518  }
519 
520  bool test(reco::PFRecHit& hit, const HBHERecHit& rh, bool& clean) override { return true; }
521 
522  bool test(reco::PFRecHit& hit, const HFRecHit& rh, bool& clean) override { return true; }
523 
524  bool test(reco::PFRecHit& hit, const HORecHit& rh, bool& clean) override { return true; }
525 
526  bool test(reco::PFRecHit& hit, const CaloTower& rh, bool& clean) override { return true; }
527 
528  bool test(reco::PFRecHit& hit, const HGCRecHit& rh, bool& clean) override { return true; }
529 
530 protected:
531  const double thresholdCleaning_;
533 };
534 
535 //
536 // Quality test that calibrates tower 29 of HCAL
537 //
539 public:
541 
543  : PFRecHitQTestBase(iConfig, cc), calibFactor_(iConfig.getParameter<double>("calibFactor")) {}
544 
545  void beginEvent(const edm::Event& event, const edm::EventSetup& iSetup) override {}
546 
547  bool test(reco::PFRecHit& hit, const EcalRecHit& rh, bool& clean, bool fullReadOut) override { return true; }
548  bool test(reco::PFRecHit& hit, const HBHERecHit& rh, bool& clean) override {
549  HcalDetId detId(hit.detId());
550  if (abs(detId.ieta()) == 29)
551  hit.setEnergy(hit.energy() * calibFactor_);
552  return true;
553  }
554 
555  bool test(reco::PFRecHit& hit, const HFRecHit& rh, bool& clean) override { return true; }
556  bool test(reco::PFRecHit& hit, const HORecHit& rh, bool& clean) override { return true; }
557 
558  bool test(reco::PFRecHit& hit, const CaloTower& rh, bool& clean) override {
559  CaloTowerDetId detId(hit.detId());
560  if (detId.ietaAbs() == 29)
561  hit.setEnergy(hit.energy() * calibFactor_);
562  return true;
563  }
564 
565  bool test(reco::PFRecHit& hit, const HGCRecHit& rh, bool& clean) override { return true; }
566 
567 protected:
568  const float calibFactor_;
569 };
570 
572 public:
574 
576  : PFRecHitQTestBase(iConfig, cc),
577  recHitEnergy_keV_(iConfig.getParameter<bool>("recHitEnergyIs_keV")),
578  threshold_(iConfig.getParameter<double>("thresholdInMIPs")),
579  mip_(iConfig.getParameter<double>("mipValueInkeV")),
580  recHitEnergyMultiplier_(iConfig.getParameter<double>("recHitEnergyMultiplier")) {}
581 
582  void beginEvent(const edm::Event& event, const edm::EventSetup& iSetup) override {}
583 
584  bool test(reco::PFRecHit& hit, const EcalRecHit& rh, bool& clean, bool fullReadOut) override {
585  throw cms::Exception("WrongDetector") << "PFRecHitQTestThresholdInMIPs only works for HGCAL!";
586  return false;
587  }
588  bool test(reco::PFRecHit& hit, const HBHERecHit& rh, bool& clean) override {
589  throw cms::Exception("WrongDetector") << "PFRecHitQTestThresholdInMIPs only works for HGCAL!";
590  return false;
591  }
592 
593  bool test(reco::PFRecHit& hit, const HFRecHit& rh, bool& clean) override {
594  throw cms::Exception("WrongDetector") << "PFRecHitQTestThresholdInMIPs only works for HGCAL!";
595  return false;
596  }
597  bool test(reco::PFRecHit& hit, const HORecHit& rh, bool& clean) override {
598  throw cms::Exception("WrongDetector") << "PFRecHitQTestThresholdInMIPs only works for HGCAL!";
599  return false;
600  }
601 
602  bool test(reco::PFRecHit& hit, const CaloTower& rh, bool& clean) override {
603  throw cms::Exception("WrongDetector") << "PFRecHitQTestThresholdInMIPs only works for HGCAL!";
604  return false;
605  }
606 
607  bool test(reco::PFRecHit& hit, const HGCRecHit& rh, bool& clean) override {
608  const double newE =
610  hit.setEnergy(newE);
611  return pass(hit);
612  }
613 
614 protected:
615  const bool recHitEnergy_keV_;
617 
618  bool pass(const reco::PFRecHit& hit) {
619  const double hitValueInMIPs = 1e6 * hit.energy() / mip_;
620  return hitValueInMIPs > threshold_;
621  }
622 };
623 
626 public:
629 
631  : PFRecHitQTestBase(iConfig, cc),
632  geometryInstance_(iConfig.getParameter<std::string>("geometryInstance")),
633  recHitEnergy_keV_(iConfig.getParameter<bool>("recHitEnergyIs_keV")),
634  threshold_(iConfig.getParameter<double>("thresholdInMIPs")),
635  mip_(iConfig.getParameter<double>("mipValueInkeV")),
636  recHitEnergyMultiplier_(iConfig.getParameter<double>("recHitEnergyMultiplier")),
637  geomToken_(cc.esConsumes()) {}
638 
639  void beginEvent(const edm::Event& event, const edm::EventSetup& iSetup) override {
641  ddd_ = &(geoHandle->topology().dddConstants());
642  }
643 
644  bool test(reco::PFRecHit& hit, const EcalRecHit& rh, bool& clean, bool fullReadOut) override {
645  throw cms::Exception("WrongDetector") << "PFRecHitQTestThresholdInMIPs only works for HGCAL!";
646  return false;
647  }
648  bool test(reco::PFRecHit& hit, const HBHERecHit& rh, bool& clean) override {
649  throw cms::Exception("WrongDetector") << "PFRecHitQTestThresholdInMIPs only works for HGCAL!";
650  return false;
651  }
652 
653  bool test(reco::PFRecHit& hit, const HFRecHit& rh, bool& clean) override {
654  throw cms::Exception("WrongDetector") << "PFRecHitQTestThresholdInMIPs only works for HGCAL!";
655  return false;
656  }
657  bool test(reco::PFRecHit& hit, const HORecHit& rh, bool& clean) override {
658  throw cms::Exception("WrongDetector") << "PFRecHitQTestThresholdInMIPs only works for HGCAL!";
659  return false;
660  }
661 
662  bool test(reco::PFRecHit& hit, const CaloTower& rh, bool& clean) override {
663  throw cms::Exception("WrongDetector") << "PFRecHitQTestThresholdInMIPs only works for HGCAL!";
664  return false;
665  }
666 
667  bool test(reco::PFRecHit& hit, const HGCRecHit& rh, bool& clean) override {
668  const double newE =
670  const int wafer = HGCalDetId(rh.detid()).wafer();
671  const float mult = (float)ddd_->waferTypeL(wafer); // 1 for 100um, 2 for 200um, 3 for 300um
672  hit.setEnergy(newE);
673  return pass(hit, mult);
674  }
675 
676 protected:
678  const bool recHitEnergy_keV_;
681 
682  bool pass(const reco::PFRecHit& hit, const float mult) {
683  const double hitValueInMIPs = 1e6 * hit.energy() / (mult * mip_);
684  return hitValueInMIPs > threshold_;
685  }
686 
687 private:
689 };
690 
692 public:
694 
696  : PFRecHitQTestBase(iConfig, cc), thresholdSNR_(iConfig.getParameter<double>("thresholdSNR")) {}
697 
698  void beginEvent(const edm::Event& event, const edm::EventSetup& iSetup) override {}
699 
700  bool test(reco::PFRecHit& hit, const EcalRecHit& rh, bool& clean, bool fullReadOut) override {
701  throw cms::Exception("WrongDetector") << "PFRecHitQTestHGCalThresholdSNR only works for HGCAL!";
702  return false;
703  }
704  bool test(reco::PFRecHit& hit, const HBHERecHit& rh, bool& clean) override {
705  throw cms::Exception("WrongDetector") << "PFRecHitQTestHGCalThresholdSNR only works for HGCAL!";
706  return false;
707  }
708 
709  bool test(reco::PFRecHit& hit, const HFRecHit& rh, bool& clean) override {
710  throw cms::Exception("WrongDetector") << "PFRecHitQTestHGCalThresholdSNR only works for HGCAL!";
711  return false;
712  }
713  bool test(reco::PFRecHit& hit, const HORecHit& rh, bool& clean) override {
714  throw cms::Exception("WrongDetector") << "PFRecHitQTestHGCalThresholdSNR only works for HGCAL!";
715  return false;
716  }
717 
718  bool test(reco::PFRecHit& hit, const CaloTower& rh, bool& clean) override {
719  throw cms::Exception("WrongDetector") << "PFRecHitQTestHGCalThresholdSNR only works for HGCAL!";
720  return false;
721  }
722 
723  bool test(reco::PFRecHit& hit, const HGCRecHit& rh, bool& clean) override {
724  return rh.signalOverSigmaNoise() >= thresholdSNR_;
725  }
726 
727 protected:
728  const double thresholdSNR_;
729 };
730 
731 // M.G. Quality test that checks seeding threshold read from the DB
732 //
734 public:
736  : PFRecHitQTestBase(iConfig, cc),
737  applySelectionsToAllCrystals_(iConfig.getParameter<bool>("applySelectionsToAllCrystals")),
739 
740  void beginEvent(const edm::Event& event, const edm::EventSetup& iSetup) override {
741  ths_ = iSetup.getHandle(threshToken_);
742  }
743 
744  bool test(reco::PFRecHit& hit, const EcalRecHit& rh, bool& clean, bool fullReadOut) override {
746  return pass(hit);
747  return fullReadOut or pass(hit);
748  }
749  bool test(reco::PFRecHit& hit, const HBHERecHit& rh, bool& clean) override { return pass(hit); }
750 
751  bool test(reco::PFRecHit& hit, const HFRecHit& rh, bool& clean) override { return pass(hit); }
752  bool test(reco::PFRecHit& hit, const HORecHit& rh, bool& clean) override { return pass(hit); }
753 
754  bool test(reco::PFRecHit& hit, const CaloTower& rh, bool& clean) override { return pass(hit); }
755 
756  bool test(reco::PFRecHit& hit, const HGCRecHit& rh, bool& clean) override { return pass(hit); }
757 
758 protected:
761 
762  bool pass(const reco::PFRecHit& hit) {
763  float threshold = (*ths_)[hit.detId()];
764  return (hit.energy() > threshold);
765  }
766 
767 private:
769 };
770 
771 #endif
bool test(reco::PFRecHit &hit, const HGCRecHit &rh, bool &clean) override
bool test(reco::PFRecHit &hit, const HGCRecHit &rh, bool &clean) override
void beginEvent(const edm::Event &event, const edm::EventSetup &iSetup) override
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geomToken_
bool test(reco::PFRecHit &hit, const HBHERecHit &rh, bool &clean) override
bool test(reco::PFRecHit &hit, const HGCRecHit &rh, bool &clean) override
bool getMergePositionFlag() const
Definition: HcalTopology.h:167
bool test(reco::PFRecHit &hit, const HORecHit &rh, bool &clean) override
const HcalChannelQuality * theHcalChStatus_
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
bool test(reco::PFRecHit &hit, const HFRecHit &rh, bool &clean) override
bool test(reco::PFRecHit &hit, const HFRecHit &rh, bool &clean) override
PFRecHitQTestDBSeedingThreshold(const edm::ParameterSet &iConfig, edm::ConsumesCollector &cc)
void beginEvent(const edm::Event &event, const edm::EventSetup &iSetup) override
PFRecHitQTestES(const edm::ParameterSet &iConfig, edm::ConsumesCollector &cc)
edm::ESGetToken< HcalSeverityLevelComputer, HcalSeverityLevelComputerRcd > severityToken_
constexpr const DetId & detid() const
Definition: CaloRecHit.h:33
void beginEvent(const edm::Event &event, const edm::EventSetup &iSetup) override
static void setCaloGeometry(const CaloGeometry *geometry)
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
bool test(reco::PFRecHit &hit, const HGCRecHit &rh, bool &clean) override
bool test(reco::PFRecHit &hit, const CaloTower &rh, bool &clean) override
bool test(reco::PFRecHit &hit, const HBHERecHit &rh, bool &clean) override
std::vector< double > minTimes_
bool pass(const reco::PFRecHit &hit)
edm::ESGetToken< EcalPFSeedingThresholds, EcalPFSeedingThresholdsRcd > threshToken_
bool test(reco::PFRecHit &hit, const HGCRecHit &rh, bool &clean) override
bool test(reco::PFRecHit &hit, const HORecHit &rh, bool &clean) override
bool test(reco::PFRecHit &hit, const CaloTower &rh, bool &clean) override
bool test(reco::PFRecHit &hit, const HBHERecHit &rh, bool &clean) override
PFRecHitQTestHCALCalib29(const edm::ParameterSet &iConfig, edm::ConsumesCollector &cc)
uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
bool test(reco::PFRecHit &hit, const CaloTower &rh, bool &clean) override
bool test(reco::PFRecHit &hit, const CaloTower &rh, bool &clean) override
std::vector< int > depths_
PFRecHitQTestECALMultiThreshold(const edm::ParameterSet &iConfig, edm::ConsumesCollector &cc)
bool test(reco::PFRecHit &hit, const CaloTower &rh, bool &clean) override
bool test(reco::PFRecHit &hit, const EcalRecHit &rh, bool &clean, bool fullReadOut) override
float signalOverSigmaNoise() const
Definition: HGCRecHit.cc:72
bool pass(const reco::PFRecHit &hit, const float mult)
const HcalSeverityLevelComputer * hcalSevLvlComputer_
PFRecHitQTestDBThreshold(const edm::ParameterSet &iConfig, edm::ConsumesCollector &cc)
bool test(reco::PFRecHit &hit, const HFRecHit &rh, bool &clean) override
bool test(reco::PFRecHit &hit, const HBHERecHit &rh, bool &clean) override
std::vector< double > maxTimes_
bool test(reco::PFRecHit &hit, const EcalRecHit &rh, bool &clean, bool fullReadOut) override
bool test(reco::PFRecHit &hit, const HORecHit &rh, bool &clean) override
edm::ESGetToken< HcalTopology, HcalRecNumberingRecord > topoToken_
bool test(reco::PFRecHit &hit, const EcalRecHit &rh, bool &clean, bool fullReadOut) override
bool test(unsigned aDETID, double energy, double time, bool &clean)
bool test(reco::PFRecHit &hit, const HGCRecHit &rh, bool &clean) override
static short getRingIndex(DetId aDetId)
Retrieve the phi-ring index corresponding to a DetId.
bool test(reco::PFRecHit &hit, const HORecHit &rh, bool &clean) override
bool test(reco::PFRecHit &hit, const EcalRecHit &rh, bool &clean, bool fullReadOut) override
bool test(reco::PFRecHit &hit, const HFRecHit &rh, bool &clean) override
std::vector< double > cleanThresholds_
PFRecHitQTestHCALChannel(const edm::ParameterSet &iConfig, edm::ConsumesCollector &cc)
bool test(reco::PFRecHit &hit, const CaloTower &rh, bool &clean) override
std::vector< double > thresholds_
bool pass(const reco::PFRecHit &hit)
const HcalTopology * theHcalTopology_
bool test(reco::PFRecHit &hit, const HGCRecHit &rh, bool &clean) override
void beginEvent(const edm::Event &event, const edm::EventSetup &iSetup) override
bool test(reco::PFRecHit &hit, const HFRecHit &rh, bool &clean) override
const Item * getValues(DetId fId, bool throwOnFail=true) const
constexpr float energy() const
Definition: CaloRecHit.h:29
bool test(reco::PFRecHit &hit, const EcalRecHit &rh, bool &clean, bool fullReadOut) override
static void clean(char *s)
bool test(unsigned aDETID, double energy, double time, bool &clean)
bool test(reco::PFRecHit &hit, const EcalRecHit &rh, bool &clean, bool fullReadOut) override
bool test(reco::PFRecHit &hit, const CaloTower &rh, bool &clean) override
constexpr HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:138
bool test(reco::PFRecHit &hit, const HBHERecHit &rh, bool &clean) override
bool test(reco::PFRecHit &hit, const CaloTower &rh, bool &clean) override
bool test(reco::PFRecHit &hit, const EcalRecHit &rh, bool &clean, bool fullReadOut) override
bool test(reco::PFRecHit &hit, const HFRecHit &rh, bool &clean) override
bool test(reco::PFRecHit &hit, const HORecHit &rh, bool &clean) override
void beginEvent(const edm::Event &event, const edm::EventSetup &iSetup) override
void beginEvent(const edm::Event &event, const edm::EventSetup &iSetup) override
bool test(reco::PFRecHit &hit, const HGCRecHit &rh, bool &clean) override
Particle flow rechit (rechit + geometry and topology information). See clustering algorithm in PFClus...
Definition: PFRecHit.h:31
constexpr uint32_t flags() const
Definition: CaloRecHit.h:34
HcalDetId idFront(const HcalDetId &id) const
Definition: HcalTopology.h:170
bool test(reco::PFRecHit &hit, const HFRecHit &rh, bool &clean) override
bool test(reco::PFRecHit &hit, const EcalRecHit &rh, bool &clean, bool fullReadOut) override
PFRecHitQTestThreshold(const edm::ParameterSet &iConfig, edm::ConsumesCollector &cc)
PFRecHitQTestHCALTimeVsDepth(const edm::ParameterSet &iConfig, edm::ConsumesCollector &cc)
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
bool test(reco::PFRecHit &hit, const HORecHit &rh, bool &clean) override
bool test(reco::PFRecHit &hit, const HBHERecHit &rh, bool &clean) override
bool test(reco::PFRecHit &hit, const HORecHit &rh, bool &clean) override
bool pass(const reco::PFRecHit &hit)
void beginEvent(const edm::Event &event, const edm::EventSetup &iSetup) override
bool test(reco::PFRecHit &hit, const HORecHit &rh, bool &clean) override
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
void beginEvent(const edm::Event &event, const edm::EventSetup &iSetup) override
bool test(reco::PFRecHit &hit, const HGCRecHit &rh, bool &clean) override
bool test(reco::PFRecHit &hit, const EcalRecHit &rh, bool &clean, bool fullReadOut) override
bool test(reco::PFRecHit &hit, const CaloTower &rh, bool &clean) override
bool test(reco::PFRecHit &hit, const HGCRecHit &rh, bool &clean) override
edm::ESGetToken< HcalChannelQuality, HcalChannelQualityRcd > qualityToken_
bool test(reco::PFRecHit &hit, const HFRecHit &rh, bool &clean) override
bool test(reco::PFRecHit &hit, const CaloTower &rh, bool &clean) override
const std::vector< double > thresholds_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
bool test(reco::PFRecHit &hit, const HFRecHit &rh, bool &clean) override
const HGCalTopology & topology() const
d
Definition: ztail.py:151
bool test(reco::PFRecHit &hit, const HBHERecHit &rh, bool &clean) override
uint32_t getValue() const
PFRecHitQTestThresholdInThicknessNormalizedMIPs(const edm::ParameterSet &iConfig, edm::ConsumesCollector &cc)
PFRecHitQTestHCALThresholdVsDepth(const edm::ParameterSet &iConfig, edm::ConsumesCollector &cc)
void beginEvent(const edm::Event &event, const edm::EventSetup &iSetup) override
bool test(reco::PFRecHit &hit, const HGCRecHit &rh, bool &clean) override
void beginEvent(const edm::Event &event, const edm::EventSetup &iSetup) override
bool test(reco::PFRecHit &hit, const HGCRecHit &rh, bool &clean) override
PFRecHitQTestECAL(const edm::ParameterSet &iConfig, edm::ConsumesCollector &cc)
Definition: DetId.h:17
bool test(reco::PFRecHit &hit, const HBHERecHit &rh, bool &clean) override
bool test(reco::PFRecHit &hit, const HFRecHit &rh, bool &clean) override
bool test(reco::PFRecHit &hit, const EcalRecHit &rh, bool &clean, bool fullReadOut) override
static constexpr short N_RING_TOTAL
bool test(reco::PFRecHit &hit, const CaloTower &rh, bool &clean) override
bool test(reco::PFRecHit &hit, const HBHERecHit &rh, bool &clean) override
bool test(reco::PFRecHit &hit, const HBHERecHit &rh, bool &clean) override
std::vector< edm::ParameterSet > psets_
PFRecHitQTestHGCalThresholdSNR(const edm::ParameterSet &iConfig, edm::ConsumesCollector &cc)
void beginEvent(const edm::Event &event, const edm::EventSetup &iSetup) override
std::vector< int > depths_
bool test(reco::PFRecHit &hit, const HORecHit &rh, bool &clean) override
bool test(reco::PFRecHit &hit, const EcalRecHit &rh, bool &clean, bool fullReadOut) override
std::vector< std::vector< double > > thresholds_
edm::ESHandle< EcalPFRecHitThresholds > ths_
bool test(reco::PFRecHit &hit, const HBHERecHit &rh, bool &clean) override
bool test(reco::PFRecHit &hit, const HGCRecHit &rh, bool &clean) override
bool test(reco::PFRecHit &hit, const CaloTower &rh, bool &clean) override
PFRecHitQTestThresholdInMIPs(const edm::ParameterSet &iConfig, edm::ConsumesCollector &cc)
edm::ESGetToken< EcalPFRecHitThresholds, EcalPFRecHitThresholdsRcd > threshToken_
constexpr float time() const
Definition: CaloRecHit.h:31
bool test(reco::PFRecHit &hit, const HFRecHit &rh, bool &clean) override
bool test(reco::PFRecHit &hit, const HORecHit &rh, bool &clean) override
void beginEvent(const edm::Event &event, const edm::EventSetup &iSetup) override
void beginEvent(const edm::Event &event, const edm::EventSetup &iSetup) override
bool test(reco::PFRecHit &hit, const HFRecHit &rh, bool &clean) override
std::vector< std::string > flagStr_
HLT enums.
std::vector< int > thresholds_
bool test(reco::PFRecHit &hit, const HORecHit &rh, bool &clean) override
int waferTypeL(int wafer) const
bool test(reco::PFRecHit &hit, const HORecHit &rh, bool &clean) override
edm::ESHandle< EcalPFSeedingThresholds > ths_
bool test(reco::PFRecHit &hit, const HFRecHit &rh, bool &clean) override
int getSeverityLevel(const DetId &myid, const uint32_t &myflag, const uint32_t &mystatus) const
bool pass(const reco::PFRecHit &hit)
const bool topologicalCleaning_
edm::ESGetToken< HGCalGeometry, IdealGeometryRecord > geomToken_
bool test(reco::PFRecHit &hit, const HBHERecHit &rh, bool &clean) override
bool test(reco::PFRecHit &hit, const HBHERecHit &rh, bool &clean) override
bool test(unsigned aDETID, double energy, int flags, bool &clean)
std::vector< edm::ParameterSet > psets_
bool test(reco::PFRecHit &hit, const CaloTower &rh, bool &clean) override
void beginEvent(const edm::Event &event, const edm::EventSetup &iSetup) override
bool test(reco::PFRecHit &hit, const EcalRecHit &rh, bool &clean, bool fullReadOut) override
float energy() const
Definition: EcalRecHit.h:69
bool test(reco::PFRecHit &hit, const HBHERecHit &rh, bool &clean) override
bool pass(const reco::PFRecHit &hit)
const double thresholdCleaning_
bool test(reco::PFRecHit &hit, const HFRecHit &rh, bool &clean) override
bool test(reco::PFRecHit &hit, const CaloTower &rh, bool &clean) override
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34
std::vector< int > flags_
bool test(reco::PFRecHit &hit, const EcalRecHit &rh, bool &clean, bool fullReadOut) override
PFRecHitQTestHOThreshold(const edm::ParameterSet &iConfig, edm::ConsumesCollector &cc)
const HGCalDDDConstants & dddConstants() const
Definition: HGCalTopology.h:98
bool checkFlag(int flag) const
check if the flag is true
Definition: EcalRecHit.h:188
bool test(reco::PFRecHit &hit, const HORecHit &rh, bool &clean) override
Definition: event.py:1
bool test(reco::PFRecHit &hit, const EcalRecHit &rh, bool &clean, bool fullReadOut) override
bool test(reco::PFRecHit &hit, const HORecHit &rh, bool &clean) override
bool test(reco::PFRecHit &hit, const HGCRecHit &rh, bool &clean) override
std::vector< std::vector< int > > depths_
constexpr int depth() const
get the tower depth
Definition: HcalDetId.h:164