test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
compareMissingEnergySums.h
Go to the documentation of this file.
1 #ifndef compareMissingEnergySums_h
2 #define compareMissingEnergySums_h
3 
7 
10 
13 
15 
17 
19 
20 #include "TH2.h"
21 #include "TH1.h"
22 
23 template <class T>
25  public:
26  compareMissingEnergySums(const T &data, const T &emu, const GctErrorAnalyzerMBxInfo &mbxparams);
28 
29  bool doCompare(TH1I *errorFlag_hist_);
30 
31  private:
34 };
35 
36 template<class T>
38  data_(data),
39  emu_(emu),
40  mbxparams_(mbxparams)
41 {
42 
43 }
44 
45 template<class T>
47 
48 }
49 
50 template<class T>
51 bool compareMissingEnergySums<T>::doCompare(TH1I *errorFlag_hist_) {
52 
53  bool errorFlag=0;
54 
55  for(unsigned int i=0; i < data_->size(); i++) {
56  if(data_->at(i).bx() != mbxparams_.GCTTrigBx) continue;
57 
58  for(unsigned int j=0; j < emu_->size(); j++) {
59  if(emu_->at(j).bx() != mbxparams_.EmuTrigBx) continue;
60 
61  if(data_->at(i).overFlow() && emu_->at(j).overFlow()) {
62  //if both overflow bits are set then = match
63  errorFlag_hist_->Fill(0);
64  return errorFlag;
65  }
66 
67  //check that we consider non-zero candidates - if we don't, return (don't fill hist)
68  if(!data_->at(i).overFlow() && !emu_->at(j).overFlow() && data_->at(i).et() == 0 && emu_->at(j).et() == 0) return errorFlag;
69 
70  if(!data_->at(i).overFlow() && !emu_->at(j).overFlow() && data_->at(i).et() == emu_->at(j).et() && data_->at(i).phi() == emu_->at(j).phi()) {
71  //similarly, if the overflow bits are both off but the mag/phi agree = match
72  errorFlag_hist_->Fill(0);
73  return errorFlag;
74  }
75 
76  if(!data_->at(i).overFlow() && !emu_->at(j).overFlow() && data_->at(i).et() == emu_->at(j).et() && data_->at(i).phi() != emu_->at(j).phi()) {
77  //if the overflow bits are both off but only the mag agree = mag match
78  errorFlag_hist_->Fill(1);
79  return errorFlag=1;
80  }
81 
82  if(!data_->at(i).overFlow() && !emu_->at(j).overFlow() && data_->at(i).et() != emu_->at(j).et() && data_->at(i).phi() == emu_->at(j).phi()) {
83  //if the overflow bits are both off but only the phi agree = phi match
84  errorFlag_hist_->Fill(2);
85  return errorFlag=1;
86  }
87 
88  //otherwise it's a total unmatch
89  errorFlag_hist_->Fill(3);
90  errorFlag=1;
91  return errorFlag;
92  }
93  }
94  return errorFlag;
95 }
96 
97 #endif
int i
Definition: DBlmapReader.cc:9
compareMissingEnergySums(const T &data, const T &emu, const GctErrorAnalyzerMBxInfo &mbxparams)
GctErrorAnalyzerMBxInfo mbxparams_
int j
Definition: DBlmapReader.cc:9
bool doCompare(TH1I *errorFlag_hist_)
long double T