Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:20:13

0001 #include "L1Trigger/L1GctAnalyzer/interface/compareBitCounts.h"
0002 #include "DataFormats/L1CaloTrigger/interface/L1CaloCollections.h"
0003 #include "DataFormats/L1GlobalCaloTrigger/interface/L1GctCollections.h"
0004 
0005 compareBitCounts::compareBitCounts(const edm::Handle<L1GctHFBitCountsCollection> &data,
0006                                    const edm::Handle<L1GctHFBitCountsCollection> &emu,
0007                                    const GctErrorAnalyzerMBxInfo &mbxparams)
0008     : data_(data), emu_(emu), mbxparams_(mbxparams) {}
0009 
0010 compareBitCounts::~compareBitCounts() {
0011   //anything need to be destructed?
0012 }
0013 
0014 bool compareBitCounts::doCompare(TH1I *errorFlag_hist_) {
0015   bool errorFlag = false;
0016 
0017   for (unsigned int i = 0; i < data_->size(); i++) {
0018     //check that we are looking at the triggered Bx in the data
0019     if (data_->at(i).bx() != mbxparams_.GCTTrigBx)
0020       continue;
0021 
0022     for (unsigned int j = 0; j < emu_->size(); j++) {
0023       //now check that we are looking at the corresponding triggered Bx in the emulator
0024       if (emu_->at(j).bx() != mbxparams_.EmuTrigBx)
0025         continue;
0026 
0027       for (unsigned int k = 0; k < NUM_GCT_RINGS; k++) {
0028         //now that we are on the right Bxs for data and emulator, check all the ring bitcounts match
0029         if (data_->at(i).bitCount(k) == emu_->at(j).bitCount(k)) {
0030           errorFlag_hist_->Fill(0);  //i.e. the two match
0031         } else {
0032           errorFlag_hist_->Fill(1);
0033           errorFlag = true;
0034         }
0035       }
0036     }
0037   }
0038 
0039   return errorFlag;
0040 }