CMS 3D CMS Logo

compareTotalEnergySums.h
Go to the documentation of this file.
1 #ifndef compareTotalEnergySums_h
2 #define compareTotalEnergySums_h
3 
7 
9 
12 
14 
16 
18 
19 #include "TH2.h"
20 #include "TH1.h"
21 
22 template <class T>
24 public:
25  compareTotalEnergySums(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  : data_(data), emu_(emu), mbxparams_(mbxparams) {
38  //std::cout << "initialising..." << std::endl;
39 }
40 
41 template <class T>
43  //anything need to be destructed?
44 }
45 
46 template <class T>
47 bool compareTotalEnergySums<T>::doCompare(TH1I *errorFlag_hist_) {
48  bool errorFlag = false;
49 
50  for (unsigned int i = 0; i < data_->size(); i++) {
51  //check the GCTTrigBx is the one being considered
52  if (data_->at(i).bx() != mbxparams_.GCTTrigBx)
53  continue;
54 
55  for (unsigned int j = 0; j < emu_->size(); j++) {
56  //check the EmuTrigBx is the one being considered
57  if (emu_->at(j).bx() != mbxparams_.EmuTrigBx)
58  continue;
59 
60  //now check if both overflow bits (from the trigbx) are set
61  if (data_->at(i).overFlow() && emu_->at(j).overFlow()) {
62  //if the overflow bits in data and emulator are set, that's enough to call a match
63  errorFlag_hist_->Fill(0);
64  return errorFlag;
65  }
66 
67  //check if both over flow bits are not set and if both values are zero, and if so return the errorFlag
68  //without making any modifications (a zero et match doesn't mean so much).
69  if (!data_->at(i).overFlow() && !emu_->at(j).overFlow() && data_->at(i).et() == 0 && emu_->at(j).et() == 0)
70  return errorFlag;
71 
72  //now check if the values correspond, again with both overflow bits not set
73  if (!data_->at(i).overFlow() && !emu_->at(j).overFlow() && data_->at(i).et() == emu_->at(j).et()) {
74  //if they are both explicitly not set, and the resulting energies are identical, that's a match
75  errorFlag_hist_->Fill(0);
76  return errorFlag;
77  }
78 
79  //otherwise, it's a fail
80  errorFlag_hist_->Fill(1);
81  errorFlag = true;
82  return errorFlag;
83  }
84  }
85  return errorFlag;
86 }
87 
88 #endif
bool doCompare(TH1I *errorFlag_hist_)
GctErrorAnalyzerMBxInfo mbxparams_
compareTotalEnergySums(const T &data, const T &emu, const GctErrorAnalyzerMBxInfo &mbxparams)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
long double T