CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PFRecHitQTests.h
Go to the documentation of this file.
1 #ifndef RecoParticleFlow_PFClusterProducer_PFEcalRecHitQTests_h
2 #define RecoParticleFlow_PFClusterProducer_PFEcalRecHitQTests_h
3 
4 #include <memory>
6 
7 
8 
9 //
10 // Quality test that checks threshold
11 //
13  public:
15 
16  }
17 
19  PFRecHitQTestBase(iConfig)
20  {
21  threshold_ = iConfig.getParameter<double>("threshold");
22 
23  }
24 
25  void beginEvent(const edm::Event& event,const edm::EventSetup& iSetup) {
26  }
27 
28  bool test(reco::PFRecHit& hit,const EcalRecHit& rh,bool& clean){
29  return pass(hit);
30  }
31  bool test(reco::PFRecHit& hit,const HBHERecHit& rh,bool& clean){
32  return pass(hit);
33  }
34 
35  bool test(reco::PFRecHit& hit,const HFRecHit& rh,bool& clean){
36  return pass(hit);
37  }
38  bool test(reco::PFRecHit& hit,const HORecHit& rh,bool& clean){
39  return pass(hit);
40  }
41 
42  bool test(reco::PFRecHit& hit,const CaloTower& rh,bool& clean){
43  return pass(hit);
44  }
45 
46  protected:
47  double threshold_;
48 
49  bool pass(const reco::PFRecHit& hit){
50  if (hit.energy()>threshold_) return true;
51 
52  return false;
53  }
54 };
55 
56 
57 
58 
59 //
60 // Quality test that checks kHCAL Severity
61 //
63 
64  public:
65 
66 
68 
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 (unsigned int i=0;i<flags.size();++i) {
78  if (flags[i] =="Standard") {
79  flags_.push_back(-1);
80  depths_.push_back(-1);
81 
82  }
83  else if (flags[i] =="HFInTime") {
85  depths_.push_back(-1);
86  }
87  else if (flags[i] =="HFDigi") {
89  depths_.push_back(-1);
90 
91  }
92  else if (flags[i] =="HFLong") {
94  depths_.push_back(1);
95 
96  }
97  else if (flags[i] =="HFShort") {
99  depths_.push_back(2);
100 
101  }
102  else {
103  flags_.push_back(-1);
104  depths_.push_back(-1);
105 
106  }
107  }
108 
109  }
110 
111  void beginEvent(const edm::Event& event,const edm::EventSetup& iSetup) {
113  iSetup.get<IdealGeometryRecord>().get(topo);
114  edm::ESHandle<HcalChannelQuality> hcalChStatus;
115  iSetup.get<HcalChannelQualityRcd>().get( "withTopo", hcalChStatus );
116  theHcalChStatus_ = hcalChStatus.product();
117  edm::ESHandle<HcalSeverityLevelComputer> hcalSevLvlComputerHndl;
118  iSetup.get<HcalSeverityLevelComputerRcd>().get(hcalSevLvlComputerHndl);
119  hcalSevLvlComputer_ = hcalSevLvlComputerHndl.product();
120  }
121 
122  bool test(reco::PFRecHit& hit,const EcalRecHit& rh,bool& clean){
123  return true;
124  }
125  bool test(reco::PFRecHit& hit,const HBHERecHit& rh,bool& clean){
126  return test(rh.detid(),rh.energy(),rh.flags(),clean);
127  }
128 
129  bool test(reco::PFRecHit& hit,const HFRecHit& rh,bool& clean){
130  return test(rh.detid(),rh.energy(),rh.flags(),clean);
131  }
132  bool test(reco::PFRecHit& hit,const HORecHit& rh,bool& clean){
133  return test(rh.detid(),rh.energy(),rh.flags(),clean);
134  }
135 
136  bool test(reco::PFRecHit& hit,const CaloTower& rh,bool& clean){
137  return true;
138 
139  }
140 
141  protected:
142  std::vector<int> thresholds_;
143  std::vector<double> cleanThresholds_;
144  std::vector<int> flags_;
145  std::vector<int> depths_;
148 
149  bool test(unsigned aDETID,double energy,int flags,bool& clean){
150  const HcalDetId& detid = (HcalDetId)aDETID;
151  const HcalChannelStatus* theStatus = theHcalChStatus_->getValues(detid);
152  unsigned theStatusValue = theStatus->getValue();
153  // Now get severity of problems for the given detID, based on the rechit flag word and the channel quality status value
154  for (unsigned int i=0;i<thresholds_.size();++i) {
155  int hitSeverity =0;
156  if (energy < cleanThresholds_[i])
157  continue;
158 
159  if(flags_[i]<0) {
160  hitSeverity=hcalSevLvlComputer_->getSeverityLevel(detid, flags,theStatusValue);
161  }
162  else {
163  hitSeverity=hcalSevLvlComputer_->getSeverityLevel(detid, flags & flags_[i],theStatusValue);
164  }
165 
166  if (hitSeverity>thresholds_[i] && ((depths_[i]<0 || (depths_[i]==detid.depth())))) {
167  clean=true;
168  return false;
169  }
170  }
171  return true;
172  }
173 
174 };
175 
176 //
177 // Quality test that applies threshold and timing as a function of depth
178 //
180  public:
182 
183  }
184 
186  PFRecHitQTestBase(iConfig)
187  {
188  std::vector<edm::ParameterSet> psets = iConfig.getParameter<std::vector<edm::ParameterSet> >("cuts");
189  for (unsigned int i=0;i<psets.size();++i) {
190  depths_.push_back(psets[i].getParameter<int>("depth"));
191  minTimes_.push_back(psets[i].getParameter<double>("minTime"));
192  maxTimes_.push_back(psets[i].getParameter<double>("maxTime"));
193  thresholds_.push_back(psets[i].getParameter<double>("threshold"));
194  }
195  }
196 
197  void beginEvent(const edm::Event& event,const edm::EventSetup& iSetup) {
198  }
199 
200  bool test(reco::PFRecHit& hit,const EcalRecHit& rh,bool& clean){
201  return true;
202  }
203  bool test(reco::PFRecHit& hit,const HBHERecHit& rh,bool& clean){
204  return test(rh.detid(),rh.energy(),rh.time(),clean);
205  }
206 
207  bool test(reco::PFRecHit& hit,const HFRecHit& rh,bool& clean){
208  return test(rh.detid(),rh.energy(),rh.time(),clean);
209  }
210  bool test(reco::PFRecHit& hit,const HORecHit& rh,bool& clean) {
211  return test(rh.detid(),rh.energy(),rh.time(),clean);
212  }
213 
214  bool test(reco::PFRecHit& hit,const CaloTower& rh,bool& clean){
215  return true;
216  }
217 
218  protected:
219  std::vector<int> depths_;
220  std::vector<double> minTimes_;
221  std::vector<double> maxTimes_;
222  std::vector<double> thresholds_;
223 
224  bool test(unsigned aDETID,double energy,double time,bool& clean){
225  HcalDetId detid(aDETID);
226  for (unsigned int i=0;i<depths_.size();++i) {
227  if (detid.depth() == depths_[i]) {
228  if ((time <minTimes_[i] || time >maxTimes_[i] ) && energy>thresholds_[i])
229  {
230  clean=true;
231  return false;
232  }
233  break;
234  }
235  }
236  return true;
237  }
238 };
239 
240 
241 
242 
243 //
244 // Quality test that applies threshold as a function of depth
245 //
247  public:
249 
250  }
251 
253  PFRecHitQTestBase(iConfig)
254  {
255  std::vector<edm::ParameterSet> psets = iConfig.getParameter<std::vector<edm::ParameterSet> >("cuts");
256  for (unsigned int i=0;i<psets.size();++i) {
257  depths_.push_back(psets[i].getParameter<int>("depth"));
258  thresholds_.push_back(psets[i].getParameter<double>("threshold"));
259  }
260  }
261 
262  void beginEvent(const edm::Event& event,const edm::EventSetup& iSetup) {
263  }
264 
265  bool test(reco::PFRecHit& hit,const EcalRecHit& rh,bool& clean){
266  return true;
267  }
268  bool test(reco::PFRecHit& hit,const HBHERecHit& rh,bool& clean){
269  return test(rh.detid(),rh.energy(),rh.time(),clean);
270  }
271 
272  bool test(reco::PFRecHit& hit,const HFRecHit& rh,bool& clean){
273  return test(rh.detid(),rh.energy(),rh.time(),clean);
274  }
275  bool test(reco::PFRecHit& hit,const HORecHit& rh,bool& clean){
276  return test(rh.detid(),rh.energy(),rh.time(),clean);
277  }
278 
279  bool test(reco::PFRecHit& hit,const CaloTower& rh,bool& clean){
280  return true;
281  }
282 
283  protected:
284  std::vector<int> depths_;
285  std::vector<double> thresholds_;
286 
287  bool test(unsigned aDETID,double energy,double time,bool& clean){
288  HcalDetId detid(aDETID);
289  for (unsigned int i=0;i<depths_.size();++i) {
290  if (detid.depth() == depths_[i]) {
291  if ( energy<thresholds_[i])
292  {
293  clean=true;
294  return false;
295  }
296  break;
297  }
298  }
299  return true;
300  }
301 };
302 
303 
304 
305 
306 
307 //
308 // Quality test that checks HO threshold applying different threshold in rings
309 //
311  public:
313 
314  }
315 
317  PFRecHitQTestBase(iConfig)
318  {
319  threshold0_ = iConfig.getParameter<double>("threshold_ring0");
320  threshold12_ = iConfig.getParameter<double>("threshold_ring12");
321  }
322 
323  void beginEvent(const edm::Event& event,const edm::EventSetup& iSetup) {
324  }
325 
326  bool test(reco::PFRecHit& hit,const EcalRecHit& rh,bool& clean){
327  return true;
328  }
329  bool test(reco::PFRecHit& hit,const HBHERecHit& rh,bool& clean){
330  return true;
331  }
332 
333  bool test(reco::PFRecHit& hit,const HFRecHit& rh,bool& clean){
334  return true;
335  }
336  bool test(reco::PFRecHit& hit,const HORecHit& rh,bool& clean){
337  HcalDetId detid(rh.detid());
338  if (abs(detid.ieta())<=4 && hit.energy()>threshold0_)
339  return true;
340  if (abs(detid.ieta())>4 && hit.energy()>threshold12_)
341  return true;
342 
343  return false;
344  }
345 
346  bool test(reco::PFRecHit& hit,const CaloTower& rh,bool& clean){
347  return true;
348  }
349 
350  protected:
351  double threshold0_;
352  double threshold12_;
353 
354 };
355 
356 //
357 // Quality test that checks ecal quality cuts
358 //
360  public:
362 
363  }
364 
366  PFRecHitQTestBase(iConfig)
367  {
368  thresholdCleaning_ = iConfig.getParameter<double>("cleaningThreshold");
369  timingCleaning_ = iConfig.getParameter<bool>("timingCleaning");
370  topologicalCleaning_ = iConfig.getParameter<bool>("topologicalCleaning");
371  skipTTRecoveredHits_ = iConfig.getParameter<bool>("skipTTRecoveredHits");
372 
373  }
374 
375  void beginEvent(const edm::Event& event,const edm::EventSetup& iSetup) {
376  }
377 
378  bool test(reco::PFRecHit& hit,const EcalRecHit& rh,bool& clean){
380  {
381  clean=true;
382  return false;
383  }
384  if ( timingCleaning_ && rh.energy() > thresholdCleaning_ &&
386  clean=true;
387  return false;
388  }
389 
390  if ( topologicalCleaning_ &&
391  ( rh.checkFlag(EcalRecHit::kWeird) ||
393  clean=true;
394  return false;
395  }
396 
397  return true;
398  }
399 
400  bool test(reco::PFRecHit& hit,const HBHERecHit& rh,bool& clean){
401  return true;
402  }
403 
404  bool test(reco::PFRecHit& hit,const HFRecHit& rh,bool& clean){
405  return true;
406 
407  }
408 
409  bool test(reco::PFRecHit& hit,const HORecHit& rh,bool& clean){
410  return true;
411  }
412 
413  bool test(reco::PFRecHit& hit,const CaloTower& rh,bool& clean){
414  return true;
415 
416  }
417 
418 
419  protected:
424 
425 };
426 
427 
428 
429 
430 
431 //
432 // Quality test that calibrates tower 29 of HCAL
433 //
435  public:
437 
438  }
439 
441  PFRecHitQTestBase(iConfig)
442  {
443  calibFactor_ =iConfig.getParameter<double>("calibFactor");
444  }
445 
446  void beginEvent(const edm::Event& event,const edm::EventSetup& iSetup) {
447  }
448 
449  bool test(reco::PFRecHit& hit,const EcalRecHit& rh,bool& clean){
450  return true;
451  }
452  bool test(reco::PFRecHit& hit,const HBHERecHit& rh,bool& clean){
453  HcalDetId detId(hit.detId());
454  if (abs(detId.ieta())==29)
455  hit.setEnergy(hit.energy()*calibFactor_);
456  return true;
457 
458  }
459 
460  bool test(reco::PFRecHit& hit,const HFRecHit& rh,bool& clean){
461  return true;
462 
463  }
464  bool test(reco::PFRecHit& hit,const HORecHit& rh,bool& clean){
465  return true;
466  }
467 
468  bool test(reco::PFRecHit& hit,const CaloTower& rh,bool& clean){
469  CaloTowerDetId detId(hit.detId());
470  if (detId.ietaAbs()==29)
471  hit.setEnergy(hit.energy()*calibFactor_);
472  return true;
473 
474  }
475 
476  protected:
478 };
479 
480 
481 
482 #endif
T getParameter(std::string const &) const
void beginEvent(const edm::Event &event, const edm::EventSetup &iSetup)
bool test(reco::PFRecHit &hit, const CaloTower &rh, bool &clean)
int i
Definition: DBlmapReader.cc:9
bool test(reco::PFRecHit &hit, const HFRecHit &rh, bool &clean)
const HcalChannelQuality * theHcalChStatus_
bool test(reco::PFRecHit &hit, const HBHERecHit &rh, bool &clean)
bool test(reco::PFRecHit &hit, const HFRecHit &rh, bool &clean)
std::vector< double > minTimes_
bool pass(const reco::PFRecHit &hit)
void beginEvent(const edm::Event &event, const edm::EventSetup &iSetup)
bool test(reco::PFRecHit &hit, const HFRecHit &rh, bool &clean)
const DetId & detid() const
Definition: CaloRecHit.h:20
unsigned detId() const
rechit detId
Definition: PFRecHit.h:106
PFRecHitQTestThreshold(const edm::ParameterSet &iConfig)
std::vector< int > depths_
bool test(reco::PFRecHit &hit, const HBHERecHit &rh, bool &clean)
const HcalSeverityLevelComputer * hcalSevLvlComputer_
std::vector< double > maxTimes_
bool test(reco::PFRecHit &hit, const HFRecHit &rh, bool &clean)
std::vector< Variable::Flags > flags
Definition: MVATrainer.cc:135
bool test(reco::PFRecHit &hit, const HORecHit &rh, bool &clean)
bool test(reco::PFRecHit &hit, const HORecHit &rh, bool &clean)
PFRecHitQTestECAL(const edm::ParameterSet &iConfig)
const Item * getValues(DetId fId, bool throwOnFail=true) const
bool test(unsigned aDETID, double energy, double time, bool &clean)
bool test(reco::PFRecHit &hit, const HORecHit &rh, bool &clean)
void beginEvent(const edm::Event &event, const edm::EventSetup &iSetup)
float time() const
Definition: CaloRecHit.h:19
PFRecHitQTestHCALChannel(const edm::ParameterSet &iConfig)
std::vector< double > cleanThresholds_
std::vector< double > thresholds_
void beginEvent(const edm::Event &event, const edm::EventSetup &iSetup)
PFRecHitQTestHCALThresholdVsDepth(const edm::ParameterSet &iConfig)
bool test(reco::PFRecHit &hit, const HBHERecHit &rh, bool &clean)
std::vector< double > thresholds_
bool test(unsigned aDETID, double energy, double time, bool &clean)
bool test(reco::PFRecHit &hit, const CaloTower &rh, bool &clean)
void setEnergy(double energy)
Definition: PFRecHit.h:72
bool test(reco::PFRecHit &hit, const HORecHit &rh, bool &clean)
bool test(reco::PFRecHit &hit, const EcalRecHit &rh, bool &clean)
int depth() const
get the tower depth
Definition: HcalDetId.h:40
Particle flow rechit (rechit + geometry and topology information). See clustering algorithm in PFClus...
Definition: PFRecHit.h:35
bool checkFlag(int flag) const
check if the flag is true
Definition: EcalRecHit.h:172
float energy() const
Definition: CaloRecHit.h:17
bool test(reco::PFRecHit &hit, const HFRecHit &rh, bool &clean)
bool test(reco::PFRecHit &hit, const CaloTower &rh, bool &clean)
bool test(reco::PFRecHit &hit, const HORecHit &rh, bool &clean)
PFRecHitQTestHCALCalib29(const edm::ParameterSet &iConfig)
uint32_t flags() const
Definition: CaloRecHit.h:21
bool test(reco::PFRecHit &hit, const HFRecHit &rh, bool &clean)
bool test(reco::PFRecHit &hit, const CaloTower &rh, bool &clean)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool test(reco::PFRecHit &hit, const HBHERecHit &rh, bool &clean)
float energy() const
Definition: EcalRecHit.h:68
bool test(reco::PFRecHit &hit, const HBHERecHit &rh, bool &clean)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
PFRecHitQTestHCALTimeVsDepth(const edm::ParameterSet &iConfig)
std::vector< T * > clean
Definition: MVATrainer.cc:156
void beginEvent(const edm::Event &event, const edm::EventSetup &iSetup)
bool test(reco::PFRecHit &hit, const HORecHit &rh, bool &clean)
PFRecHitQTestHOThreshold(const edm::ParameterSet &iConfig)
bool test(reco::PFRecHit &hit, const EcalRecHit &rh, bool &clean)
bool test(reco::PFRecHit &hit, const EcalRecHit &rh, bool &clean)
bool test(reco::PFRecHit &hit, const HFRecHit &rh, bool &clean)
const T & get() const
Definition: EventSetup.h:55
bool test(reco::PFRecHit &hit, const EcalRecHit &rh, bool &clean)
bool test(reco::PFRecHit &hit, const CaloTower &rh, bool &clean)
T const * product() const
Definition: ESHandle.h:86
int getSeverityLevel(const DetId &myid, const uint32_t &myflag, const uint32_t &mystatus) const
std::vector< int > depths_
bool test(reco::PFRecHit &hit, const CaloTower &rh, bool &clean)
bool test(reco::PFRecHit &hit, const EcalRecHit &rh, bool &clean)
double energy() const
rechit energy
Definition: PFRecHit.h:112
std::vector< int > thresholds_
bool test(reco::PFRecHit &hit, const CaloTower &rh, bool &clean)
bool test(reco::PFRecHit &hit, const EcalRecHit &rh, bool &clean)
bool test(reco::PFRecHit &hit, const EcalRecHit &rh, bool &clean)
bool test(unsigned aDETID, double energy, int flags, bool &clean)
uint32_t getValue() const
bool test(reco::PFRecHit &hit, const HORecHit &rh, bool &clean)
void beginEvent(const edm::Event &event, const edm::EventSetup &iSetup)
void beginEvent(const edm::Event &event, const edm::EventSetup &iSetup)
std::vector< int > flags_
bool test(reco::PFRecHit &hit, const HBHERecHit &rh, bool &clean)
bool test(reco::PFRecHit &hit, const HBHERecHit &rh, bool &clean)