Go to the documentation of this file.00001 #ifndef compareCands_h
00002 #define compareCands_h
00003
00004 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00005 #include "FWCore/Framework/interface/Frameworkfwd.h"
00006 #include "FWCore/Framework/interface/EDAnalyzer.h"
00007 #include "FWCore/Framework/interface/Event.h"
00008 #include "FWCore/Framework/interface/MakerMacros.h"
00009 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00010 #include "FWCore/Utilities/interface/InputTag.h"
00011 #include "DataFormats/L1CaloTrigger/interface/L1CaloCollections.h"
00012 #include "DataFormats/L1GlobalCaloTrigger/interface/L1GctCollections.h"
00013 #include "TH2.h"
00014 #include "TH1.h"
00015 #include "L1Trigger/L1GctAnalyzer/interface/GctErrorAnalyzerDefinitions.h"
00016
00017
00018
00019
00020 template <class T>
00021 class compareCands {
00022 public:
00023 compareCands(const T &data, const T &emu, const GctErrorAnalyzerMBxInfo &mbxparams);
00024 ~compareCands();
00025
00026 bool doCompare(TH1I *errorFlag_hist_, TH1I *mismatchD_Rank, TH2I *mismatchD_EtEtaPhi, TH1I *mismatchE_Rank, TH2I *mismatchE_EtEtaPhi);
00027
00028 private:
00029 T data_, emu_;
00030 GctErrorAnalyzerMBxInfo mbxparams_;
00031
00032 };
00033
00034
00035 template<class T>
00036 compareCands<T>::compareCands(const T &data, const T &emu, const GctErrorAnalyzerMBxInfo &mbxparams) :
00037 data_(data),
00038 emu_(emu),
00039 mbxparams_(mbxparams)
00040 {
00041
00042 }
00043
00044 template<class T>
00045 compareCands<T>::~compareCands() {
00046
00047 }
00048
00049 template<class T>
00050 bool compareCands<T>::doCompare(TH1I *errorFlag_hist_, TH1I *mismatchD_Rank, TH2I *mismatchD_EtEtaPhi, TH1I *mismatchE_Rank, TH2I *mismatchE_EtEtaPhi) {
00051
00052
00053
00054
00055
00056
00057 bool errorFlag=0;
00058 unsigned int i=0, j=0;
00059 std::vector<bool> matched(GCT_OBJECT_QUANTA);
00060
00061
00062
00063 for(i=0; i < data_->size(); i++) {
00064
00065
00066 if(data_->at(i).bx() != mbxparams_.GCTTrigBx) continue;
00067
00068
00069
00070 if(data_->at(i).rank() == 0 ) continue;
00071
00072 for(j=0; j < emu_->size(); j++) {
00073
00074
00075 if(emu_->at(j).bx() != mbxparams_.EmuTrigBx) continue;
00076
00077 if( data_->at(i).rank() == emu_->at(j).rank()
00078 && data_->at(i).regionId().ieta() == emu_->at(j).regionId().ieta()
00079 && data_->at(i).regionId().iphi() == emu_->at(j).regionId().iphi()
00080 && matched.at((j % GCT_OBJECT_QUANTA)) == 0 ) {
00081
00082 errorFlag_hist_->Fill(0);
00083 matched.at((j % GCT_OBJECT_QUANTA)) = 1;
00084 break;
00085 }
00086
00087 if( (j % GCT_OBJECT_QUANTA) + 1 == GCT_OBJECT_QUANTA) {
00088 errorFlag_hist_->Fill(1);
00089 mismatchD_Rank->Fill(data_->at(i).rank());
00090 mismatchD_EtEtaPhi->Fill(data_->at(i).regionId().ieta(),data_->at(i).regionId().iphi(),data_->at(i).rank());
00091 errorFlag=1;
00092 }
00093
00094 }
00095 }
00096
00097
00098 for(i=0; i<matched.size(); i++) {
00099
00100
00101 if(matched.at(i)) continue;
00102
00103
00104 for(j=0; j< emu_->size(); j++) {
00105
00106 if(emu_->at(j).bx() != mbxparams_.EmuTrigBx) continue;
00107
00108
00109 if((j%GCT_OBJECT_QUANTA == i) && (emu_->at(j).rank()>0) ) {
00110 errorFlag_hist_->Fill(2);
00111 mismatchE_Rank->Fill(emu_->at(j).rank());
00112 mismatchE_EtEtaPhi->Fill(emu_->at(j).regionId().ieta(),emu_->at(j).regionId().iphi(),emu_->at(j).rank());
00113 errorFlag=1;
00114 }
00115 }
00116 }
00117
00118 return errorFlag;
00119 }
00120
00121
00122 #endif