CMS 3D CMS Logo

compareMissingEnergySums.h
Go to the documentation of this file.
1 #ifndef compareMissingEnergySums_h
2 #define compareMissingEnergySums_h
3 
7 
9 
12 
14 
16 
18 
19 #include "TH2.h"
20 #include "TH1.h"
21 
22 template <class T>
24 public:
25  compareMissingEnergySums(const T &data, const T &emu, const GctErrorAnalyzerMBxInfo &mbxparams);
27 
28  bool doCompare(TH1I *errorFlag_hist_);
29 
30 private:
33 };
34 
35 template <class T>
37  const T &emu,
38  const GctErrorAnalyzerMBxInfo &mbxparams)
39  : data_(data), emu_(emu), mbxparams_(mbxparams) {}
40 
41 template <class T>
43 
44 template <class T>
45 bool compareMissingEnergySums<T>::doCompare(TH1I *errorFlag_hist_) {
46  bool errorFlag = false;
47 
48  for (unsigned int i = 0; i < data_->size(); i++) {
49  if (data_->at(i).bx() != mbxparams_.GCTTrigBx)
50  continue;
51 
52  for (unsigned int j = 0; j < emu_->size(); j++) {
53  if (emu_->at(j).bx() != mbxparams_.EmuTrigBx)
54  continue;
55 
56  if (data_->at(i).overFlow() && emu_->at(j).overFlow()) {
57  //if both overflow bits are set then = match
58  errorFlag_hist_->Fill(0);
59  return errorFlag;
60  }
61 
62  //check that we consider non-zero candidates - if we don't, return (don't fill hist)
63  if (!data_->at(i).overFlow() && !emu_->at(j).overFlow() && data_->at(i).et() == 0 && emu_->at(j).et() == 0)
64  return errorFlag;
65 
66  if (!data_->at(i).overFlow() && !emu_->at(j).overFlow() && data_->at(i).et() == emu_->at(j).et() &&
67  data_->at(i).phi() == emu_->at(j).phi()) {
68  //similarly, if the overflow bits are both off but the mag/phi agree = match
69  errorFlag_hist_->Fill(0);
70  return errorFlag;
71  }
72 
73  if (!data_->at(i).overFlow() && !emu_->at(j).overFlow() && data_->at(i).et() == emu_->at(j).et() &&
74  data_->at(i).phi() != emu_->at(j).phi()) {
75  //if the overflow bits are both off but only the mag agree = mag match
76  errorFlag_hist_->Fill(1);
77  return errorFlag = true;
78  }
79 
80  if (!data_->at(i).overFlow() && !emu_->at(j).overFlow() && data_->at(i).et() != emu_->at(j).et() &&
81  data_->at(i).phi() == emu_->at(j).phi()) {
82  //if the overflow bits are both off but only the phi agree = phi match
83  errorFlag_hist_->Fill(2);
84  return errorFlag = true;
85  }
86 
87  //otherwise it's a total unmatch
88  errorFlag_hist_->Fill(3);
89  errorFlag = true;
90  return errorFlag;
91  }
92  }
93  return errorFlag;
94 }
95 
96 #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