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_=pset.getParameter<std::vector<int> >("depth");
263  thresholds_=pset.getParameter<std::vector<double> >("threshold");
264  detector_=pset.getParameter<int>("detectorEnum");
265  if(thresholds_.size()!=depths_.size()) {
266  throw cms::Exception("InvalidPFRecHitThreshold")
267  << "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 
275  bool test(reco::PFRecHit& hit, const EcalRecHit& rh, bool& clean, bool fullReadOut) override{
276  return true;
277  }
278  bool test(reco::PFRecHit& hit, const HBHERecHit& rh, bool& clean) override{
279  return test(rh.detid(), rh.energy(), rh.time(), clean);
280  }
281 
282  bool test(reco::PFRecHit& hit, const HFRecHit& rh, bool& clean) override{
283  return test(rh.detid(), rh.energy(), rh.time(), clean);
284  }
285  bool test(reco::PFRecHit& hit, const HORecHit& rh, bool& clean) override{
286  return test(rh.detid(), rh.energy(), rh.time(), clean);
287  }
288 
289  bool test(reco::PFRecHit& hit, const CaloTower& rh, bool& clean) override{
290  return true;
291  }
292 
293  bool test(reco::PFRecHit& hit, const HGCRecHit& rh, bool& clean) override{
294  return true;
295  }
296 
297 protected:
298  std::vector<int> depths_;
299  std::vector<double> thresholds_;
301 
302  bool test(unsigned aDETID, double energy, double time, bool& clean){
303  HcalDetId detid(aDETID);
304 
305  for (unsigned int i=0;i<thresholds_.size();++i) {
306  if (detid.depth() == depths_[i] && detid.subdet() == detector_ ) {
307  if ( energy<thresholds_[i])
308  {
309  clean=false;
310  return false;
311  }
312  break;
313  }
314  }
315  return true;
316  }
317 };
318 
319 
320 
321 
322 
323 //
324 // Quality test that checks HO threshold applying different threshold in rings
325 //
327 public:
329  threshold0_(0.),
330  threshold12_(0.)
331  {
332  }
333 
335  PFRecHitQTestBase(iConfig),
336  threshold0_(iConfig.getParameter<double>("threshold_ring0")),
337  threshold12_(iConfig.getParameter<double>("threshold_ring12"))
338  {
339  }
340 
341  void beginEvent(const edm::Event& event, const edm::EventSetup& iSetup) override {
342  }
343 
344  bool test(reco::PFRecHit& hit, const EcalRecHit& rh, bool& clean, bool fullReadOut) override{
345  return true;
346  }
347 
348  bool test(reco::PFRecHit& hit, const HBHERecHit& rh, bool& clean) override{
349  return true;
350  }
351 
352  bool test(reco::PFRecHit& hit, const HFRecHit& rh, bool& clean) override{
353  return true;
354  }
355 
356  bool test(reco::PFRecHit& hit, const HORecHit& rh, bool& clean) override{
357  HcalDetId detid(rh.detid());
358  if (abs(detid.ieta())<=4 and hit.energy()>threshold0_)
359  return true;
360  if (abs(detid.ieta())>4 and hit.energy()>threshold12_)
361  return true;
362 
363  return false;
364  }
365 
366  bool test(reco::PFRecHit& hit, const CaloTower& rh, bool& clean) override{
367  return true;
368  }
369 
370  bool test(reco::PFRecHit& hit, const HGCRecHit& rh, bool& clean) override{
371  return true;
372  }
373 
374 protected:
375  const double threshold0_;
376  const double threshold12_;
377 
378 };
379 
380 //
381 // Quality test that checks threshold as a function of ECAL eta-ring
382 //
388 public:
390  }
391 
393  PFRecHitQTestBase(iConfig),
394  thresholds_(iConfig.getParameter<std::vector<double> >("thresholds"))
395  {
396  if (thresholds_.size() != EcalRingCalibrationTools::N_RING_TOTAL)
397  throw edm::Exception(edm::errors::Configuration, "ValueError")
398  << "thresholds is expected to have " << EcalRingCalibrationTools::N_RING_TOTAL << " elements but has " << thresholds_.size();
399  }
400 
401  void beginEvent(const edm::Event& event, const edm::EventSetup& iSetup) override {
403  iSetup.get<CaloGeometryRecord>().get(pG);
405  endcapGeometrySet_=false;
406  if (endcapGeometry) {
408  endcapGeometrySet_=true;
409  }
410  }
411 
412  bool test(reco::PFRecHit& hit, const EcalRecHit& rh, bool& clean, bool fullReadOut) override{
413  return fullReadOut or pass(hit);
414  }
415  bool test(reco::PFRecHit& hit, const HBHERecHit& rh, bool& clean) override{
416  return true;
417  }
418 
419  bool test(reco::PFRecHit& hit, const HFRecHit& rh, bool& clean) override{
420  return true;
421  }
422  bool test(reco::PFRecHit& hit, const HORecHit& rh, bool& clean) override{
423  return true;
424  }
425 
426  bool test(reco::PFRecHit& hit, const CaloTower& rh, bool& clean) override{
427  return true;
428  }
429 
430  bool test(reco::PFRecHit& hit, const HGCRecHit& rh, bool& clean) override{
431  return true;
432  }
433 
434 protected:
435  const std::vector<double> thresholds_;
437 
438  bool pass(const reco::PFRecHit& hit){
439 
440  DetId detId(hit.detId());
441 
442  // this is to skip endcap ZS for Phase2 until there is a defined geometry
443  // apply the loosest ZS threshold, for the first eta-ring in EB
444  if (not endcapGeometrySet_) {
445 
446  // there is only ECAL EB in Phase 2
447  if(detId.subdetId() != EcalBarrel) return true;
448 
449  // 0-169: EB eta-rings
450  // 170-208: EE- eta rings
451  // 209-247: EE+ eta rings
452  int firstEBRing = 0;
453  return (hit.energy() > thresholds_[firstEBRing]);
454  }
455 
456  int iring = EcalRingCalibrationTools::getRingIndex(detId);
457  if (hit.energy() > thresholds_[iring]) return true;
458 
459  return false;
460  }
461 };
462 
463 
464 //
465 // Quality test that checks ecal quality cuts
466 //
468  public:
470  }
471 
473  PFRecHitQTestBase(iConfig),
474  thresholdCleaning_(iConfig.getParameter<double>("cleaningThreshold")),
475  timingCleaning_(iConfig.getParameter<bool>("timingCleaning")),
476  topologicalCleaning_(iConfig.getParameter<bool>("topologicalCleaning")),
477  skipTTRecoveredHits_(iConfig.getParameter<bool>("skipTTRecoveredHits"))
478  {
479  }
480 
481  void beginEvent(const edm::Event& event, const edm::EventSetup& iSetup) override {
482  }
483 
484  bool test(reco::PFRecHit& hit, const EcalRecHit& rh, bool& clean, bool fullReadOut) override{
485  if (skipTTRecoveredHits_ and rh.checkFlag(EcalRecHit::kTowerRecovered))
486  {
487  clean=true;
488  return false;
489  }
490  if (timingCleaning_ and rh.energy() > thresholdCleaning_ and
492  {
493  clean=true;
494  return false;
495  }
496 
497  if (topologicalCleaning_ and (
500  {
501  clean=true;
502  return false;
503  }
504 
505  return true;
506  }
507 
508  bool test(reco::PFRecHit& hit, const HBHERecHit& rh, bool& clean) override{
509  return true;
510  }
511 
512  bool test(reco::PFRecHit& hit, const HFRecHit& rh, bool& clean) override{
513  return true;
514  }
515 
516  bool test(reco::PFRecHit& hit, const HORecHit& rh, bool& clean) override{
517  return true;
518  }
519 
520  bool test(reco::PFRecHit& hit, const CaloTower& rh, bool& clean) override{
521  return true;
522  }
523 
524  bool test(reco::PFRecHit& hit, const HGCRecHit& rh, bool& clean) override{
525  return true;
526  }
527 
528 protected:
533 
534 };
535 
536 //
537 // Quality test that checks ES quality cuts
538 //
540 public:
542  thresholdCleaning_(0.),
543  topologicalCleaning_(false)
544  {
545  }
546 
548  PFRecHitQTestBase(iConfig),
549  thresholdCleaning_(iConfig.getParameter<double>("cleaningThreshold")),
550  topologicalCleaning_(iConfig.getParameter<bool>("topologicalCleaning"))
551  {
552  }
553 
554  void beginEvent(const edm::Event& event, const edm::EventSetup& iSetup) override {
555  }
556 
557  bool test(reco::PFRecHit& hit, const EcalRecHit& rh, bool& clean, bool fullReadOut) override {
558 
559  if ( rh.energy() < thresholdCleaning_ ) {
560  clean=false;
561  return false;
562  }
563 
564  if ( topologicalCleaning_ and
573  )) {
574  clean=false;
575  return false;
576  }
577 
578  return true;
579  }
580 
581  bool test(reco::PFRecHit& hit, const HBHERecHit& rh, bool& clean) override{
582  return true;
583  }
584 
585  bool test(reco::PFRecHit& hit, const HFRecHit& rh, bool& clean) override{
586  return true;
587  }
588 
589  bool test(reco::PFRecHit& hit, const HORecHit& rh, bool& clean) override{
590  return true;
591  }
592 
593  bool test(reco::PFRecHit& hit, const CaloTower& rh, bool& clean) override{
594  return true;
595  }
596 
597  bool test(reco::PFRecHit& hit, const HGCRecHit& rh, bool& clean) override{
598  return true;
599  }
600 
601 protected:
602  const double thresholdCleaning_;
604 
605 };
606 
607 //
608 // Quality test that calibrates tower 29 of HCAL
609 //
611 public:
613  calibFactor_(0.)
614  {
615  }
616 
618  PFRecHitQTestBase(iConfig),
619  calibFactor_(iConfig.getParameter<double>("calibFactor"))
620  {
621  }
622 
623  void beginEvent(const edm::Event& event, const edm::EventSetup& iSetup) override {
624  }
625 
626  bool test(reco::PFRecHit& hit, const EcalRecHit& rh, bool& clean, bool fullReadOut) override{
627  return true;
628  }
629  bool test(reco::PFRecHit& hit, const HBHERecHit& rh, bool& clean) override{
630  HcalDetId detId(hit.detId());
631  if (abs(detId.ieta())==29)
632  hit.setEnergy(hit.energy()*calibFactor_);
633  return true;
634  }
635 
636  bool test(reco::PFRecHit& hit, const HFRecHit& rh, bool& clean) override{
637  return true;
638  }
639  bool test(reco::PFRecHit& hit, const HORecHit& rh, bool& clean) override{
640  return true;
641  }
642 
643  bool test(reco::PFRecHit& hit, const CaloTower& rh, bool& clean) override{
644  CaloTowerDetId detId(hit.detId());
645  if (detId.ietaAbs()==29)
646  hit.setEnergy(hit.energy()*calibFactor_);
647  return true;
648  }
649 
650  bool test(reco::PFRecHit& hit, const HGCRecHit& rh, bool& clean) override{
651  return true;
652  }
653 
654 protected:
655  const float calibFactor_;
656 };
657 
659 public:
661  recHitEnergy_keV_(false),
662  threshold_(0.),
663  mip_(0.),
664  recHitEnergyMultiplier_(0.)
665  {
666  }
667 
669  PFRecHitQTestBase(iConfig),
670  recHitEnergy_keV_(iConfig.getParameter<bool>("recHitEnergyIs_keV")),
671  threshold_(iConfig.getParameter<double>("thresholdInMIPs")),
672  mip_(iConfig.getParameter<double>("mipValueInkeV")),
673  recHitEnergyMultiplier_(iConfig.getParameter<double>("recHitEnergyMultiplier"))
674  {
675  }
676 
677  void beginEvent(const edm::Event& event, const edm::EventSetup& iSetup) override {
678  }
679 
680  bool test(reco::PFRecHit& hit, const EcalRecHit& rh, bool& clean, bool fullReadOut) override {
681  throw cms::Exception("WrongDetector")
682  << "PFRecHitQTestThresholdInMIPs only works for HGCAL!";
683  return false;
684  }
685  bool test(reco::PFRecHit& hit, const HBHERecHit& rh, bool& clean) override {
686  throw cms::Exception("WrongDetector")
687  << "PFRecHitQTestThresholdInMIPs only works for HGCAL!";
688  return false;
689  }
690 
691  bool test(reco::PFRecHit& hit, const HFRecHit& rh, bool& clean) override {
692  throw cms::Exception("WrongDetector")
693  << "PFRecHitQTestThresholdInMIPs only works for HGCAL!";
694  return false;
695  }
696  bool test(reco::PFRecHit& hit, const HORecHit& rh, bool& clean) override {
697  throw cms::Exception("WrongDetector")
698  << "PFRecHitQTestThresholdInMIPs only works for HGCAL!";
699  return false;
700  }
701 
702  bool test(reco::PFRecHit& hit, const CaloTower& rh, bool& clean) override {
703  throw cms::Exception("WrongDetector")
704  << "PFRecHitQTestThresholdInMIPs only works for HGCAL!";
705  return false;
706  }
707 
708  bool test(reco::PFRecHit& hit, const HGCRecHit& rh, bool& clean) override {
709  const double newE = ( recHitEnergy_keV_ ?
710  1.0e-6*rh.energy()*recHitEnergyMultiplier_ :
711  rh.energy()*recHitEnergyMultiplier_ );
712  hit.setEnergy(newE);
713  return pass(hit);
714  }
715 
716 protected:
717  const bool recHitEnergy_keV_;
718  const double threshold_, mip_, recHitEnergyMultiplier_;
719 
720  bool pass(const reco::PFRecHit& hit) {
721  const double hitValueInMIPs = 1e6*hit.energy()/mip_;
722  return hitValueInMIPs > threshold_;
723  }
724 };
725 
728  public:
730  geometryInstance_(""),
731  recHitEnergy_keV_(0.),
732  threshold_(0.),
733  mip_(0.),
734  recHitEnergyMultiplier_(0.) {
735  }
736 
738  PFRecHitQTestBase(iConfig),
739  geometryInstance_(iConfig.getParameter<std::string>("geometryInstance")),
740  recHitEnergy_keV_(iConfig.getParameter<bool>("recHitEnergyIs_keV")),
741  threshold_(iConfig.getParameter<double>("thresholdInMIPs")),
742  mip_(iConfig.getParameter<double>("mipValueInkeV")),
743  recHitEnergyMultiplier_(iConfig.getParameter<double>("recHitEnergyMultiplier")) {
744  }
745 
746  void beginEvent(const edm::Event& event, const edm::EventSetup& iSetup) override {
748  iSetup.get<IdealGeometryRecord>().get(geometryInstance_, geoHandle);
749  ddd_ = &(geoHandle->topology().dddConstants());
750  }
751 
752  bool test(reco::PFRecHit& hit, const EcalRecHit& rh, bool& clean, bool fullReadOut) override {
753  throw cms::Exception("WrongDetector")
754  << "PFRecHitQTestThresholdInMIPs only works for HGCAL!";
755  return false;
756  }
757  bool test(reco::PFRecHit& hit, const HBHERecHit& rh, bool& clean) override {
758  throw cms::Exception("WrongDetector")
759  << "PFRecHitQTestThresholdInMIPs only works for HGCAL!";
760  return false;
761  }
762 
763  bool test(reco::PFRecHit& hit, const HFRecHit& rh, bool& clean) override {
764  throw cms::Exception("WrongDetector")
765  << "PFRecHitQTestThresholdInMIPs only works for HGCAL!";
766  return false;
767  }
768  bool test(reco::PFRecHit& hit, const HORecHit& rh, bool& clean) override {
769  throw cms::Exception("WrongDetector")
770  << "PFRecHitQTestThresholdInMIPs only works for HGCAL!";
771  return false;
772  }
773 
774  bool test(reco::PFRecHit& hit, const CaloTower& rh, bool& clean) override {
775  throw cms::Exception("WrongDetector")
776  << "PFRecHitQTestThresholdInMIPs only works for HGCAL!";
777  return false;
778  }
779 
780  bool test(reco::PFRecHit& hit, const HGCRecHit& rh, bool& clean) override {
781  const double newE = ( recHitEnergy_keV_ ?
782  1.0e-6*rh.energy()*recHitEnergyMultiplier_ :
783  rh.energy()*recHitEnergyMultiplier_ );
784  const int wafer = HGCalDetId(rh.detid()).wafer();
785  const float mult = (float) ddd_->waferTypeL(wafer); // 1 for 100um, 2 for 200um, 3 for 300um
786  hit.setEnergy(newE);
787  return pass(hit, mult);
788  }
789 
790  protected:
792  const bool recHitEnergy_keV_;
793  const double threshold_, mip_, recHitEnergyMultiplier_;
795 
796  bool pass(const reco::PFRecHit& hit, const float mult) {
797  const double hitValueInMIPs = 1e6*hit.energy()/(mult*mip_);
798  return hitValueInMIPs > threshold_;
799  }
800 };
801 
802 
804 {
805  public:
807  thresholdSNR_(0.)
808  {
809  }
810 
812  PFRecHitQTestBase(iConfig), thresholdSNR_(iConfig.getParameter<double>("thresholdSNR"))
813  {
814  }
815 
816  void beginEvent(const edm::Event& event, const edm::EventSetup& iSetup) override
817  {
818  }
819 
820  bool test(reco::PFRecHit& hit, const EcalRecHit& rh, bool& clean, bool fullReadOut) override
821  {
822  throw cms::Exception("WrongDetector")
823  << "PFRecHitQTestHGCalThresholdSNR only works for HGCAL!";
824  return false;
825  }
826  bool test(reco::PFRecHit& hit, const HBHERecHit& rh, bool& clean) override
827  {
828  throw cms::Exception("WrongDetector")
829  << "PFRecHitQTestHGCalThresholdSNR only works for HGCAL!";
830  return false;
831  }
832 
833  bool test(reco::PFRecHit& hit, const HFRecHit& rh, bool& clean) override
834  {
835  throw cms::Exception("WrongDetector")
836  << "PFRecHitQTestHGCalThresholdSNR only works for HGCAL!";
837  return false;
838  }
839  bool test(reco::PFRecHit& hit, const HORecHit& 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 CaloTower& rh, bool& clean) override
847  {
848  throw cms::Exception("WrongDetector")
849  << "PFRecHitQTestHGCalThresholdSNR only works for HGCAL!";
850  return false;
851  }
852 
853  bool test(reco::PFRecHit& hit, const HGCRecHit& rh, bool& clean) override
854  {
855  return rh.signalOverSigmaNoise() >= thresholdSNR_;
856  }
857 
858  protected:
859  const double thresholdSNR_;
860 };
861 
862 #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:44
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:32
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:98
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:58
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:176
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:168
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