CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/L1Trigger/L1GctAnalyzer/src/compareBitCounts.cc

Go to the documentation of this file.
00001 #include "L1Trigger/L1GctAnalyzer/interface/compareBitCounts.h"
00002 #include "DataFormats/L1CaloTrigger/interface/L1CaloCollections.h"
00003 #include "DataFormats/L1GlobalCaloTrigger/interface/L1GctCollections.h"
00004 
00005 #include "FWCore/Framework/interface/Frameworkfwd.h"
00006 #include "FWCore/Framework/interface/EDAnalyzer.h"
00007 
00008 #include "FWCore/Framework/interface/Event.h"
00009 #include "FWCore/Framework/interface/MakerMacros.h"
00010 
00011 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00012 
00013 #include "FWCore/Utilities/interface/InputTag.h"
00014 
00015 #include "FWCore/ServiceRegistry/interface/Service.h" // Framework services
00016 #include "CommonTools/UtilAlgos/interface/TFileService.h" // Framework service for histograms
00017 
00018 compareBitCounts::compareBitCounts(const edm::Handle<L1GctHFBitCountsCollection> &data, const edm::Handle<L1GctHFBitCountsCollection> &emu, const GctErrorAnalyzerMBxInfo &mbxparams) :
00019   data_(data),
00020   emu_(emu),
00021   mbxparams_(mbxparams)
00022 {
00023 
00024 }
00025 
00026 compareBitCounts::~compareBitCounts() {
00027   //anything need to be destructed?
00028 }
00029 
00030 bool compareBitCounts::doCompare(TH1I *errorFlag_hist_) {
00031 
00032   bool errorFlag=0;
00033   
00034   for(unsigned int i=0;i < data_->size(); i++) {
00035     //check that we are looking at the triggered Bx in the data
00036     if(data_->at(i).bx() != mbxparams_.GCTTrigBx) continue;
00037 
00038     for(unsigned int j=0; j < emu_->size(); j++) {
00039       //now check that we are looking at the corresponding triggered Bx in the emulator
00040       if(emu_->at(j).bx() != mbxparams_.EmuTrigBx) continue;
00041       
00042       for(unsigned int k=0; k < NUM_GCT_RINGS; k++) {
00043         //now that we are on the right Bxs for data and emulator, check all the ring bitcounts match
00044         if(data_->at(i).bitCount(k) == emu_->at(j).bitCount(k)) {
00045           errorFlag_hist_->Fill(0); //i.e. the two match
00046         } else {
00047           errorFlag_hist_->Fill(1);
00048           errorFlag=1;
00049         }
00050       }
00051     }
00052   }
00053   
00054   return errorFlag;
00055   
00056 }