CMS 3D CMS Logo

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