File indexing completed on 2024-04-06 12:20:12
0001 #ifndef compareTotalEnergySums_h
0002 #define compareTotalEnergySums_h
0003
0004 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0005 #include "DataFormats/L1CaloTrigger/interface/L1CaloCollections.h"
0006 #include "DataFormats/L1GlobalCaloTrigger/interface/L1GctCollections.h"
0007
0008 #include "FWCore/Framework/interface/Frameworkfwd.h"
0009
0010 #include "FWCore/Framework/interface/Event.h"
0011 #include "FWCore/Framework/interface/MakerMacros.h"
0012
0013 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0014
0015 #include "FWCore/Utilities/interface/InputTag.h"
0016
0017 #include "L1Trigger/L1GctAnalyzer/interface/GctErrorAnalyzerDefinitions.h"
0018
0019 #include "TH2.h"
0020 #include "TH1.h"
0021
0022 template <class T>
0023 class compareTotalEnergySums {
0024 public:
0025 compareTotalEnergySums(const T &data, const T &emu, const GctErrorAnalyzerMBxInfo &mbxparams);
0026 ~compareTotalEnergySums();
0027
0028 bool doCompare(TH1I *errorFlag_hist_);
0029
0030 private:
0031 T data_, emu_;
0032 GctErrorAnalyzerMBxInfo mbxparams_;
0033 };
0034
0035 template <class T>
0036 compareTotalEnergySums<T>::compareTotalEnergySums(const T &data, const T &emu, const GctErrorAnalyzerMBxInfo &mbxparams)
0037 : data_(data), emu_(emu), mbxparams_(mbxparams) {
0038
0039 }
0040
0041 template <class T>
0042 compareTotalEnergySums<T>::~compareTotalEnergySums() {
0043
0044 }
0045
0046 template <class T>
0047 bool compareTotalEnergySums<T>::doCompare(TH1I *errorFlag_hist_) {
0048 bool errorFlag = false;
0049
0050 for (unsigned int i = 0; i < data_->size(); i++) {
0051
0052 if (data_->at(i).bx() != mbxparams_.GCTTrigBx)
0053 continue;
0054
0055 for (unsigned int j = 0; j < emu_->size(); j++) {
0056
0057 if (emu_->at(j).bx() != mbxparams_.EmuTrigBx)
0058 continue;
0059
0060
0061 if (data_->at(i).overFlow() && emu_->at(j).overFlow()) {
0062
0063 errorFlag_hist_->Fill(0);
0064 return errorFlag;
0065 }
0066
0067
0068
0069 if (!data_->at(i).overFlow() && !emu_->at(j).overFlow() && data_->at(i).et() == 0 && emu_->at(j).et() == 0)
0070 return errorFlag;
0071
0072
0073 if (!data_->at(i).overFlow() && !emu_->at(j).overFlow() && data_->at(i).et() == emu_->at(j).et()) {
0074
0075 errorFlag_hist_->Fill(0);
0076 return errorFlag;
0077 }
0078
0079
0080 errorFlag_hist_->Fill(1);
0081 errorFlag = true;
0082 return errorFlag;
0083 }
0084 }
0085 return errorFlag;
0086 }
0087
0088 #endif