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  applySelectionsToAllCrystals_(iConfig.getParameter<bool>("applySelectionsToAllCrystals"))
389  {
390  if (thresholds_.size() != EcalRingCalibrationTools::N_RING_TOTAL)
391  throw edm::Exception(edm::errors::Configuration, "ValueError")
392  << "thresholds is expected to have " << EcalRingCalibrationTools::N_RING_TOTAL << " elements but has " << thresholds_.size();
393  }
394 
395  void beginEvent(const edm::Event& event, const edm::EventSetup& iSetup) override {
397  iSetup.get<CaloGeometryRecord>().get(pG);
399  endcapGeometrySet_=false;
400  if (endcapGeometry) {
402  endcapGeometrySet_=true;
403  }
404  }
405 
406  bool test(reco::PFRecHit& hit, const EcalRecHit& rh, bool& clean, bool fullReadOut) override{
407  if (applySelectionsToAllCrystals_) return pass(hit);
408  else return fullReadOut or pass(hit);
409  }
410  bool test(reco::PFRecHit& hit, const HBHERecHit& rh, bool& clean) override{
411  return true;
412  }
413 
414  bool test(reco::PFRecHit& hit, const HFRecHit& rh, bool& clean) override{
415  return true;
416  }
417  bool test(reco::PFRecHit& hit, const HORecHit& rh, bool& clean) override{
418  return true;
419  }
420 
421  bool test(reco::PFRecHit& hit, const CaloTower& rh, bool& clean) override{
422  return true;
423  }
424 
425  bool test(reco::PFRecHit& hit, const HGCRecHit& rh, bool& clean) override{
426  return true;
427  }
428 
429 protected:
430  const std::vector<double> thresholds_;
432 
433  // apply selections to all crystals
435 
436  bool pass(const reco::PFRecHit& hit){
437 
438  DetId detId(hit.detId());
439 
440  // this is to skip endcap ZS for Phase2 until there is a defined geometry
441  // apply the loosest ZS threshold, for the first eta-ring in EB
442  if (not endcapGeometrySet_) {
443 
444  // there is only ECAL EB in Phase 2
445  if(detId.subdetId() != EcalBarrel) return true;
446 
447  // 0-169: EB eta-rings
448  // 170-208: EE- eta rings
449  // 209-247: EE+ eta rings
450  int firstEBRing = 0;
451  return (hit.energy() > thresholds_[firstEBRing]);
452  }
453 
454  int iring = EcalRingCalibrationTools::getRingIndex(detId);
455  if (hit.energy() > thresholds_[iring]) return true;
456 
457  return false;
458  }
459 };
460 
461 
462 //
463 // Quality test that checks ecal quality cuts
464 //
466  public:
468  }
469 
471  PFRecHitQTestBase(iConfig),
472  thresholdCleaning_(iConfig.getParameter<double>("cleaningThreshold")),
473  timingCleaning_(iConfig.getParameter<bool>("timingCleaning")),
474  topologicalCleaning_(iConfig.getParameter<bool>("topologicalCleaning")),
475  skipTTRecoveredHits_(iConfig.getParameter<bool>("skipTTRecoveredHits"))
476  {
477  }
478 
479  void beginEvent(const edm::Event& event, const edm::EventSetup& iSetup) override {
480  }
481 
482  bool test(reco::PFRecHit& hit, const EcalRecHit& rh, bool& clean, bool fullReadOut) override{
483  if (skipTTRecoveredHits_ and rh.checkFlag(EcalRecHit::kTowerRecovered))
484  {
485  clean=true;
486  return false;
487  }
488  if (timingCleaning_ and rh.energy() > thresholdCleaning_ and
490  {
491  clean=true;
492  return false;
493  }
494 
495  if (topologicalCleaning_ and (
498  {
499  clean=true;
500  return false;
501  }
502 
503  return true;
504  }
505 
506  bool test(reco::PFRecHit& hit, const HBHERecHit& rh, bool& clean) override{
507  return true;
508  }
509 
510  bool test(reco::PFRecHit& hit, const HFRecHit& rh, bool& clean) override{
511  return true;
512  }
513 
514  bool test(reco::PFRecHit& hit, const HORecHit& rh, bool& clean) override{
515  return true;
516  }
517 
518  bool test(reco::PFRecHit& hit, const CaloTower& rh, bool& clean) override{
519  return true;
520  }
521 
522  bool test(reco::PFRecHit& hit, const HGCRecHit& rh, bool& clean) override{
523  return true;
524  }
525 
526 protected:
531 
532 };
533 
534 //
535 // Quality test that checks ES quality cuts
536 //
538 public:
540  thresholdCleaning_(0.),
541  topologicalCleaning_(false)
542  {
543  }
544 
546  PFRecHitQTestBase(iConfig),
547  thresholdCleaning_(iConfig.getParameter<double>("cleaningThreshold")),
548  topologicalCleaning_(iConfig.getParameter<bool>("topologicalCleaning"))
549  {
550  }
551 
552  void beginEvent(const edm::Event& event, const edm::EventSetup& iSetup) override {
553  }
554 
555  bool test(reco::PFRecHit& hit, const EcalRecHit& rh, bool& clean, bool fullReadOut) override {
556 
557  if ( rh.energy() < thresholdCleaning_ ) {
558  clean=false;
559  return false;
560  }
561 
562  if ( topologicalCleaning_ and
571  )) {
572  clean=false;
573  return false;
574  }
575 
576  return true;
577  }
578 
579  bool test(reco::PFRecHit& hit, const HBHERecHit& rh, bool& clean) override{
580  return true;
581  }
582 
583  bool test(reco::PFRecHit& hit, const HFRecHit& rh, bool& clean) override{
584  return true;
585  }
586 
587  bool test(reco::PFRecHit& hit, const HORecHit& rh, bool& clean) override{
588  return true;
589  }
590 
591  bool test(reco::PFRecHit& hit, const CaloTower& rh, bool& clean) override{
592  return true;
593  }
594 
595  bool test(reco::PFRecHit& hit, const HGCRecHit& rh, bool& clean) override{
596  return true;
597  }
598 
599 protected:
600  const double thresholdCleaning_;
602 
603 };
604 
605 //
606 // Quality test that calibrates tower 29 of HCAL
607 //
609 public:
611  calibFactor_(0.)
612  {
613  }
614 
616  PFRecHitQTestBase(iConfig),
617  calibFactor_(iConfig.getParameter<double>("calibFactor"))
618  {
619  }
620 
621  void beginEvent(const edm::Event& event, const edm::EventSetup& iSetup) override {
622  }
623 
624  bool test(reco::PFRecHit& hit, const EcalRecHit& rh, bool& clean, bool fullReadOut) override{
625  return true;
626  }
627  bool test(reco::PFRecHit& hit, const HBHERecHit& rh, bool& clean) override{
628  HcalDetId detId(hit.detId());
629  if (abs(detId.ieta())==29)
630  hit.setEnergy(hit.energy()*calibFactor_);
631  return true;
632  }
633 
634  bool test(reco::PFRecHit& hit, const HFRecHit& rh, bool& clean) override{
635  return true;
636  }
637  bool test(reco::PFRecHit& hit, const HORecHit& rh, bool& clean) override{
638  return true;
639  }
640 
641  bool test(reco::PFRecHit& hit, const CaloTower& rh, bool& clean) override{
642  CaloTowerDetId detId(hit.detId());
643  if (detId.ietaAbs()==29)
644  hit.setEnergy(hit.energy()*calibFactor_);
645  return true;
646  }
647 
648  bool test(reco::PFRecHit& hit, const HGCRecHit& rh, bool& clean) override{
649  return true;
650  }
651 
652 protected:
653  const float calibFactor_;
654 };
655 
657 public:
659  recHitEnergy_keV_(false),
660  threshold_(0.),
661  mip_(0.),
662  recHitEnergyMultiplier_(0.)
663  {
664  }
665 
667  PFRecHitQTestBase(iConfig),
668  recHitEnergy_keV_(iConfig.getParameter<bool>("recHitEnergyIs_keV")),
669  threshold_(iConfig.getParameter<double>("thresholdInMIPs")),
670  mip_(iConfig.getParameter<double>("mipValueInkeV")),
671  recHitEnergyMultiplier_(iConfig.getParameter<double>("recHitEnergyMultiplier"))
672  {
673  }
674 
675  void beginEvent(const edm::Event& event, const edm::EventSetup& iSetup) override {
676  }
677 
678  bool test(reco::PFRecHit& hit, const EcalRecHit& rh, bool& clean, bool fullReadOut) override {
679  throw cms::Exception("WrongDetector")
680  << "PFRecHitQTestThresholdInMIPs only works for HGCAL!";
681  return false;
682  }
683  bool test(reco::PFRecHit& hit, const HBHERecHit& rh, bool& clean) override {
684  throw cms::Exception("WrongDetector")
685  << "PFRecHitQTestThresholdInMIPs only works for HGCAL!";
686  return false;
687  }
688 
689  bool test(reco::PFRecHit& hit, const HFRecHit& rh, bool& clean) override {
690  throw cms::Exception("WrongDetector")
691  << "PFRecHitQTestThresholdInMIPs only works for HGCAL!";
692  return false;
693  }
694  bool test(reco::PFRecHit& hit, const HORecHit& rh, bool& clean) override {
695  throw cms::Exception("WrongDetector")
696  << "PFRecHitQTestThresholdInMIPs only works for HGCAL!";
697  return false;
698  }
699 
700  bool test(reco::PFRecHit& hit, const CaloTower& rh, bool& clean) override {
701  throw cms::Exception("WrongDetector")
702  << "PFRecHitQTestThresholdInMIPs only works for HGCAL!";
703  return false;
704  }
705 
706  bool test(reco::PFRecHit& hit, const HGCRecHit& rh, bool& clean) override {
707  const double newE = ( recHitEnergy_keV_ ?
708  1.0e-6*rh.energy()*recHitEnergyMultiplier_ :
709  rh.energy()*recHitEnergyMultiplier_ );
710  hit.setEnergy(newE);
711  return pass(hit);
712  }
713 
714 protected:
715  const bool recHitEnergy_keV_;
716  const double threshold_, mip_, recHitEnergyMultiplier_;
717 
718  bool pass(const reco::PFRecHit& hit) {
719  const double hitValueInMIPs = 1e6*hit.energy()/mip_;
720  return hitValueInMIPs > threshold_;
721  }
722 };
723 
726  public:
728  geometryInstance_(""),
729  recHitEnergy_keV_(0.),
730  threshold_(0.),
731  mip_(0.),
732  recHitEnergyMultiplier_(0.) {
733  }
734 
736  PFRecHitQTestBase(iConfig),
737  geometryInstance_(iConfig.getParameter<std::string>("geometryInstance")),
738  recHitEnergy_keV_(iConfig.getParameter<bool>("recHitEnergyIs_keV")),
739  threshold_(iConfig.getParameter<double>("thresholdInMIPs")),
740  mip_(iConfig.getParameter<double>("mipValueInkeV")),
741  recHitEnergyMultiplier_(iConfig.getParameter<double>("recHitEnergyMultiplier")) {
742  }
743 
744  void beginEvent(const edm::Event& event, const edm::EventSetup& iSetup) override {
746  iSetup.get<IdealGeometryRecord>().get(geometryInstance_, geoHandle);
747  ddd_ = &(geoHandle->topology().dddConstants());
748  }
749 
750  bool test(reco::PFRecHit& hit, const EcalRecHit& rh, bool& clean, bool fullReadOut) override {
751  throw cms::Exception("WrongDetector")
752  << "PFRecHitQTestThresholdInMIPs only works for HGCAL!";
753  return false;
754  }
755  bool test(reco::PFRecHit& hit, const HBHERecHit& rh, bool& clean) override {
756  throw cms::Exception("WrongDetector")
757  << "PFRecHitQTestThresholdInMIPs only works for HGCAL!";
758  return false;
759  }
760 
761  bool test(reco::PFRecHit& hit, const HFRecHit& rh, bool& clean) override {
762  throw cms::Exception("WrongDetector")
763  << "PFRecHitQTestThresholdInMIPs only works for HGCAL!";
764  return false;
765  }
766  bool test(reco::PFRecHit& hit, const HORecHit& rh, bool& clean) override {
767  throw cms::Exception("WrongDetector")
768  << "PFRecHitQTestThresholdInMIPs only works for HGCAL!";
769  return false;
770  }
771 
772  bool test(reco::PFRecHit& hit, const CaloTower& rh, bool& clean) override {
773  throw cms::Exception("WrongDetector")
774  << "PFRecHitQTestThresholdInMIPs only works for HGCAL!";
775  return false;
776  }
777 
778  bool test(reco::PFRecHit& hit, const HGCRecHit& rh, bool& clean) override {
779  const double newE = ( recHitEnergy_keV_ ?
780  1.0e-6*rh.energy()*recHitEnergyMultiplier_ :
781  rh.energy()*recHitEnergyMultiplier_ );
782  const int wafer = HGCalDetId(rh.detid()).wafer();
783  const float mult = (float) ddd_->waferTypeL(wafer); // 1 for 100um, 2 for 200um, 3 for 300um
784  hit.setEnergy(newE);
785  return pass(hit, mult);
786  }
787 
788  protected:
790  const bool recHitEnergy_keV_;
791  const double threshold_, mip_, recHitEnergyMultiplier_;
793 
794  bool pass(const reco::PFRecHit& hit, const float mult) {
795  const double hitValueInMIPs = 1e6*hit.energy()/(mult*mip_);
796  return hitValueInMIPs > threshold_;
797  }
798 };
799 
800 
802 {
803  public:
805  thresholdSNR_(0.)
806  {
807  }
808 
810  PFRecHitQTestBase(iConfig), thresholdSNR_(iConfig.getParameter<double>("thresholdSNR"))
811  {
812  }
813 
814  void beginEvent(const edm::Event& event, const edm::EventSetup& iSetup) override
815  {
816  }
817 
818  bool test(reco::PFRecHit& hit, const EcalRecHit& rh, bool& clean, bool fullReadOut) override
819  {
820  throw cms::Exception("WrongDetector")
821  << "PFRecHitQTestHGCalThresholdSNR only works for HGCAL!";
822  return false;
823  }
824  bool test(reco::PFRecHit& hit, const HBHERecHit& rh, bool& clean) override
825  {
826  throw cms::Exception("WrongDetector")
827  << "PFRecHitQTestHGCalThresholdSNR only works for HGCAL!";
828  return false;
829  }
830 
831  bool test(reco::PFRecHit& hit, const HFRecHit& rh, bool& clean) override
832  {
833  throw cms::Exception("WrongDetector")
834  << "PFRecHitQTestHGCalThresholdSNR only works for HGCAL!";
835  return false;
836  }
837  bool test(reco::PFRecHit& hit, const HORecHit& rh, bool& clean) override
838  {
839  throw cms::Exception("WrongDetector")
840  << "PFRecHitQTestHGCalThresholdSNR only works for HGCAL!";
841  return false;
842  }
843 
844  bool test(reco::PFRecHit& hit, const CaloTower& rh, bool& clean) override
845  {
846  throw cms::Exception("WrongDetector")
847  << "PFRecHitQTestHGCalThresholdSNR only works for HGCAL!";
848  return false;
849  }
850 
851  bool test(reco::PFRecHit& hit, const HGCRecHit& rh, bool& clean) override
852  {
853  return rh.signalOverSigmaNoise() >= thresholdSNR_;
854  }
855 
856  protected:
857  const double thresholdSNR_;
858 };
859 
860 #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:129
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