CMS 3D CMS Logo

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
compareTotalEnergySums::compareTotalEnergySums
compareTotalEnergySums(const T &data, const T &emu, const GctErrorAnalyzerMBxInfo &mbxparams)
Definition: compareTotalEnergySums.h:37
mps_fire.i
i
Definition: mps_fire.py:428
L1GctCollections.h
EDAnalyzer.h
compareTotalEnergySums::data_
T data_
Definition: compareTotalEnergySums.h:32
compareTotalEnergySums::emu_
T emu_
Definition: compareTotalEnergySums.h:32
MakerMacros.h
compareTotalEnergySums::~compareTotalEnergySums
~compareTotalEnergySums()
Definition: compareTotalEnergySums.h:43
compareTotalEnergySums::doCompare
bool doCompare(TH1I *errorFlag_hist_)
Definition: compareTotalEnergySums.h:48
Event.h
L1CaloCollections.h
compareTotalEnergySums::mbxparams_
GctErrorAnalyzerMBxInfo mbxparams_
Definition: compareTotalEnergySums.h:33
InputTag.h
compareTotalEnergySums
Definition: compareTotalEnergySums.h:24
Frameworkfwd.h
T
long double T
Definition: Basic3DVectorLD.h:48
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
ParameterSet.h
GctErrorAnalyzerMBxInfo
Definition: GctErrorAnalyzerDefinitions.h:13
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
GctErrorAnalyzerDefinitions.h