CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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")),
56  threshToken_(cc.esConsumes()) {}
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")),
101  topoToken_(cc.esConsumes()),
102  qualityToken_(cc.esConsumes(edm::ESInputTag("", "withTopo"))),
103  severityToken_(cc.esConsumes()) {
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_ = pset.getParameter<std::vector<int> >("depth");
264  thresholds_ = pset.getParameter<std::vector<double> >("threshold");
265  detector_ = pset.getParameter<int>("detectorEnum");
266  if (thresholds_.size() != depths_.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<int> depths_;
293  std::vector<double> thresholds_;
295 
296  bool test(unsigned aDETID, double energy, double time, bool& clean) {
297  HcalDetId detid(aDETID);
298 
299  for (unsigned int i = 0; i < thresholds_.size(); ++i) {
300  if (detid.depth() == depths_[i] && detid.subdet() == detector_) {
301  if (energy < thresholds_[i]) {
302  clean = false;
303  return false;
304  }
305  break;
306  }
307  }
308  return true;
309  }
310 };
311 
312 //
313 // Quality test that checks HO threshold applying different threshold in rings
314 //
316 public:
318 
320  : PFRecHitQTestBase(iConfig, cc),
321  threshold0_(iConfig.getParameter<double>("threshold_ring0")),
322  threshold12_(iConfig.getParameter<double>("threshold_ring12")) {}
323 
324  void beginEvent(const edm::Event& event, const edm::EventSetup& iSetup) override {}
325 
326  bool test(reco::PFRecHit& hit, const EcalRecHit& rh, bool& clean, bool fullReadOut) override { return true; }
327 
328  bool test(reco::PFRecHit& hit, const HBHERecHit& rh, bool& clean) override { return true; }
329 
330  bool test(reco::PFRecHit& hit, const HFRecHit& rh, bool& clean) override { return true; }
331 
332  bool test(reco::PFRecHit& hit, const HORecHit& rh, bool& clean) override {
333  HcalDetId detid(rh.detid());
334  if (abs(detid.ieta()) <= 4 and hit.energy() > threshold0_)
335  return true;
336  if (abs(detid.ieta()) > 4 and hit.energy() > threshold12_)
337  return true;
338 
339  return false;
340  }
341 
342  bool test(reco::PFRecHit& hit, const CaloTower& rh, bool& clean) override { return true; }
343 
344  bool test(reco::PFRecHit& hit, const HGCRecHit& rh, bool& clean) override { return true; }
345 
346 protected:
347  const double threshold0_;
348  const double threshold12_;
349 };
350 
351 //
352 // Quality test that checks threshold as a function of ECAL eta-ring
353 //
359 public:
361 
363  : PFRecHitQTestBase(iConfig, cc),
364  thresholds_(iConfig.getParameter<std::vector<double> >("thresholds")),
365  applySelectionsToAllCrystals_(iConfig.getParameter<bool>("applySelectionsToAllCrystals")),
366  geomToken_(cc.esConsumes()) {
368  throw edm::Exception(edm::errors::Configuration, "ValueError")
369  << "thresholds is expected to have " << EcalRingCalibrationTools::N_RING_TOTAL << " elements but has "
370  << thresholds_.size();
371  }
372 
373  void beginEvent(const edm::Event& event, const edm::EventSetup& iSetup) override {
375  CaloSubdetectorGeometry const* endcapGeometry = pG->getSubdetectorGeometry(DetId::Ecal, EcalEndcap);
376  endcapGeometrySet_ = false;
377  if (endcapGeometry) {
379  endcapGeometrySet_ = true;
380  }
381  }
382 
383  bool test(reco::PFRecHit& hit, const EcalRecHit& rh, bool& clean, bool fullReadOut) override {
385  return pass(hit);
386  else
387  return fullReadOut or pass(hit);
388  }
389  bool test(reco::PFRecHit& hit, const HBHERecHit& rh, bool& clean) override { return true; }
390 
391  bool test(reco::PFRecHit& hit, const HFRecHit& rh, bool& clean) override { return true; }
392  bool test(reco::PFRecHit& hit, const HORecHit& rh, bool& clean) override { return true; }
393 
394  bool test(reco::PFRecHit& hit, const CaloTower& rh, bool& clean) override { return true; }
395 
396  bool test(reco::PFRecHit& hit, const HGCRecHit& rh, bool& clean) override { return true; }
397 
398 protected:
399  const std::vector<double> thresholds_;
401 
402  // apply selections to all crystals
404 
405  bool pass(const reco::PFRecHit& hit) {
406  DetId detId(hit.detId());
407 
408  // this is to skip endcap ZS for Phase2 until there is a defined geometry
409  // apply the loosest ZS threshold, for the first eta-ring in EB
410  if (not endcapGeometrySet_) {
411  // there is only ECAL EB in Phase 2
412  if (detId.subdetId() != EcalBarrel)
413  return true;
414 
415  // 0-169: EB eta-rings
416  // 170-208: EE- eta rings
417  // 209-247: EE+ eta rings
418  int firstEBRing = 0;
419  return (hit.energy() > thresholds_[firstEBRing]);
420  }
421 
422  int iring = EcalRingCalibrationTools::getRingIndex(detId);
423  if (hit.energy() > thresholds_[iring])
424  return true;
425 
426  return false;
427  }
428 
429 private:
431 };
432 
433 //
434 // Quality test that checks ecal quality cuts
435 //
437 public:
439 
441  : PFRecHitQTestBase(iConfig, cc),
442  thresholdCleaning_(iConfig.getParameter<double>("cleaningThreshold")),
443  timingCleaning_(iConfig.getParameter<bool>("timingCleaning")),
444  topologicalCleaning_(iConfig.getParameter<bool>("topologicalCleaning")),
445  skipTTRecoveredHits_(iConfig.getParameter<bool>("skipTTRecoveredHits")) {}
446 
447  void beginEvent(const edm::Event& event, const edm::EventSetup& iSetup) override {}
448 
449  bool test(reco::PFRecHit& hit, const EcalRecHit& rh, bool& clean, bool fullReadOut) override {
451  clean = true;
452  return false;
453  }
455  clean = true;
456  return false;
457  }
458 
460  clean = true;
461  return false;
462  }
463 
464  return true;
465  }
466 
467  bool test(reco::PFRecHit& hit, const HBHERecHit& rh, bool& clean) override { return true; }
468 
469  bool test(reco::PFRecHit& hit, const HFRecHit& rh, bool& clean) override { return true; }
470 
471  bool test(reco::PFRecHit& hit, const HORecHit& rh, bool& clean) override { return true; }
472 
473  bool test(reco::PFRecHit& hit, const CaloTower& rh, bool& clean) override { return true; }
474 
475  bool test(reco::PFRecHit& hit, const HGCRecHit& rh, bool& clean) override { return true; }
476 
477 protected:
482 };
483 
484 //
485 // Quality test that checks ES quality cuts
486 //
488 public:
490 
492  : PFRecHitQTestBase(iConfig, cc),
493  thresholdCleaning_(iConfig.getParameter<double>("cleaningThreshold")),
494  topologicalCleaning_(iConfig.getParameter<bool>("topologicalCleaning")) {}
495 
496  void beginEvent(const edm::Event& event, const edm::EventSetup& iSetup) override {}
497 
498  bool test(reco::PFRecHit& hit, const EcalRecHit& rh, bool& clean, bool fullReadOut) override {
499  if (rh.energy() < thresholdCleaning_) {
500  clean = false;
501  return false;
502  }
503 
504  if (topologicalCleaning_ and
509  clean = false;
510  return false;
511  }
512 
513  return true;
514  }
515 
516  bool test(reco::PFRecHit& hit, const HBHERecHit& rh, bool& clean) override { return true; }
517 
518  bool test(reco::PFRecHit& hit, const HFRecHit& rh, bool& clean) override { return true; }
519 
520  bool test(reco::PFRecHit& hit, const HORecHit& rh, bool& clean) override { return true; }
521 
522  bool test(reco::PFRecHit& hit, const CaloTower& rh, bool& clean) override { return true; }
523 
524  bool test(reco::PFRecHit& hit, const HGCRecHit& rh, bool& clean) override { return true; }
525 
526 protected:
527  const double thresholdCleaning_;
529 };
530 
531 //
532 // Quality test that calibrates tower 29 of HCAL
533 //
535 public:
537 
539  : PFRecHitQTestBase(iConfig, cc), calibFactor_(iConfig.getParameter<double>("calibFactor")) {}
540 
541  void beginEvent(const edm::Event& event, const edm::EventSetup& iSetup) override {}
542 
543  bool test(reco::PFRecHit& hit, const EcalRecHit& rh, bool& clean, bool fullReadOut) override { return true; }
544  bool test(reco::PFRecHit& hit, const HBHERecHit& rh, bool& clean) override {
545  HcalDetId detId(hit.detId());
546  if (abs(detId.ieta()) == 29)
547  hit.setEnergy(hit.energy() * calibFactor_);
548  return true;
549  }
550 
551  bool test(reco::PFRecHit& hit, const HFRecHit& rh, bool& clean) override { return true; }
552  bool test(reco::PFRecHit& hit, const HORecHit& rh, bool& clean) override { return true; }
553 
554  bool test(reco::PFRecHit& hit, const CaloTower& rh, bool& clean) override {
555  CaloTowerDetId detId(hit.detId());
556  if (detId.ietaAbs() == 29)
557  hit.setEnergy(hit.energy() * calibFactor_);
558  return true;
559  }
560 
561  bool test(reco::PFRecHit& hit, const HGCRecHit& rh, bool& clean) override { return true; }
562 
563 protected:
564  const float calibFactor_;
565 };
566 
568 public:
570 
572  : PFRecHitQTestBase(iConfig, cc),
573  recHitEnergy_keV_(iConfig.getParameter<bool>("recHitEnergyIs_keV")),
574  threshold_(iConfig.getParameter<double>("thresholdInMIPs")),
575  mip_(iConfig.getParameter<double>("mipValueInkeV")),
576  recHitEnergyMultiplier_(iConfig.getParameter<double>("recHitEnergyMultiplier")) {}
577 
578  void beginEvent(const edm::Event& event, const edm::EventSetup& iSetup) override {}
579 
580  bool test(reco::PFRecHit& hit, const EcalRecHit& rh, bool& clean, bool fullReadOut) override {
581  throw cms::Exception("WrongDetector") << "PFRecHitQTestThresholdInMIPs only works for HGCAL!";
582  return false;
583  }
584  bool test(reco::PFRecHit& hit, const HBHERecHit& rh, bool& clean) override {
585  throw cms::Exception("WrongDetector") << "PFRecHitQTestThresholdInMIPs only works for HGCAL!";
586  return false;
587  }
588 
589  bool test(reco::PFRecHit& hit, const HFRecHit& rh, bool& clean) override {
590  throw cms::Exception("WrongDetector") << "PFRecHitQTestThresholdInMIPs only works for HGCAL!";
591  return false;
592  }
593  bool test(reco::PFRecHit& hit, const HORecHit& rh, bool& clean) override {
594  throw cms::Exception("WrongDetector") << "PFRecHitQTestThresholdInMIPs only works for HGCAL!";
595  return false;
596  }
597 
598  bool test(reco::PFRecHit& hit, const CaloTower& rh, bool& clean) override {
599  throw cms::Exception("WrongDetector") << "PFRecHitQTestThresholdInMIPs only works for HGCAL!";
600  return false;
601  }
602 
603  bool test(reco::PFRecHit& hit, const HGCRecHit& rh, bool& clean) override {
604  const double newE =
606  hit.setEnergy(newE);
607  return pass(hit);
608  }
609 
610 protected:
611  const bool recHitEnergy_keV_;
613 
614  bool pass(const reco::PFRecHit& hit) {
615  const double hitValueInMIPs = 1e6 * hit.energy() / mip_;
616  return hitValueInMIPs > threshold_;
617  }
618 };
619 
622 public:
625 
627  : PFRecHitQTestBase(iConfig, cc),
628  geometryInstance_(iConfig.getParameter<std::string>("geometryInstance")),
629  recHitEnergy_keV_(iConfig.getParameter<bool>("recHitEnergyIs_keV")),
630  threshold_(iConfig.getParameter<double>("thresholdInMIPs")),
631  mip_(iConfig.getParameter<double>("mipValueInkeV")),
632  recHitEnergyMultiplier_(iConfig.getParameter<double>("recHitEnergyMultiplier")),
633  geomToken_(cc.esConsumes()) {}
634 
635  void beginEvent(const edm::Event& event, const edm::EventSetup& iSetup) override {
637  ddd_ = &(geoHandle->topology().dddConstants());
638  }
639 
640  bool test(reco::PFRecHit& hit, const EcalRecHit& rh, bool& clean, bool fullReadOut) override {
641  throw cms::Exception("WrongDetector") << "PFRecHitQTestThresholdInMIPs only works for HGCAL!";
642  return false;
643  }
644  bool test(reco::PFRecHit& hit, const HBHERecHit& rh, bool& clean) override {
645  throw cms::Exception("WrongDetector") << "PFRecHitQTestThresholdInMIPs only works for HGCAL!";
646  return false;
647  }
648 
649  bool test(reco::PFRecHit& hit, const HFRecHit& rh, bool& clean) override {
650  throw cms::Exception("WrongDetector") << "PFRecHitQTestThresholdInMIPs only works for HGCAL!";
651  return false;
652  }
653  bool test(reco::PFRecHit& hit, const HORecHit& rh, bool& clean) override {
654  throw cms::Exception("WrongDetector") << "PFRecHitQTestThresholdInMIPs only works for HGCAL!";
655  return false;
656  }
657 
658  bool test(reco::PFRecHit& hit, const CaloTower& rh, bool& clean) override {
659  throw cms::Exception("WrongDetector") << "PFRecHitQTestThresholdInMIPs only works for HGCAL!";
660  return false;
661  }
662 
663  bool test(reco::PFRecHit& hit, const HGCRecHit& rh, bool& clean) override {
664  const double newE =
666  const int wafer = HGCalDetId(rh.detid()).wafer();
667  const float mult = (float)ddd_->waferTypeL(wafer); // 1 for 100um, 2 for 200um, 3 for 300um
668  hit.setEnergy(newE);
669  return pass(hit, mult);
670  }
671 
672 protected:
674  const bool recHitEnergy_keV_;
677 
678  bool pass(const reco::PFRecHit& hit, const float mult) {
679  const double hitValueInMIPs = 1e6 * hit.energy() / (mult * mip_);
680  return hitValueInMIPs > threshold_;
681  }
682 
683 private:
685 };
686 
688 public:
690 
692  : PFRecHitQTestBase(iConfig, cc), thresholdSNR_(iConfig.getParameter<double>("thresholdSNR")) {}
693 
694  void beginEvent(const edm::Event& event, const edm::EventSetup& iSetup) override {}
695 
696  bool test(reco::PFRecHit& hit, const EcalRecHit& rh, bool& clean, bool fullReadOut) override {
697  throw cms::Exception("WrongDetector") << "PFRecHitQTestHGCalThresholdSNR only works for HGCAL!";
698  return false;
699  }
700  bool test(reco::PFRecHit& hit, const HBHERecHit& rh, bool& clean) override {
701  throw cms::Exception("WrongDetector") << "PFRecHitQTestHGCalThresholdSNR only works for HGCAL!";
702  return false;
703  }
704 
705  bool test(reco::PFRecHit& hit, const HFRecHit& rh, bool& clean) override {
706  throw cms::Exception("WrongDetector") << "PFRecHitQTestHGCalThresholdSNR only works for HGCAL!";
707  return false;
708  }
709  bool test(reco::PFRecHit& hit, const HORecHit& rh, bool& clean) override {
710  throw cms::Exception("WrongDetector") << "PFRecHitQTestHGCalThresholdSNR only works for HGCAL!";
711  return false;
712  }
713 
714  bool test(reco::PFRecHit& hit, const CaloTower& rh, bool& clean) override {
715  throw cms::Exception("WrongDetector") << "PFRecHitQTestHGCalThresholdSNR only works for HGCAL!";
716  return false;
717  }
718 
719  bool test(reco::PFRecHit& hit, const HGCRecHit& rh, bool& clean) override {
720  return rh.signalOverSigmaNoise() >= thresholdSNR_;
721  }
722 
723 protected:
724  const double thresholdSNR_;
725 };
726 
727 // M.G. Quality test that checks seeding threshold read from the DB
728 //
730 public:
732  : PFRecHitQTestBase(iConfig, cc),
733  applySelectionsToAllCrystals_(iConfig.getParameter<bool>("applySelectionsToAllCrystals")),
734  threshToken_(cc.esConsumes()) {}
735 
736  void beginEvent(const edm::Event& event, const edm::EventSetup& iSetup) override {
737  ths_ = iSetup.getHandle(threshToken_);
738  }
739 
740  bool test(reco::PFRecHit& hit, const EcalRecHit& rh, bool& clean, bool fullReadOut) override {
742  return pass(hit);
743  return fullReadOut or pass(hit);
744  }
745  bool test(reco::PFRecHit& hit, const HBHERecHit& rh, bool& clean) override { return pass(hit); }
746 
747  bool test(reco::PFRecHit& hit, const HFRecHit& rh, bool& clean) override { return pass(hit); }
748  bool test(reco::PFRecHit& hit, const HORecHit& rh, bool& clean) override { return pass(hit); }
749 
750  bool test(reco::PFRecHit& hit, const CaloTower& rh, bool& clean) override { return pass(hit); }
751 
752  bool test(reco::PFRecHit& hit, const HGCRecHit& rh, bool& clean) override { return pass(hit); }
753 
754 protected:
757 
758  bool pass(const reco::PFRecHit& hit) {
759  float threshold = (*ths_)[hit.detId()];
760  return (hit.energy() > threshold);
761  }
762 
763 private:
765 };
766 
767 #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
constexpr float energy() const
Definition: CaloRecHit.h:29
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 test(reco::PFRecHit &hit, const HORecHit &rh, bool &clean) override
const HcalChannelQuality * theHcalChStatus_
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_
void beginEvent(const edm::Event &event, const edm::EventSetup &iSetup) override
static void setCaloGeometry(const CaloGeometry *geometry)
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)
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::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
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
unsigned detId() const
rechit detId
Definition: PFRecHit.h:93
PFRecHitQTestHCALCalib29(const edm::ParameterSet &iConfig, edm::ConsumesCollector &cc)
bool test(reco::PFRecHit &hit, const CaloTower &rh, bool &clean) override
constexpr const DetId & detid() const
Definition: CaloRecHit.h:33
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
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_
const Item * getValues(DetId fId, bool throwOnFail=true) const
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 getMergePositionFlag() const
Definition: HcalTopology.h:167
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
bool test(reco::PFRecHit &hit, const EcalRecHit &rh, bool &clean, bool fullReadOut) override
float signalOverSigmaNoise() const
Definition: HGCRecHit.cc:72
std::vector< double > thresholds_
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 getData(T &iHolder) const
Definition: EventSetup.h:122
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
bool checkFlag(int flag) const
check if the flag is true
Definition: EcalRecHit.h:187
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)
bool test(reco::PFRecHit &hit, const HORecHit &rh, bool &clean) override
constexpr float time() const
Definition: CaloRecHit.h:31
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
float energy() const
Definition: EcalRecHit.h:68
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
int waferTypeL(int wafer) const
float energy() const
rechit energy
Definition: PFRecHit.h:99
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_
bool test(reco::PFRecHit &hit, const HFRecHit &rh, bool &clean) override
bool test(reco::PFRecHit &hit, const HBHERecHit &rh, bool &clean) override
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)
int getSeverityLevel(const DetId &myid, const uint32_t &myflag, const uint32_t &mystatus) const
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
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_
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_
std::vector< int > thresholds_
void setEnergy(float energy)
Definition: PFRecHit.h:69
bool test(reco::PFRecHit &hit, const HORecHit &rh, bool &clean) override
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
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
HcalDetId idFront(const HcalDetId &id) const
Definition: HcalTopology.h:170
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
constexpr int depth() const
get the tower depth
Definition: HcalDetId.h:164
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:151
bool test(reco::PFRecHit &hit, const EcalRecHit &rh, bool &clean, bool fullReadOut) override
bool test(reco::PFRecHit &hit, const HBHERecHit &rh, bool &clean) override
uint32_t getValue() const
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
constexpr uint32_t flags() const
Definition: CaloRecHit.h:34
std::vector< int > flags_
bool test(reco::PFRecHit &hit, const EcalRecHit &rh, bool &clean, bool fullReadOut) override
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
PFRecHitQTestHOThreshold(const edm::ParameterSet &iConfig, edm::ConsumesCollector &cc)
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 HORecHit &rh, bool &clean) override
bool test(reco::PFRecHit &hit, const HGCRecHit &rh, bool &clean) override