CMS 3D CMS Logo

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