CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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  const T &emu,
39  const GctErrorAnalyzerMBxInfo &mbxparams)
40  : data_(data), emu_(emu), mbxparams_(mbxparams) {}
41 
42 template <class T>
44 
45 template <class T>
46 bool compareMissingEnergySums<T>::doCompare(TH1I *errorFlag_hist_) {
47  bool errorFlag = false;
48 
49  for (unsigned int i = 0; i < data_->size(); i++) {
50  if (data_->at(i).bx() != mbxparams_.GCTTrigBx)
51  continue;
52 
53  for (unsigned int j = 0; j < emu_->size(); j++) {
54  if (emu_->at(j).bx() != mbxparams_.EmuTrigBx)
55  continue;
56 
57  if (data_->at(i).overFlow() && emu_->at(j).overFlow()) {
58  //if both overflow bits are set then = match
59  errorFlag_hist_->Fill(0);
60  return errorFlag;
61  }
62 
63  //check that we consider non-zero candidates - if we don't, return (don't fill hist)
64  if (!data_->at(i).overFlow() && !emu_->at(j).overFlow() && data_->at(i).et() == 0 && emu_->at(j).et() == 0)
65  return errorFlag;
66 
67  if (!data_->at(i).overFlow() && !emu_->at(j).overFlow() && data_->at(i).et() == emu_->at(j).et() &&
68  data_->at(i).phi() == emu_->at(j).phi()) {
69  //similarly, if the overflow bits are both off but the mag/phi agree = match
70  errorFlag_hist_->Fill(0);
71  return errorFlag;
72  }
73 
74  if (!data_->at(i).overFlow() && !emu_->at(j).overFlow() && data_->at(i).et() == emu_->at(j).et() &&
75  data_->at(i).phi() != emu_->at(j).phi()) {
76  //if the overflow bits are both off but only the mag agree = mag match
77  errorFlag_hist_->Fill(1);
78  return errorFlag = true;
79  }
80 
81  if (!data_->at(i).overFlow() && !emu_->at(j).overFlow() && data_->at(i).et() != emu_->at(j).et() &&
82  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 = true;
86  }
87 
88  //otherwise it's a total unmatch
89  errorFlag_hist_->Fill(3);
90  errorFlag = true;
91  return errorFlag;
92  }
93  }
94  return errorFlag;
95 }
96 
97 #endif
compareMissingEnergySums(const T &data, const T &emu, const GctErrorAnalyzerMBxInfo &mbxparams)
GctErrorAnalyzerMBxInfo mbxparams_
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
bool doCompare(TH1I *errorFlag_hist_)
long double T