CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/L1Trigger/L1GctAnalyzer/src/compareRingSums.cc

Go to the documentation of this file.
00001 #include "L1Trigger/L1GctAnalyzer/interface/compareRingSums.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 compareRingSums::compareRingSums(const edm::Handle<L1GctHFRingEtSumsCollection> &data, const edm::Handle<L1GctHFRingEtSumsCollection> &emu, const GctErrorAnalyzerMBxInfo &mbxparams) :
00019   data_(data),
00020   emu_(emu),
00021   mbxparams_(mbxparams)
00022 {
00023 
00024 }
00025 
00026 compareRingSums::~compareRingSums() {
00027 
00028 }
00029 
00030 bool compareRingSums::doCompare(TH1I *errorFlag_hist_) {
00031 
00032   bool errorFlag=0;
00033   
00034   for(unsigned int i=0; i < data_->size(); i++) {
00035     //check that the GCT trig bx is being considered
00036     if(data_->at(i).bx() != mbxparams_.GCTTrigBx) continue;
00037 
00038     for(unsigned int j=0; j < emu_->size(); j++) {
00039       //now check that the Emu trig bx is being considered
00040       if(emu_->at(j).bx() != mbxparams_.EmuTrigBx) continue;
00041       
00042       //now loop over each ring and make sure the energy sums match
00043       for(unsigned int k=0; k < NUM_GCT_RINGS; k++) {
00044         if(data_->at(i).etSum(k) == emu_->at(j).etSum(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 }