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>
8 
9 #include <iostream>
10 
11 //
12 // Quality test that checks threshold
13 //
15 public:
17  }
18 
20  PFRecHitQTestBase(iConfig),
21  threshold_(iConfig.getParameter<double>("threshold"))
22  {
23  }
24 
25  void beginEvent(const edm::Event& event, const edm::EventSetup& iSetup) override {
26  }
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{
32  return pass(hit);
33  }
34 
35  bool test(reco::PFRecHit& hit, const HFRecHit& rh, bool& clean) override{
36  return pass(hit);
37  }
38  bool test(reco::PFRecHit& hit, const HORecHit& rh, bool& clean) override{
39  return pass(hit);
40  }
41 
42  bool test(reco::PFRecHit& hit, const CaloTower& rh, bool& clean) override{
43  return pass(hit);
44  }
45 
46  bool test(reco::PFRecHit& hit, const HGCRecHit& rh, bool& clean) override{
47  return pass(hit);
48  }
49 
50 protected:
51  double threshold_;
52 
53  bool pass(const reco::PFRecHit& hit){
54  if (hit.energy()>threshold_) return true;
55 
56  return false;
57  }
58 };
59 
60 
61 
62 
63 //
64 // Quality test that checks kHCAL Severity
65 //
67 public:
69  }
70 
72  PFRecHitQTestBase(iConfig)
73  {
74  thresholds_ = iConfig.getParameter<std::vector<int> >("maxSeverities");
75  cleanThresholds_ = iConfig.getParameter<std::vector<double> >("cleaningThresholds");
76  std::vector<std::string> flags = iConfig.getParameter<std::vector<std::string> >("flags");
77  for (auto & flag : flags) {
78  if (flag =="Standard") {
79  flags_.push_back(-1);
80  depths_.push_back(-1);
81  }
82  else if (flag =="HFInTime") {
83  flags_.push_back(1<<HcalCaloFlagLabels::HFInTimeWindow);
84  depths_.push_back(-1);
85  }
86  else if (flag =="HFDigi") {
87  flags_.push_back(1<<HcalCaloFlagLabels::HFDigiTime);
88  depths_.push_back(-1);
89  }
90  else if (flag =="HFLong") {
91  flags_.push_back(1<<HcalCaloFlagLabels::HFLongShort);
92  depths_.push_back(1);
93  }
94  else if (flag =="HFShort") {
95  flags_.push_back(1<<HcalCaloFlagLabels::HFLongShort);
96  depths_.push_back(2);
97  }
98  else {
99  flags_.push_back(-1);
100  depths_.push_back(-1);
101  }
102  }
103  }
104 
105  void beginEvent(const edm::Event& event, const edm::EventSetup& iSetup) override {
107  iSetup.get<HcalRecNumberingRecord>().get(topo);
108  theHcalTopology_ = topo.product();
110  iSetup.get<HcalChannelQualityRcd>().get( "withTopo", hcalChStatus );
111  theHcalChStatus_ = hcalChStatus.product();
112  edm::ESHandle<HcalSeverityLevelComputer> hcalSevLvlComputerHndl;
113  iSetup.get<HcalSeverityLevelComputerRcd>().get(hcalSevLvlComputerHndl);
114  hcalSevLvlComputer_ = hcalSevLvlComputerHndl.product();
115  }
116 
117  bool test(reco::PFRecHit& hit, const EcalRecHit& rh, bool& clean, bool fullReadOut) override{
118  return true;
119  }
120  bool test(reco::PFRecHit& hit, const HBHERecHit& rh, bool& clean) override{
121  return test(rh.detid(), rh.energy(), rh.flags(), clean);
122  }
123 
124  bool test(reco::PFRecHit& hit, const HFRecHit& rh, bool& clean) override{
125  return test(rh.detid(), rh.energy(), rh.flags(), clean);
126  }
127  bool test(reco::PFRecHit& hit, const HORecHit& rh, bool& clean) override{
128  return test(rh.detid(), rh.energy(), rh.flags(), clean);
129  }
130 
131  bool test(reco::PFRecHit& hit, const CaloTower& rh, bool& clean) override{
132  return true;
133  }
134 
135  bool test(reco::PFRecHit& hit, const HGCRecHit& rh, bool& clean) override{
136  return true;
137  }
138 
139 protected:
140  std::vector<int> thresholds_;
141  std::vector<double> cleanThresholds_;
142  std::vector<int> flags_;
143  std::vector<int> depths_;
147 
148  bool test(unsigned aDETID, double energy, int flags, bool& clean){
149  HcalDetId detid = (HcalDetId)aDETID;
150  if (theHcalTopology_->withSpecialRBXHBHE() and detid.subdet() == HcalEndcap){
151  detid = theHcalTopology_->idFront(detid);
152  }
153 
154  const HcalChannelStatus* theStatus = theHcalChStatus_->getValues(detid);
155  unsigned theStatusValue = theStatus->getValue();
156  // Now get severity of problems for the given detID, based on the rechit flag word and the channel quality status value
157  for (unsigned int i=0;i<thresholds_.size();++i) {
158  int hitSeverity =0;
159  if (energy < cleanThresholds_[i])
160  continue;
161 
162  if(flags_[i]<0) {
163  hitSeverity=hcalSevLvlComputer_->getSeverityLevel(detid, flags, theStatusValue);
164  }
165  else {
166  hitSeverity=hcalSevLvlComputer_->getSeverityLevel(detid, flags & flags_[i], theStatusValue);
167  }
168 
169  if (hitSeverity>thresholds_[i] and ((depths_[i]<0 or (depths_[i]==detid.depth())))) {
170  clean=true;
171  return false;
172  }
173  }
174  return true;
175  }
176 
177 };
178 
179 //
180 // Quality test that applies threshold and timing as a function of depth
181 //
183 public:
185  }
186 
188  PFRecHitQTestBase(iConfig)
189  {
190  std::vector<edm::ParameterSet> psets = iConfig.getParameter<std::vector<edm::ParameterSet> >("cuts");
191  for (auto & pset : psets) {
192  depths_.push_back(pset.getParameter<int>("depth"));
193  minTimes_.push_back(pset.getParameter<double>("minTime"));
194  maxTimes_.push_back(pset.getParameter<double>("maxTime"));
195  thresholds_.push_back(pset.getParameter<double>("threshold"));
196  }
197  }
198 
199  void beginEvent(const edm::Event& event, const edm::EventSetup& iSetup) override {
200  }
201 
202  bool test(reco::PFRecHit& hit, const EcalRecHit& rh, bool& clean, bool fullReadOut) override{
203  return true;
204  }
205  bool test(reco::PFRecHit& hit, const HBHERecHit& rh, bool& clean) override{
206  return test(rh.detid(), rh.energy(), rh.time(), clean);
207  }
208 
209  bool test(reco::PFRecHit& hit, const HFRecHit& rh, bool& clean) override{
210  return test(rh.detid(), rh.energy(), rh.time(), clean);
211  }
212  bool test(reco::PFRecHit& hit, const HORecHit& rh, bool& clean) override {
213  return test(rh.detid(), rh.energy(), rh.time(), clean);
214  }
215 
216  bool test(reco::PFRecHit& hit, const CaloTower& rh, bool& clean) override{
217  return true;
218  }
219 
220  bool test(reco::PFRecHit& hit, const HGCRecHit& rh, bool& clean) override{
221  return true;
222  }
223 
224 protected:
225  std::vector<int> depths_;
226  std::vector<double> minTimes_;
227  std::vector<double> maxTimes_;
228  std::vector<double> thresholds_;
229 
230  bool test(unsigned aDETID, double energy, double time, bool& clean){
231  HcalDetId detid(aDETID);
232  for (unsigned int i=0;i<depths_.size();++i) {
233  if (detid.depth() == depths_[i]) {
234  if ((time <minTimes_[i] or time >maxTimes_[i] ) and energy>thresholds_[i])
235  {
236  clean=true;
237  return false;
238  }
239  break;
240  }
241  }
242  return true;
243  }
244 };
245 
246 
247 
248 
249 //
250 // Quality test that applies threshold as a function of depth
251 //
253 public:
255  }
256 
258  PFRecHitQTestBase(iConfig)
259  {
260  std::vector<edm::ParameterSet> psets = iConfig.getParameter<std::vector<edm::ParameterSet> >("cuts");
261  for (auto & pset : psets) {
262  depths_.push_back(pset.getParameter<int>("depth"));
263  thresholds_.push_back(pset.getParameter<double>("threshold"));
264  }
265  }
266 
267  void beginEvent(const edm::Event& event, const edm::EventSetup& iSetup) override {
268  }
269 
270  bool test(reco::PFRecHit& hit, const EcalRecHit& rh, bool& clean, bool fullReadOut) override{
271  return true;
272  }
273  bool test(reco::PFRecHit& hit, const HBHERecHit& rh, bool& clean) override{
274  return test(rh.detid(), rh.energy(), rh.time(), clean);
275  }
276 
277  bool test(reco::PFRecHit& hit, const HFRecHit& rh, bool& clean) override{
278  return test(rh.detid(), rh.energy(), rh.time(), clean);
279  }
280  bool test(reco::PFRecHit& hit, const HORecHit& rh, bool& clean) override{
281  return test(rh.detid(), rh.energy(), rh.time(), clean);
282  }
283 
284  bool test(reco::PFRecHit& hit, const CaloTower& rh, bool& clean) override{
285  return true;
286  }
287 
288  bool test(reco::PFRecHit& hit, const HGCRecHit& rh, bool& clean) override{
289  return true;
290  }
291 
292 protected:
293  std::vector<int> depths_;
294  std::vector<double> thresholds_;
295 
296  bool test(unsigned aDETID, double energy, double time, bool& clean){
297  HcalDetId detid(aDETID);
298  for (unsigned int i=0;i<depths_.size();++i) {
299  if (detid.depth() == depths_[i]) {
300  if ( energy<thresholds_[i])
301  {
302  clean=false;
303  return false;
304  }
305  break;
306  }
307  }
308  return true;
309  }
310 };
311 
312 
313 
314 
315 
316 //
317 // Quality test that checks HO threshold applying different threshold in rings
318 //
320 public:
322  threshold0_(0.),
323  threshold12_(0.)
324  {
325  }
326 
328  PFRecHitQTestBase(iConfig),
329  threshold0_(iConfig.getParameter<double>("threshold_ring0")),
330  threshold12_(iConfig.getParameter<double>("threshold_ring12"))
331  {
332  }
333 
334  void beginEvent(const edm::Event& event, const edm::EventSetup& iSetup) override {
335  }
336 
337  bool test(reco::PFRecHit& hit, const EcalRecHit& rh, bool& clean, bool fullReadOut) override{
338  return true;
339  }
340 
341  bool test(reco::PFRecHit& hit, const HBHERecHit& rh, bool& clean) override{
342  return true;
343  }
344 
345  bool test(reco::PFRecHit& hit, const HFRecHit& rh, bool& clean) override{
346  return true;
347  }
348 
349  bool test(reco::PFRecHit& hit, const HORecHit& rh, bool& clean) override{
350  HcalDetId detid(rh.detid());
351  if (abs(detid.ieta())<=4 and hit.energy()>threshold0_)
352  return true;
353  if (abs(detid.ieta())>4 and hit.energy()>threshold12_)
354  return true;
355 
356  return false;
357  }
358 
359  bool test(reco::PFRecHit& hit, const CaloTower& rh, bool& clean) override{
360  return true;
361  }
362 
363  bool test(reco::PFRecHit& hit, const HGCRecHit& rh, bool& clean) override{
364  return true;
365  }
366 
367 protected:
368  const double threshold0_;
369  const double threshold12_;
370 
371 };
372 
373 //
374 // Quality test that checks threshold as a function of ECAL eta-ring
375 //
381 public:
383  }
384 
386  PFRecHitQTestBase(iConfig),
387  thresholds_(iConfig.getParameter<std::vector<double> >("thresholds"))
388  {
389  if (thresholds_.size() != EcalRingCalibrationTools::N_RING_TOTAL)
390  throw edm::Exception(edm::errors::Configuration, "ValueError")
391  << "thresholds is expected to have " << EcalRingCalibrationTools::N_RING_TOTAL << " elements but has " << thresholds_.size();
392  }
393 
394  void beginEvent(const edm::Event& event, const edm::EventSetup& iSetup) override {
396  iSetup.get<CaloGeometryRecord>().get(pG);
398  endcapGeometrySet_=false;
399  if (endcapGeometry) {
401  endcapGeometrySet_=true;
402  }
403  }
404 
405  bool test(reco::PFRecHit& hit, const EcalRecHit& rh, bool& clean, bool fullReadOut) override{
406  return fullReadOut or pass(hit);
407  }
408  bool test(reco::PFRecHit& hit, const HBHERecHit& rh, bool& clean) override{
409  return true;
410  }
411 
412  bool test(reco::PFRecHit& hit, const HFRecHit& rh, bool& clean) override{
413  return true;
414  }
415  bool test(reco::PFRecHit& hit, const HORecHit& rh, bool& clean) override{
416  return true;
417  }
418 
419  bool test(reco::PFRecHit& hit, const CaloTower& rh, bool& clean) override{
420  return true;
421  }
422 
423  bool test(reco::PFRecHit& hit, const HGCRecHit& rh, bool& clean) override{
424  return true;
425  }
426 
427 protected:
428  const std::vector<double> thresholds_;
430 
431  bool pass(const reco::PFRecHit& hit){
432 
433  DetId detId(hit.detId());
434 
435  // this is to skip endcap ZS for Phase2 until there is a defined geometry
436  // apply the loosest ZS threshold, for the first eta-ring in EB
437  if (not endcapGeometrySet_) {
438 
439  // there is only ECAL EB in Phase 2
440  if(detId.subdetId() != EcalBarrel) return true;
441 
442  // 0-169: EB eta-rings
443  // 170-208: EE- eta rings
444  // 209-247: EE+ eta rings
445  int firstEBRing = 0;
446  return (hit.energy() > thresholds_[firstEBRing]);
447  }
448 
449  int iring = EcalRingCalibrationTools::getRingIndex(detId);
450  if (hit.energy() > thresholds_[iring]) return true;
451 
452  return false;
453  }
454 };
455 
456 
457 //
458 // Quality test that checks ecal quality cuts
459 //
461  public:
463  }
464 
466  PFRecHitQTestBase(iConfig),
467  thresholdCleaning_(iConfig.getParameter<double>("cleaningThreshold")),
468  timingCleaning_(iConfig.getParameter<bool>("timingCleaning")),
469  topologicalCleaning_(iConfig.getParameter<bool>("topologicalCleaning")),
470  skipTTRecoveredHits_(iConfig.getParameter<bool>("skipTTRecoveredHits"))
471  {
472  }
473 
474  void beginEvent(const edm::Event& event, const edm::EventSetup& iSetup) override {
475  }
476 
477  bool test(reco::PFRecHit& hit, const EcalRecHit& rh, bool& clean, bool fullReadOut) override{
478  if (skipTTRecoveredHits_ and rh.checkFlag(EcalRecHit::kTowerRecovered))
479  {
480  clean=true;
481  return false;
482  }
483  if (timingCleaning_ and rh.energy() > thresholdCleaning_ and
485  {
486  clean=true;
487  return false;
488  }
489 
490  if (topologicalCleaning_ and (
493  {
494  clean=true;
495  return false;
496  }
497 
498  return true;
499  }
500 
501  bool test(reco::PFRecHit& hit, const HBHERecHit& rh, bool& clean) override{
502  return true;
503  }
504 
505  bool test(reco::PFRecHit& hit, const HFRecHit& rh, bool& clean) override{
506  return true;
507  }
508 
509  bool test(reco::PFRecHit& hit, const HORecHit& rh, bool& clean) override{
510  return true;
511  }
512 
513  bool test(reco::PFRecHit& hit, const CaloTower& rh, bool& clean) override{
514  return true;
515  }
516 
517  bool test(reco::PFRecHit& hit, const HGCRecHit& rh, bool& clean) override{
518  return true;
519  }
520 
521 protected:
526 
527 };
528 
529 //
530 // Quality test that checks ES quality cuts
531 //
533 public:
535  thresholdCleaning_(0.),
536  topologicalCleaning_(false)
537  {
538  }
539 
541  PFRecHitQTestBase(iConfig),
542  thresholdCleaning_(iConfig.getParameter<double>("cleaningThreshold")),
543  topologicalCleaning_(iConfig.getParameter<bool>("topologicalCleaning"))
544  {
545  }
546 
547  void beginEvent(const edm::Event& event, const edm::EventSetup& iSetup) override {
548  }
549 
550  bool test(reco::PFRecHit& hit, const EcalRecHit& rh, bool& clean, bool fullReadOut) override {
551 
552  if ( rh.energy() < thresholdCleaning_ ) {
553  clean=false;
554  return false;
555  }
556 
557  if ( topologicalCleaning_ and
566  )) {
567  clean=false;
568  return false;
569  }
570 
571  return true;
572  }
573 
574  bool test(reco::PFRecHit& hit, const HBHERecHit& rh, bool& clean) override{
575  return true;
576  }
577 
578  bool test(reco::PFRecHit& hit, const HFRecHit& rh, bool& clean) override{
579  return true;
580  }
581 
582  bool test(reco::PFRecHit& hit, const HORecHit& rh, bool& clean) override{
583  return true;
584  }
585 
586  bool test(reco::PFRecHit& hit, const CaloTower& rh, bool& clean) override{
587  return true;
588  }
589 
590  bool test(reco::PFRecHit& hit, const HGCRecHit& rh, bool& clean) override{
591  return true;
592  }
593 
594 protected:
595  const double thresholdCleaning_;
597 
598 };
599 
600 //
601 // Quality test that calibrates tower 29 of HCAL
602 //
604 public:
606  calibFactor_(0.)
607  {
608  }
609 
611  PFRecHitQTestBase(iConfig),
612  calibFactor_(iConfig.getParameter<double>("calibFactor"))
613  {
614  }
615 
616  void beginEvent(const edm::Event& event, const edm::EventSetup& iSetup) override {
617  }
618 
619  bool test(reco::PFRecHit& hit, const EcalRecHit& rh, bool& clean, bool fullReadOut) override{
620  return true;
621  }
622  bool test(reco::PFRecHit& hit, const HBHERecHit& rh, bool& clean) override{
623  HcalDetId detId(hit.detId());
624  if (abs(detId.ieta())==29)
625  hit.setEnergy(hit.energy()*calibFactor_);
626  return true;
627  }
628 
629  bool test(reco::PFRecHit& hit, const HFRecHit& rh, bool& clean) override{
630  return true;
631  }
632  bool test(reco::PFRecHit& hit, const HORecHit& rh, bool& clean) override{
633  return true;
634  }
635 
636  bool test(reco::PFRecHit& hit, const CaloTower& rh, bool& clean) override{
637  CaloTowerDetId detId(hit.detId());
638  if (detId.ietaAbs()==29)
639  hit.setEnergy(hit.energy()*calibFactor_);
640  return true;
641  }
642 
643  bool test(reco::PFRecHit& hit, const HGCRecHit& rh, bool& clean) override{
644  return true;
645  }
646 
647 protected:
648  const float calibFactor_;
649 };
650 
652 public:
654  recHitEnergy_keV_(false),
655  threshold_(0.),
656  mip_(0.),
657  recHitEnergyMultiplier_(0.)
658  {
659  }
660 
662  PFRecHitQTestBase(iConfig),
663  recHitEnergy_keV_(iConfig.getParameter<bool>("recHitEnergyIs_keV")),
664  threshold_(iConfig.getParameter<double>("thresholdInMIPs")),
665  mip_(iConfig.getParameter<double>("mipValueInkeV")),
666  recHitEnergyMultiplier_(iConfig.getParameter<double>("recHitEnergyMultiplier"))
667  {
668  }
669 
670  void beginEvent(const edm::Event& event, const edm::EventSetup& iSetup) override {
671  }
672 
673  bool test(reco::PFRecHit& hit, const EcalRecHit& rh, bool& clean, bool fullReadOut) override {
674  throw cms::Exception("WrongDetector")
675  << "PFRecHitQTestThresholdInMIPs only works for HGCAL!";
676  return false;
677  }
678  bool test(reco::PFRecHit& hit, const HBHERecHit& rh, bool& clean) override {
679  throw cms::Exception("WrongDetector")
680  << "PFRecHitQTestThresholdInMIPs only works for HGCAL!";
681  return false;
682  }
683 
684  bool test(reco::PFRecHit& hit, const HFRecHit& rh, bool& clean) override {
685  throw cms::Exception("WrongDetector")
686  << "PFRecHitQTestThresholdInMIPs only works for HGCAL!";
687  return false;
688  }
689  bool test(reco::PFRecHit& hit, const HORecHit& rh, bool& clean) override {
690  throw cms::Exception("WrongDetector")
691  << "PFRecHitQTestThresholdInMIPs only works for HGCAL!";
692  return false;
693  }
694 
695  bool test(reco::PFRecHit& hit, const CaloTower& rh, bool& clean) override {
696  throw cms::Exception("WrongDetector")
697  << "PFRecHitQTestThresholdInMIPs only works for HGCAL!";
698  return false;
699  }
700 
701  bool test(reco::PFRecHit& hit, const HGCRecHit& rh, bool& clean) override {
702  const double newE = ( recHitEnergy_keV_ ?
703  1.0e-6*rh.energy()*recHitEnergyMultiplier_ :
704  rh.energy()*recHitEnergyMultiplier_ );
705  hit.setEnergy(newE);
706  return pass(hit);
707  }
708 
709 protected:
710  const bool recHitEnergy_keV_;
711  const double threshold_, mip_, recHitEnergyMultiplier_;
712 
713  bool pass(const reco::PFRecHit& hit) {
714  const double hitValueInMIPs = 1e6*hit.energy()/mip_;
715  return hitValueInMIPs > threshold_;
716  }
717 };
718 
721  public:
723  geometryInstance_(""),
724  recHitEnergy_keV_(0.),
725  threshold_(0.),
726  mip_(0.),
727  recHitEnergyMultiplier_(0.) {
728  }
729 
731  PFRecHitQTestBase(iConfig),
732  geometryInstance_(iConfig.getParameter<std::string>("geometryInstance")),
733  recHitEnergy_keV_(iConfig.getParameter<bool>("recHitEnergyIs_keV")),
734  threshold_(iConfig.getParameter<double>("thresholdInMIPs")),
735  mip_(iConfig.getParameter<double>("mipValueInkeV")),
736  recHitEnergyMultiplier_(iConfig.getParameter<double>("recHitEnergyMultiplier")) {
737  }
738 
739  void beginEvent(const edm::Event& event, const edm::EventSetup& iSetup) override {
741  iSetup.get<IdealGeometryRecord>().get(geometryInstance_, geoHandle);
742  ddd_ = &(geoHandle->topology().dddConstants());
743  }
744 
745  bool test(reco::PFRecHit& hit, const EcalRecHit& rh, bool& clean, bool fullReadOut) override {
746  throw cms::Exception("WrongDetector")
747  << "PFRecHitQTestThresholdInMIPs only works for HGCAL!";
748  return false;
749  }
750  bool test(reco::PFRecHit& hit, const HBHERecHit& rh, bool& clean) override {
751  throw cms::Exception("WrongDetector")
752  << "PFRecHitQTestThresholdInMIPs only works for HGCAL!";
753  return false;
754  }
755 
756  bool test(reco::PFRecHit& hit, const HFRecHit& rh, bool& clean) override {
757  throw cms::Exception("WrongDetector")
758  << "PFRecHitQTestThresholdInMIPs only works for HGCAL!";
759  return false;
760  }
761  bool test(reco::PFRecHit& hit, const HORecHit& rh, bool& clean) override {
762  throw cms::Exception("WrongDetector")
763  << "PFRecHitQTestThresholdInMIPs only works for HGCAL!";
764  return false;
765  }
766 
767  bool test(reco::PFRecHit& hit, const CaloTower& rh, bool& clean) override {
768  throw cms::Exception("WrongDetector")
769  << "PFRecHitQTestThresholdInMIPs only works for HGCAL!";
770  return false;
771  }
772 
773  bool test(reco::PFRecHit& hit, const HGCRecHit& rh, bool& clean) override {
774  const double newE = ( recHitEnergy_keV_ ?
775  1.0e-6*rh.energy()*recHitEnergyMultiplier_ :
776  rh.energy()*recHitEnergyMultiplier_ );
777  const int wafer = HGCalDetId(rh.detid()).wafer();
778  const float mult = (float) ddd_->waferTypeL(wafer); // 1 for 100um, 2 for 200um, 3 for 300um
779  hit.setEnergy(newE);
780  return pass(hit, mult);
781  }
782 
783  protected:
785  const bool recHitEnergy_keV_;
786  const double threshold_, mip_, recHitEnergyMultiplier_;
788 
789  bool pass(const reco::PFRecHit& hit, const float mult) {
790  const double hitValueInMIPs = 1e6*hit.energy()/(mult*mip_);
791  return hitValueInMIPs > threshold_;
792  }
793 };
794 
795 
797 {
798  public:
800  thresholdSNR_(0.)
801  {
802  }
803 
805  PFRecHitQTestBase(iConfig), thresholdSNR_(iConfig.getParameter<double>("thresholdSNR"))
806  {
807  }
808 
809  void beginEvent(const edm::Event& event, const edm::EventSetup& iSetup) override
810  {
811  }
812 
813  bool test(reco::PFRecHit& hit, const EcalRecHit& rh, bool& clean, bool fullReadOut) override
814  {
815  throw cms::Exception("WrongDetector")
816  << "PFRecHitQTestHGCalThresholdSNR only works for HGCAL!";
817  return false;
818  }
819  bool test(reco::PFRecHit& hit, const HBHERecHit& rh, bool& clean) override
820  {
821  throw cms::Exception("WrongDetector")
822  << "PFRecHitQTestHGCalThresholdSNR only works for HGCAL!";
823  return false;
824  }
825 
826  bool test(reco::PFRecHit& hit, const HFRecHit& rh, bool& clean) override
827  {
828  throw cms::Exception("WrongDetector")
829  << "PFRecHitQTestHGCalThresholdSNR only works for HGCAL!";
830  return false;
831  }
832  bool test(reco::PFRecHit& hit, const HORecHit& rh, bool& clean) override
833  {
834  throw cms::Exception("WrongDetector")
835  << "PFRecHitQTestHGCalThresholdSNR only works for HGCAL!";
836  return false;
837  }
838 
839  bool test(reco::PFRecHit& hit, const CaloTower& rh, bool& clean) override
840  {
841  throw cms::Exception("WrongDetector")
842  << "PFRecHitQTestHGCalThresholdSNR only works for HGCAL!";
843  return false;
844  }
845 
846  bool test(reco::PFRecHit& hit, const HGCRecHit& rh, bool& clean) override
847  {
848  return rh.signalOverSigmaNoise() >= thresholdSNR_;
849  }
850 
851  protected:
852  const double thresholdSNR_;
853 };
854 
855 #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
bool test(reco::PFRecHit &hit, const HGCRecHit &rh, bool &clean) override
T getParameter(std::string const &) const
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:45
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
void beginEvent(const edm::Event &event, const edm::EventSetup &iSetup) override
void beginEvent(const edm::Event &event, const edm::EventSetup &iSetup) override
static void setCaloGeometry(const CaloGeometry *geometry)
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:49
bool test(reco::PFRecHit &hit, const HGCRecHit &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)
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
const DetId & detid() const
Definition: CaloRecHit.h:21
bool test(reco::PFRecHit &hit, const HBHERecHit &rh, bool &clean) override
unsigned detId() const
rechit detId
Definition: PFRecHit.h:108
PFRecHitQTestThreshold(const edm::ParameterSet &iConfig)
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_
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_
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
std::vector< Variable::Flags > flags
Definition: MVATrainer.cc:135
PFRecHitQTestECAL(const edm::ParameterSet &iConfig)
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
float time() const
Definition: CaloRecHit.h:19
bool test(reco::PFRecHit &hit, const EcalRecHit &rh, bool &clean, bool fullReadOut) override
PFRecHitQTestHCALChannel(const edm::ParameterSet &iConfig)
std::vector< double > cleanThresholds_
bool test(reco::PFRecHit &hit, const CaloTower &rh, bool &clean) override
std::vector< double > thresholds_
PFRecHitQTestHCALThresholdVsDepth(const edm::ParameterSet &iConfig)
const HcalTopology * theHcalTopology_
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:68
std::vector< double > thresholds_
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 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
int depth() const
get the tower depth
Definition: HcalDetId.cc:108
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:189
bool test(reco::PFRecHit &hit, const EcalRecHit &rh, bool &clean, bool fullReadOut) override
float energy() const
Definition: CaloRecHit.h:17
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
const HGCalTopology & topology() const
Definition: HGCalGeometry.h:96
PFRecHitQTestHCALCalib29(const edm::ParameterSet &iConfig)
uint32_t flags() const
Definition: CaloRecHit.h:22
bool test(reco::PFRecHit &hit, const HORecHit &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
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
float energy() const
rechit energy
Definition: PFRecHit.h:114
bool test(reco::PFRecHit &hit, const HGCRecHit &rh, bool &clean) override
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
PFRecHitQTestHCALTimeVsDepth(const edm::ParameterSet &iConfig)
std::vector< T * > clean
Definition: MVATrainer.cc:156
bool test(reco::PFRecHit &hit, const HGCRecHit &rh, bool &clean) override
void beginEvent(const edm::Event &event, const edm::EventSetup &iSetup) override
Definition: DetId.h:18
bool test(reco::PFRecHit &hit, const HBHERecHit &rh, bool &clean) override
bool test(reco::PFRecHit &hit, const HFRecHit &rh, bool &clean) override
PFRecHitQTestHOThreshold(const edm::ParameterSet &iConfig)
const HGCalDDDConstants & dddConstants() const
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
const T & get() const
Definition: EventSetup.h:55
PFRecHitQTestThresholdInThicknessNormalizedMIPs(const edm::ParameterSet &iConfig)
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 EcalRecHit &rh, bool &clean, bool fullReadOut) override
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
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< int > thresholds_
void setEnergy(float energy)
Definition: PFRecHit.h:74
bool test(reco::PFRecHit &hit, const HORecHit &rh, bool &clean) override
bool test(reco::PFRecHit &hit, const HORecHit &rh, bool &clean) override
bool test(reco::PFRecHit &hit, const HFRecHit &rh, bool &clean) override
const bool topologicalCleaning_
PFRecHitQTestThresholdInMIPs(const edm::ParameterSet &iConfig)
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)
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
bool test(reco::PFRecHit &hit, const HBHERecHit &rh, bool &clean) override
uint32_t getValue() const
bool withSpecialRBXHBHE() const
Definition: HcalTopology.h:162
PFRecHitQTestECALMultiThreshold(const edm::ParameterSet &iConfig)
bool pass(const reco::PFRecHit &hit)
static constexpr short N_RING_TOTAL
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
T const * product() const
Definition: ESHandle.h:86
std::vector< int > flags_
bool test(reco::PFRecHit &hit, const EcalRecHit &rh, bool &clean, bool fullReadOut) override
PFRecHitQTestHGCalThresholdSNR(const edm::ParameterSet &iConfig)
bool test(reco::PFRecHit &hit, const HORecHit &rh, bool &clean) override
Definition: event.py:1
PFRecHitQTestES(const edm::ParameterSet &iConfig)
bool test(reco::PFRecHit &hit, const HORecHit &rh, bool &clean) override
bool test(reco::PFRecHit &hit, const HGCRecHit &rh, bool &clean) override