CMS 3D CMS Logo

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

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:     GctErrorAnalyzer
00004 // Class:       GctErrorAnalyzer 
00005 //
00013 //
00014 // Original Author:  Jad Marrouche
00015 //         Created:  Wed May 20 14:19:23 CEST 2009
00016 // $Id: GctErrorAnalyzer.cc,v 1.2 2010/04/30 21:21:34 jad Exp $
00017 //
00018 //
00019 
00020 // system include files
00021 #include <memory>
00022 
00023 // user include files
00024 #include "FWCore/Framework/interface/Frameworkfwd.h"
00025 #include "FWCore/Framework/interface/EDAnalyzer.h"
00026 #include "FWCore/Framework/interface/Event.h"
00027 #include "FWCore/Framework/interface/MakerMacros.h"
00028 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00029 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00030 #include "FWCore/Utilities/interface/InputTag.h"
00031 #include "FWCore/ServiceRegistry/interface/Service.h"
00032 //TFile maker include
00033 #include "CommonTools/UtilAlgos/interface/TFileService.h"
00034 //ROOT includes
00035 #include "TH1.h"
00036 #include "TH2.h"
00037 #include "TAxis.h"
00038 //RCT and GCT DataFormat Collections
00039 #include "DataFormats/L1GlobalCaloTrigger/interface/L1GctCollections.h"
00040 #include "DataFormats/L1CaloTrigger/interface/L1CaloCollections.h"
00041 //GctErrorAnalyzer includes
00042 #include "L1Trigger/L1GctAnalyzer/interface/GctErrorAnalyzerDefinitions.h"
00043 #include "L1Trigger/L1GctAnalyzer/interface/compareCands.h"
00044 #include "L1Trigger/L1GctAnalyzer/interface/compareRingSums.h"
00045 #include "L1Trigger/L1GctAnalyzer/interface/compareBitCounts.h"
00046 #include "L1Trigger/L1GctAnalyzer/interface/compareTotalEnergySums.h"
00047 #include "L1Trigger/L1GctAnalyzer/interface/compareMissingEnergySums.h"
00048 //STL includes
00049 #include <string>
00050 #include <vector>
00051 #include <sstream>
00052 #include <algorithm>
00053 
00054 //
00055 // class declaration
00056 //
00057 
00058 class GctErrorAnalyzer : public edm::EDAnalyzer {
00059 
00060 private:
00061   GctErrorAnalyzer();
00062   GctErrorAnalyzer(const GctErrorAnalyzer &);
00063   GctErrorAnalyzer operator=(const GctErrorAnalyzer &);
00064   void plotRCTRegions(const edm::Handle<L1CaloRegionCollection> &caloRegions);
00065   void plotIsoEm(const edm::Handle<L1GctEmCandCollection> &data, const edm::Handle<L1GctEmCandCollection> &emu);
00066   void plotNonIsoEm(const edm::Handle<L1GctEmCandCollection> &data, const edm::Handle<L1GctEmCandCollection> &emu);
00067   void plotEGErrors(const edm::Handle<L1GctEmCandCollection> &dataiso, const edm::Handle<L1GctEmCandCollection> &emuiso, const edm::Handle<L1GctEmCandCollection> &datanoniso, const edm::Handle<L1GctEmCandCollection> &emunoniso, const edm::Handle<L1CaloEmCollection> &regions);
00068   void plotCenJets(const edm::Handle<L1GctJetCandCollection> &data, const edm::Handle<L1GctJetCandCollection> &emu);
00069   void plotTauJets(const edm::Handle<L1GctJetCandCollection> &data, const edm::Handle<L1GctJetCandCollection> &emu);
00070   void plotForJets(const edm::Handle<L1GctJetCandCollection> &data, const edm::Handle<L1GctJetCandCollection> &emu);
00071   void plotIntJets(const edm::Handle<L1GctInternJetDataCollection> &emu);
00072   static bool sortJets (const jetData &jet1, const jetData &jet2); //define this as static as it doesn't need a GctErrorAnalyzer object
00073   void plotJetErrors(const edm::Handle<L1GctJetCandCollection> &cendata, const edm::Handle<L1GctJetCandCollection> &cenemu, const edm::Handle<L1GctJetCandCollection> &taudata, const edm::Handle<L1GctJetCandCollection> &tauemu, const edm::Handle<L1GctJetCandCollection> &fordata, const edm::Handle<L1GctJetCandCollection> &foremu, const edm::Handle<L1CaloRegionCollection> &regions);
00074   void plotHFRingSums(const edm::Handle<L1GctHFRingEtSumsCollection> &data, const edm::Handle<L1GctHFRingEtSumsCollection> &emu);
00075   void plotHFBitCounts(const edm::Handle<L1GctHFBitCountsCollection> &hfBitCountsD, const edm::Handle<L1GctHFBitCountsCollection> &hfBitCountsE);
00076   void plotHFErrors(const edm::Handle<L1GctHFRingEtSumsCollection> &hfRingSumsD, const edm::Handle<L1GctHFRingEtSumsCollection> &hfRingSumsE, const edm::Handle<L1GctHFBitCountsCollection> &hfBitCountsD, const edm::Handle<L1GctHFBitCountsCollection> &hfBitCountsE, const edm::Handle<L1CaloRegionCollection> &caloRegions);
00077   void plotTotalE(const edm::Handle<L1GctEtTotalCollection> &totalEtD, const edm::Handle<L1GctEtTotalCollection> &totalEtE);
00078   void plotTotalH(const edm::Handle<L1GctEtHadCollection> &totalHtD, const edm::Handle<L1GctEtHadCollection> &totalHtE);
00079   void plotTotalEErrors(const edm::Handle<L1GctEtTotalCollection> &totalEtD, const edm::Handle<L1GctEtTotalCollection> &totalEtE, const edm::Handle<L1GctEtHadCollection> &totalHtD, const edm::Handle<L1GctEtHadCollection> &totalHtE, const edm::Handle<L1CaloRegionCollection> &caloRegions);
00080   void plotMissingEt(const edm::Handle<L1GctEtMissCollection> &missingEtD, const edm::Handle<L1GctEtMissCollection> &missingEtE);
00081   void plotMissingHt(const edm::Handle<L1GctHtMissCollection> &missingHtD, const edm::Handle<L1GctHtMissCollection> &missingHtE);
00082   void plotMissingEErrors(const edm::Handle<L1GctEtMissCollection> &missingEtD, const edm::Handle<L1GctEtMissCollection> &missingEtE, const edm::Handle<L1GctHtMissCollection> &missingHtD, const edm::Handle<L1GctHtMissCollection> &missingHtE, edm::Handle<L1CaloRegionCollection> &caloRegions, const edm::Handle<L1GctInternJetDataCollection> &intjetsemu, const edm::Handle<L1GctInternHtMissCollection> intMissingHtD);
00083   template<class T> bool checkCollections(const T &collection, const unsigned int &constraint, const std::string &label);
00084 
00085 public:
00086   explicit GctErrorAnalyzer(const edm::ParameterSet&);
00087   ~GctErrorAnalyzer();
00088 
00089 private:
00090   virtual void beginJob() ;
00091   virtual void analyze(const edm::Event&, const edm::EventSetup&);
00092   virtual void endJob() ;
00093 
00094   // ----------member data ---------------------------
00095   //the following flags select what we'd like to plot and whether or not we want error information
00096   bool doRCT_;
00097   bool doEg_;
00098   bool doIsoDebug_;
00099   bool doNonIsoDebug_;
00100   bool doJets_;
00101   bool doCenJetsDebug_;
00102   bool doTauJetsDebug_;
00103   bool doForJetsDebug_;
00104   bool doHF_;
00105   bool doRingSumDebug_;
00106   bool doBitCountDebug_;
00107   bool doTotalEnergySums_;
00108   bool doTotalEtDebug_;
00109   bool doTotalHtDebug_;
00110   bool doMissingEnergySums_;
00111   bool doMissingETDebug_;
00112   bool doMissingHTDebug_;
00113   bool doExtraMissingHTDebug_;
00114   //the following flags configure whether or not we want multiple BX behaviour for 
00115   //1. RCT regions
00116   //2. Emulator output
00117   //3. Hardware output
00118   bool doRCTMBx_;
00119   bool doEmuMBx_;
00120   bool doGCTMBx_;
00121   //the following values select the definition of the "triggered" Bx i.e. where to define Bx=0
00122   int RCTTrigBx_;
00123   int EmuTrigBx_;
00124   int GCTTrigBx_;
00125   //the following flags contain the location of the hardware and emulator digis
00126   edm::InputTag dataTag_;
00127   edm::InputTag emuTag_;
00128   //the following is a string which dictates whether or not we want to use the lab or full system parameters
00129   std::string useSys_;
00130 
00131   //the following declares a struct to hold the MBX Info to make it easy to pass the information around
00132   GctErrorAnalyzerMBxInfo MBxInfo;
00133 
00134   // histograms
00135   //RCT Regions
00136   TH2I *RCT_EtEtaPhi_, *RCT_TvEtaPhi_, *RCT_FgEtaPhi_, *RCT_OfEtaPhi_;
00137   //isoEg
00138   TH1I *isoEgD_Rank_, *isoEgE_Rank_;
00139   TH2I *isoEgD_EtEtaPhi_, *isoEgE_EtEtaPhi_;
00140   TH2I *isoEgD_OccEtaPhi_, *isoEgE_OccEtaPhi_;
00141   TH1I *isoEg_errorFlag_;
00142   //Global Error Histograms
00143   TH1I *isoEgD_GlobalError_Rank_;
00144   TH1I *isoEgE_GlobalError_Rank_;
00145   TH2I *isoEgD_GlobalError_EtEtaPhi_;
00146   TH2I *isoEgE_GlobalError_EtEtaPhi_;
00147   //nonIsoEg
00148   TH1I *nonIsoEgD_Rank_, *nonIsoEgE_Rank_;
00149   TH2I *nonIsoEgD_EtEtaPhi_, *nonIsoEgE_EtEtaPhi_;
00150   TH2I *nonIsoEgD_OccEtaPhi_, *nonIsoEgE_OccEtaPhi_;
00151   TH1I *nonIsoEg_errorFlag_;
00152   //Global Error Histograms
00153   TH1I *nonIsoEgD_GlobalError_Rank_;
00154   TH1I *nonIsoEgE_GlobalError_Rank_;
00155   TH2I *nonIsoEgD_GlobalError_EtEtaPhi_;
00156   TH2I *nonIsoEgE_GlobalError_EtEtaPhi_;
00157   //cenJet
00158   TH1I *cenJetD_Rank_, *cenJetE_Rank_;
00159   TH2I *cenJetD_EtEtaPhi_, *cenJetE_EtEtaPhi_;
00160   TH2I *cenJetD_OccEtaPhi_, *cenJetE_OccEtaPhi_;
00161   TH1I *cenJet_errorFlag_;
00162   //Global Error Histograms
00163   TH1I *cenJetD_GlobalError_Rank_;
00164   TH1I *cenJetE_GlobalError_Rank_;
00165   TH2I *cenJetD_GlobalError_EtEtaPhi_;
00166   TH2I *cenJetE_GlobalError_EtEtaPhi_;
00167   //tauJet
00168   TH1I *tauJetD_Rank_, *tauJetE_Rank_;
00169   TH2I *tauJetD_EtEtaPhi_, *tauJetE_EtEtaPhi_;
00170   TH2I *tauJetD_OccEtaPhi_, *tauJetE_OccEtaPhi_;
00171   TH1I *tauJet_errorFlag_;
00172   //Global Error Histograms
00173   TH1I *tauJetD_GlobalError_Rank_;
00174   TH1I *tauJetE_GlobalError_Rank_;
00175   TH2I *tauJetD_GlobalError_EtEtaPhi_;
00176   TH2I *tauJetE_GlobalError_EtEtaPhi_;
00177   //forJet
00178   TH1I *forJetD_Rank_, *forJetE_Rank_;
00179   TH2I *forJetD_EtEtaPhi_, *forJetE_EtEtaPhi_;
00180   TH2I *forJetD_OccEtaPhi_, *forJetE_OccEtaPhi_;
00181   TH1I *forJet_errorFlag_;
00182   //Global Error Histograms
00183   TH1I *forJetD_GlobalError_Rank_;
00184   TH1I *forJetE_GlobalError_Rank_;
00185   TH2I *forJetD_GlobalError_EtEtaPhi_;
00186   TH2I *forJetE_GlobalError_EtEtaPhi_;
00187   //intJet
00188   TH2I *intJetEtEtaPhiE_;
00189   TH1I *intJetE_Et_;
00190   TH1I *intJetE_Of_;
00191   TH1I *intJetE_Jet1Et_;
00192   TH1I *intJetE_Jet2Et_;
00193   TH1I *intJetE_Jet3Et_;
00194   TH1I *intJetE_Jet4Et_;
00195   //ringSums 
00196   TH1I *hfRingSumD_1pos_, *hfRingSumD_1neg_, *hfRingSumD_2pos_, *hfRingSumD_2neg_;
00197   TH1I *hfRingSumE_1pos_, *hfRingSumE_1neg_, *hfRingSumE_2pos_, *hfRingSumE_2neg_;
00198   TH1I *hfRingSum_errorFlag_;
00199   //bitcounts
00200   TH1I *hfBitCountD_1pos_, *hfBitCountD_1neg_, *hfBitCountD_2pos_, *hfBitCountD_2neg_;
00201   TH1I *hfBitCountE_1pos_, *hfBitCountE_1neg_, *hfBitCountE_2pos_, *hfBitCountE_2neg_;
00202   TH1I *hfBitCount_errorFlag_;
00203   //totalEt
00204   TH1I *totalEtD_, *totalEtE_;
00205   TH1I *totalEtD_Of_, *totalEtE_Of_;
00206   TH1I *totalEt_errorFlag_;
00207   //ET GlobalError Histograms
00208   //TH1I *totalEtD_GlobalError_, *totalEtE_GlobalError_;
00209   //TH1I *totalEtD_GlobalError_Of_, *totalEtE_GlobalError_Of_;
00210   //totalHt
00211   TH1I *totalHtD_, *totalHtE_;
00212   TH1I *totalHtD_Of_, *totalHtE_Of_;
00213   TH1I *totalHt_errorFlag_;
00214   //HT GlobalError Histograms
00215   //TH1I *totalHtD_GlobalError_, *totalHtE_GlobalError_;
00216   //TH1I *totalHtD_GlobalError_Of_, *totalHtE_GlobalError_Of_;
00217   //missingET
00218   TH1I *missingEtD_, *missingEtE_;
00219   TH1I *missingEtD_Of_, *missingEtE_Of_;
00220   TH1I *missingEtD_Phi_, *missingEtE_Phi_;
00221   TH1I *missingEt_errorFlag_;
00222   //missingHT
00223   TH1I *missingHtD_, *missingHtE_;
00224   TH1I *missingHtD_Of_, *missingHtE_Of_;
00225   TH1I *missingHtD_Phi_, *missingHtE_Phi_;
00226   TH1I *missingHt_errorFlag_;
00227   TH1I *missingHtD_HtXPosLeaf1, *missingHtD_HtXPosLeaf2, *missingHtD_HtXPosLeaf3, *missingHtD_HtXNegLeaf1, *missingHtD_HtXNegLeaf2, *missingHtD_HtXNegLeaf3;
00228   TH1I *missingHtD_HtYPosLeaf1, *missingHtD_HtYPosLeaf2, *missingHtD_HtYPosLeaf3, *missingHtD_HtYNegLeaf1, *missingHtD_HtYNegLeaf2, *missingHtD_HtYNegLeaf3;
00229 
00230   //error flags to decide whether or not to print debug info
00231   bool isIsoError;
00232   bool isNonIsoError;
00233   bool isCenJetError;
00234   bool isTauJetError;
00235   bool isForJetError;
00236   bool isRingSumError;
00237   bool isBitCountError;
00238   bool isTotalEError;
00239   bool isTotalHError;
00240   bool isMissingEError;
00241   bool isMissingHError;
00242 
00243   //Directories - put this here because we want to
00244   //add directories dynamically to this folder
00245   //depending on the errors we find
00246   std::vector<TFileDirectory> errorHistCat;
00247 
00248   //the event number
00249   unsigned int eventNumber;
00250 
00251   const unsigned int * RCT_REGION_QUANTA;
00252 
00253 };
00254 
00255 //
00256 // constants, enums and typedefs
00257 // use in conjunction with the templated bits
00258 typedef compareCands< edm::Handle<L1GctEmCandCollection> > compareEG;
00259 typedef compareCands< edm::Handle<L1GctJetCandCollection> > compareJets;
00260 typedef compareTotalEnergySums< edm::Handle<L1GctEtTotalCollection> > compareTotalE;
00261 typedef compareTotalEnergySums< edm::Handle<L1GctEtHadCollection> > compareTotalH;
00262 typedef compareMissingEnergySums< edm::Handle<L1GctEtMissCollection> > compareMissingE;
00263 typedef compareMissingEnergySums< edm::Handle<L1GctHtMissCollection> > compareMissingH;
00264 //
00265 // static data member definitions
00266 //
00267 
00268 //
00269 // constructors and destructor
00270 //
00271 GctErrorAnalyzer::GctErrorAnalyzer(const edm::ParameterSet& iConfig) :
00272   doRCT_( iConfig.getUntrackedParameter<bool>("doRCT", true) ),
00273   doEg_( iConfig.getUntrackedParameter<bool>("doEg", true) ),
00274   doIsoDebug_( iConfig.getUntrackedParameter<bool>("doIsoDebug", true) ),
00275   doNonIsoDebug_( iConfig.getUntrackedParameter<bool>("doNonIsoDebug", true) ),
00276   doJets_( iConfig.getUntrackedParameter<bool>("doJets", true) ),
00277   doCenJetsDebug_( iConfig.getUntrackedParameter<bool>("doCenJetsDebug", true) ),
00278   doTauJetsDebug_( iConfig.getUntrackedParameter<bool>("doTauJetsDebug", true) ),
00279   doForJetsDebug_( iConfig.getUntrackedParameter<bool>("doForJetsDebug", true) ),
00280   doHF_( iConfig.getUntrackedParameter<bool>("doHF", true) ),
00281   doRingSumDebug_( iConfig.getUntrackedParameter<bool>("doRingSumDebug", true) ),
00282   doBitCountDebug_( iConfig.getUntrackedParameter<bool>("doBitCountDebug", true) ),
00283   doTotalEnergySums_( iConfig.getUntrackedParameter<bool>("doTotalEnergySums", true) ),
00284   doTotalEtDebug_( iConfig.getUntrackedParameter<bool>("doTotalEtDebug", true) ),
00285   doTotalHtDebug_( iConfig.getUntrackedParameter<bool>("doTotalHtDebug", true) ),
00286   doMissingEnergySums_( iConfig.getUntrackedParameter<bool>("doMissingEnergySums", true) ),
00287   doMissingETDebug_( iConfig.getUntrackedParameter<bool>("doMissingETDebug", true) ),
00288   doMissingHTDebug_( iConfig.getUntrackedParameter<bool>("doMissingHTDebug", true) ),
00289   doExtraMissingHTDebug_( iConfig.getUntrackedParameter<bool>("doExtraMissingHTDebug", false) ),
00290   doRCTMBx_( iConfig.getUntrackedParameter<bool>("doRCTMBx", false)),
00291   doEmuMBx_( iConfig.getUntrackedParameter<bool>("doEmuMBx", false)),
00292   doGCTMBx_( iConfig.getUntrackedParameter<bool>("doGCTMBx", false)),
00293   RCTTrigBx_( iConfig.getUntrackedParameter<int>("RCTTrigBx", 0)),
00294   EmuTrigBx_( iConfig.getUntrackedParameter<int>("EmuTrigBx", 0)),
00295   GCTTrigBx_( iConfig.getUntrackedParameter<int>("GCTTrigBx", 0)),
00296   dataTag_( iConfig.getUntrackedParameter<edm::InputTag>("dataTag", edm::InputTag("gctDigis")) ),
00297   emuTag_( iConfig.getUntrackedParameter<edm::InputTag>("emuTag", edm::InputTag("gctEmuDigis")) ),
00298   useSys_( iConfig.getUntrackedParameter<std::string>("useSys","P5"))
00299 {
00300   //now do what ever initialization is needed
00301   //make the root file
00302   edm::Service<TFileService> fs;
00303 
00304   //to try to make this look more elegant
00305   //make a string for each folder we'd like for the Data and Emulator Histograms
00306   std::vector<std::string> quantities;
00307   quantities.push_back("IsoEm");
00308   quantities.push_back("NonIsoEM");
00309   quantities.push_back("CenJets");
00310   quantities.push_back("TauJets");
00311   quantities.push_back("ForJets");
00312   quantities.push_back("HFRingSums");
00313   quantities.push_back("HFBitCounts");
00314   quantities.push_back("TotalESums");
00315   quantities.push_back("MissingESums");
00316 
00317   //make the Emulator Histogram directory
00318   TFileDirectory emuHist = fs->mkdir("EmulatorHistograms");
00319   std::vector<TFileDirectory> emuHistCat;
00320 
00321   //make the Data Histogram directory
00322   TFileDirectory dataHist =  fs->mkdir("DataHistograms");
00323   std::vector<TFileDirectory> dataHistCat;
00324 
00325   //make the ErrorFlags directory
00326   TFileDirectory errorHistFlags =  fs->mkdir("ErrorHistograms_Flags");
00327 
00328   //make the ErrorDebug directory
00329   TFileDirectory errorHistDetails =  fs->mkdir("ErrorHistograms_Details");
00330 
00331   for(unsigned int i=0;i<quantities.size();i++) {
00332     //fill the data and emulator folders with the directories
00333     emuHistCat.push_back(emuHist.mkdir(quantities.at(i)));
00334     dataHistCat.push_back(dataHist.mkdir(quantities.at(i)));
00335   }
00336   
00337   //add a folder for RCT Regions - which only exist in data
00338   dataHistCat.push_back(dataHist.mkdir("RCTRegions"));
00339   //and add a folder for the Intermediate Jets - which only exist in emulator
00340   emuHistCat.push_back(emuHist.mkdir("IntJets"));
00341 
00342   //Fill the ErrorDebug folder with the directories
00343   errorHistCat.push_back(errorHistDetails.mkdir("EM"));
00344   errorHistCat.push_back(errorHistDetails.mkdir("Jets"));
00345   errorHistCat.push_back(errorHistDetails.mkdir("HF"));
00346   errorHistCat.push_back(errorHistDetails.mkdir("TotalE"));
00347   errorHistCat.push_back(errorHistDetails.mkdir("MissingE"));
00348 
00349   //BOOK HISTOGRAMS
00350   RCT_EtEtaPhi_ = dataHistCat.at(9).make<TH2I>("RCT_EtEtaPhi", "RCT_EtEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
00351   RCT_TvEtaPhi_ = dataHistCat.at(9).make<TH2I>("RCT_TvEtaPhi", "RCT_TvEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
00352   RCT_FgEtaPhi_ = dataHistCat.at(9).make<TH2I>("RCT_FgEtaPhi", "RCT_FgEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
00353   RCT_OfEtaPhi_ = dataHistCat.at(9).make<TH2I>("RCT_OfEtEtaPhi", "RCT_OfEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
00354   //isoEg
00355   isoEgD_Rank_ = dataHistCat.at(0).make<TH1I>("isoEgD_Rank", "isoEgD_Rank;Rank;Number of Events", 64, -0.5, 63.5);
00356   isoEgE_Rank_ = emuHistCat.at(0).make<TH1I>("isoEgE_Rank", "isoEgE_Rank;Rank;Number of Events", 64, -0.5, 63.5);
00357   isoEgD_EtEtaPhi_ = dataHistCat.at(0).make<TH2I>("isoEgD_EtEtaPhi", "isoEgD_EtEtaPhi;#eta (GCT Units);#phi(GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
00358   isoEgE_EtEtaPhi_ = emuHistCat.at(0).make<TH2I>("isoEgE_EtEtaPhi", "isoEgE_EtEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
00359   isoEgD_OccEtaPhi_ = dataHistCat.at(0).make<TH2I>("isoEgD_OccEtaPhi", "isoEgD_OccEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
00360   isoEgE_OccEtaPhi_ = emuHistCat.at(0).make<TH2I>("isoEgE_OccEtaPhi", "isoEgE_OccEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
00361   isoEg_errorFlag_ = errorHistFlags.make<TH1I>("isoEg_errorFlag", "isoEg_errorFlag;Status;Number of Candidates", 3, -0.5, 2.5);
00362   //Global isoEg Error   
00363   isoEgD_GlobalError_Rank_ = errorHistCat.at(0).make<TH1I>("isoEgD_GlobalError_Rank", "isoEgD_GlobalError_Rank;Rank;Number of Events", 64, -0.5, 63.5);
00364   isoEgE_GlobalError_Rank_ = errorHistCat.at(0).make<TH1I>("isoEgE_GlobalError_Rank", "isoEgE_GlobalError_Rank;Rank;Number of Events", 64, -0.5, 63.5);
00365   isoEgD_GlobalError_EtEtaPhi_ = errorHistCat.at(0).make<TH2I>("isoEgD_GlobalError_EtEtaPhi", "isoEgD_GlobalError_EtEtaPhi", 22, -0.5, 21.5, 18, -0.5, 17.5);
00366   isoEgE_GlobalError_EtEtaPhi_ = errorHistCat.at(0).make<TH2I>("isoEgE_GlobalError_EtEtaPhi", "isoEgE_GlobalError_EtEtaPhi", 22, -0.5, 21.5, 18, -0.5, 17.5);
00367   //nonIsoEg
00368   nonIsoEgD_Rank_ = dataHistCat.at(1).make<TH1I>("nonIsoEgD_Rank", "nonIsoEgD_Rank;Rank;Number of Events", 64, -0.5, 63.5);
00369   nonIsoEgE_Rank_ = emuHistCat.at(1).make<TH1I>("nonIsoEgE_Rank", "nonIsoEgE_Rank;Rank;Number of Events", 64, -0.5, 63.5);
00370   nonIsoEgD_EtEtaPhi_ = dataHistCat.at(1).make<TH2I>("nonIsoEgD_EtEtaPhi", "nonIsoEgD_EtEtaPhi;#eta (GCT Units);#phi(GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
00371   nonIsoEgE_EtEtaPhi_ = emuHistCat.at(1).make<TH2I>("nonIsoEgE_EtEtaPhi", "nonIsoEgE_EtEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
00372   nonIsoEgD_OccEtaPhi_ = dataHistCat.at(1).make<TH2I>("nonIsoEgD_OccEtaPhi", "nonIsoEgD_OccEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
00373   nonIsoEgE_OccEtaPhi_ = emuHistCat.at(1).make<TH2I>("nonIsoEgE_OccEtaPhi", "nonIsoEgE_OccEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
00374   nonIsoEg_errorFlag_ = errorHistFlags.make<TH1I>("nonIsoEg_errorFlag", "nonIsoEg_errorFlag;Status;Number of Candidates", 3, -0.5, 2.5);
00375   //Global nonIsoEg Error
00376   nonIsoEgD_GlobalError_Rank_ = errorHistCat.at(0).make<TH1I>("nonIsoEgD_GlobalError_Rank", "nonIsoEgD_GlobalError_Rank;Rank;Number of Events", 64, -0.5, 63.5);
00377   nonIsoEgE_GlobalError_Rank_ = errorHistCat.at(0).make<TH1I>("nonIsoEgE_GlobalError_Rank", "nonIsoEgE_GlobalError_Rank;Rank;Number of Events", 64, -0.5, 63.5);
00378   nonIsoEgD_GlobalError_EtEtaPhi_ = errorHistCat.at(0).make<TH2I>("nonIsoEgD_GlobalError_EtEtaPhi", "nonIsoEgD_GlobalError_EtEtaPhi", 22, -0.5, 21.5, 18, -0.5, 17.5);
00379   nonIsoEgE_GlobalError_EtEtaPhi_ = errorHistCat.at(0).make<TH2I>("nonIsoEgE_GlobalError_EtEtaPhi", "nonIsoEgE_GlobalError_EtEtaPhi", 22, -0.5, 21.5, 18, -0.5, 17.5); 
00380   //CenJets
00381   cenJetD_Rank_ = dataHistCat.at(2).make<TH1I>("cenJetD_Rank", "cenJetD_Rank;Rank;Number of Events", 64, -0.5, 63.5);
00382   cenJetE_Rank_ = emuHistCat.at(2).make<TH1I>("cenJetE_Rank", "cenJetE_Rank;Rank;Number of Events", 64, -0.5, 63.5);
00383   cenJetD_EtEtaPhi_ = dataHistCat.at(2).make<TH2I>("cenJetD_EtEtaPhi", "cenJetD_EtEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
00384   cenJetE_EtEtaPhi_ = emuHistCat.at(2).make<TH2I>("cenJetE_EtEtaPhi", "cenJetE_EtEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
00385   cenJetD_OccEtaPhi_ = dataHistCat.at(2).make<TH2I>("cenJetD_OccEtaPhi", "cenJetD_OccEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
00386   cenJetE_OccEtaPhi_ = emuHistCat.at(2).make<TH2I>("cenJetE_OccEtaPhi", "cenJetE_OccEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
00387   cenJet_errorFlag_ = errorHistFlags.make<TH1I>("cenJet_errorFlag", "cenJet_errorFlag;Status;Number of Candidates", 3, -0.5, 2.5);
00388   //Global CenJet Error
00389   cenJetD_GlobalError_Rank_ = errorHistCat.at(1).make<TH1I>("cenJetD_GlobalError_Rank", "cenJetD_GlobalError_Rank", 64, -0.5, 63.5);
00390   cenJetE_GlobalError_Rank_ = errorHistCat.at(1).make<TH1I>("cenJetE_GlobalError_Rank", "cenJetE_GlobalError_Rank", 64, -0.5, 63.5);
00391   cenJetD_GlobalError_EtEtaPhi_ = errorHistCat.at(1).make<TH2I>("cenJetD_GlobalError_EtEtaPhi", "cenJetD_GlobalError_EtEtaPhi", 22, -0.5, 21.5, 18, -0.5, 17.5);
00392   cenJetE_GlobalError_EtEtaPhi_ = errorHistCat.at(1).make<TH2I>("cenJetE_GlobalError_EtEtaPhi", "cenJetE_GlobalError_EtEtaPhi", 22, -0.5, 21.5, 18, -0.5, 17.5);
00393   //TauJets
00394   tauJetD_Rank_ = dataHistCat.at(3).make<TH1I>("tauJetD_Rank", "tauJetD_Rank;Rank;Number of Events", 64, -0.5, 63.5);
00395   tauJetE_Rank_ = emuHistCat.at(3).make<TH1I>("tauJetE_Rank", "tauJetE_Rank;Rank;Number of Events", 64, -0.5, 63.5);
00396   tauJetD_EtEtaPhi_ = dataHistCat.at(3).make<TH2I>("tauJetD_EtEtaPhi", "tauJetD_EtEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
00397   tauJetE_EtEtaPhi_ = emuHistCat.at(3).make<TH2I>("tauJetE_EtEtaPhi", "tauJetE_EtEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
00398   tauJetD_OccEtaPhi_ = dataHistCat.at(3).make<TH2I>("tauJetD_OccEtaPhi", "tauJetD_OccEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
00399   tauJetE_OccEtaPhi_ = emuHistCat.at(3).make<TH2I>("tauJetE_OccEtaPhi", "tauJetE_OccEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
00400   tauJet_errorFlag_ = errorHistFlags.make<TH1I>("tauJet_errorFlag", "tauJet_errorFlag;Status;Number of Candidates", 3, -0.5, 2.5);
00401   //Global TauJet Error
00402   tauJetD_GlobalError_Rank_ = errorHistCat.at(1).make<TH1I>("tauJetD_GlobalError_Rank", "tauJetD_GlobalError_Rank", 64, -0.5, 63.5);
00403   tauJetE_GlobalError_Rank_ = errorHistCat.at(1).make<TH1I>("tauJetE_GlobalError_Rank", "tauJetE_GlobalError_Rank", 64, -0.5, 63.5);
00404   tauJetD_GlobalError_EtEtaPhi_ = errorHistCat.at(1).make<TH2I>("tauJetD_GlobalError_EtEtaPhi", "tauJetD_GlobalError_EtEtaPhi", 22, -0.5, 21.5, 18, -0.5, 17.5);
00405   tauJetE_GlobalError_EtEtaPhi_ = errorHistCat.at(1).make<TH2I>("tauJetE_GlobalError_EtEtaPhi", "tauJetE_GlobalError_EtEtaPhi", 22, -0.5, 21.5, 18, -0.5, 17.5);
00406   //ForJets
00407   forJetD_Rank_ = dataHistCat.at(4).make<TH1I>("forJetD_Rank", "forJetD_Rank;Rank;Number of Events", 64, -0.5, 63.5);
00408   forJetE_Rank_ = emuHistCat.at(4).make<TH1I>("forJetE_Rank", "forJetE_Rank;Rank;Number of Events", 64, -0.5, 63.5);
00409   forJetD_EtEtaPhi_ = dataHistCat.at(4).make<TH2I>("forJetD_EtEtaPhi", "forJetD_EtEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
00410   forJetE_EtEtaPhi_ = emuHistCat.at(4).make<TH2I>("forJetE_EtEtaPhi", "forJetE_EtEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
00411   forJetD_OccEtaPhi_ = dataHistCat.at(4).make<TH2I>("forJetD_OccEtaPhi", "forJetD_OccEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
00412   forJetE_OccEtaPhi_ = emuHistCat.at(4).make<TH2I>("forJetE_OccEtaPhi", "forJetE_OccEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
00413   forJet_errorFlag_ = errorHistFlags.make<TH1I>("forJet_errorFlag", "forJet_errorFlag;Status;Number of Candidates", 3, -0.5, 2.5);
00414   //Global ForJet Error
00415   forJetD_GlobalError_Rank_ = errorHistCat.at(1).make<TH1I>("forJetD_GlobalError_Rank", "forJetD_GlobalError_Rank", 64, -0.5, 63.5);
00416   forJetE_GlobalError_Rank_ = errorHistCat.at(1).make<TH1I>("forJetE_GlobalError_Rank", "forJetE_GlobalError_Rank", 64, -0.5, 63.5);
00417   forJetD_GlobalError_EtEtaPhi_ = errorHistCat.at(1).make<TH2I>("forJetD_GlobalError_EtEtaPhi", "forJetD_GlobalError_EtEtaPhi", 22, -0.5, 21.5, 18, -0.5, 17.5);
00418   forJetE_GlobalError_EtEtaPhi_ = errorHistCat.at(1).make<TH2I>("forJetE_GlobalError_EtEtaPhi", "forJetE_GlobalError_EtEtaPhi", 22, -0.5, 21.5, 18, -0.5, 17.5);
00419   //IntJets
00420   intJetEtEtaPhiE_ = emuHistCat.at(9).make<TH2I>("intJetEtEtaPhiE_", "intJetEtEtaPhiE_;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
00421   intJetE_Et_ = emuHistCat.at(9).make<TH1I>("intJetE_Et", "intJetE_Et;E_{T};Number of Events", 1024, -0.5, 1023.5);
00422   intJetE_Of_ = emuHistCat.at(9).make<TH1I>("intJetE_Of", "intJetE_Of;Overflow Bit Status;Number of Events", 2, -0.5, 1.5);
00423   intJetE_Jet1Et_ = emuHistCat.at(9).make<TH1I>("intJetE_Jet1Et", "intJetE_Jet1Et;E_{T};Number of Events", 1024, -0.5, 1023.5);
00424   intJetE_Jet2Et_ = emuHistCat.at(9).make<TH1I>("intJetE_Jet2Et", "intJetE_Jet2Et;E_{T};Number of Events", 1024, -0.5, 1023.5);
00425   intJetE_Jet3Et_ = emuHistCat.at(9).make<TH1I>("intJetE_Jet3Et", "intJetE_Jet3Et;E_{T};Number of Events", 1024, -0.5, 1023.5);
00426   intJetE_Jet4Et_ = emuHistCat.at(9).make<TH1I>("intJetE_Jet4Et", "intJetE_Jet4Et;E_{T};Number of Events", 1024, -0.5, 1023.5);
00427   //HFRing Sums
00428   hfRingSumD_1pos_ = dataHistCat.at(5).make<TH1I>("hfRingSumD_1+", "hfRingSumD_1+;Rank;Number of Events", 8, -0.5, 7.5);
00429   hfRingSumD_1neg_ = dataHistCat.at(5).make<TH1I>("hfRingSumD_1-", "hfRingSumD_1-;Rank;Number of Events", 8, -0.5, 7.5);
00430   hfRingSumD_2pos_ = dataHistCat.at(5).make<TH1I>("hfRingSumD_2+", "hfRingSumD_2+;Rank;Number of Events", 8, -0.5, 7.5);
00431   hfRingSumD_2neg_ = dataHistCat.at(5).make<TH1I>("hfRingSumD_2-", "hfRingSumD_2-;Rank;Number of Events", 8, -0.5, 7.5);
00432   hfRingSumE_1pos_ = emuHistCat.at(5).make<TH1I>("hfRingSumE_1+", "hfRingSumE_1+;Rank;Number of Events", 8, -0.5, 7.5);
00433   hfRingSumE_1neg_ = emuHistCat.at(5).make<TH1I>("hfRingSumE_1-", "hfRingSumE_1-;Rank;Number of Events", 8, -0.5, 7.5);
00434   hfRingSumE_2pos_ = emuHistCat.at(5).make<TH1I>("hfRingSumE_2+", "hfRingSumE_2+;Rank;Number of Events", 8, -0.5, 7.5);
00435   hfRingSumE_2neg_ = emuHistCat.at(5).make<TH1I>("hfRingSumE_2-", "hfRingSumE_2-;Rank;Number of Events", 8, -0.5, 7.5);   
00436   hfRingSum_errorFlag_ = errorHistFlags.make<TH1I>("hfRingSum_errorFlag","hfRingSum_errorFlag;Status;Number of Candidates",2,-0.5,1.5);
00437   //HFRing BitCounts
00438   hfBitCountD_1pos_ = dataHistCat.at(6).make<TH1I>("hfBitCountD_1+", "hfBitCountD_1+;Rank;Number of Events", 8, -0.5, 7.5);
00439   hfBitCountD_1neg_ = dataHistCat.at(6).make<TH1I>("hfBitCountD_1-", "hfBitCountD_1-;Rank;Number of Events", 8, -0.5, 7.5);
00440   hfBitCountD_2pos_ = dataHistCat.at(6).make<TH1I>("hfBitCountD_2+", "hfBitCountD_2+;Rank;Number of Events", 8, -0.5, 7.5);
00441   hfBitCountD_2neg_ = dataHistCat.at(6).make<TH1I>("hfBitCountD_2-", "hfBitCountD_2-;Rank;Number of Events", 8, -0.5, 7.5);
00442   hfBitCountE_1pos_ = emuHistCat.at(6).make<TH1I>("hfBitCountE_1+", "hfBitCountE_1+;Rank;Number of Events", 8, -0.5, 7.5);
00443   hfBitCountE_1neg_ = emuHistCat.at(6).make<TH1I>("hfBitCountE_1-", "hfBitCountE_1-;Rank;Number of Events", 8, -0.5, 7.5);
00444   hfBitCountE_2pos_ = emuHistCat.at(6).make<TH1I>("hfBitCountE_2+", "hfBitCountE_2+;Rank;Number of Events", 8, -0.5, 7.5);
00445   hfBitCountE_2neg_ = emuHistCat.at(6).make<TH1I>("hfBitCountE_2-", "hfBitCountE_2-;Rank;Number of Events", 8, -0.5, 7.5);
00446   hfBitCount_errorFlag_ = errorHistFlags.make<TH1I>("hfBitCount_errorFlag","hfBitCount_errorFlag;Status;Number of Candidates",2,-0.5,1.5);
00447   //Total ET
00448   totalEtD_ = dataHistCat.at(7).make<TH1I>("totalEtD", "totalEtD;E_{T};Number of Events", 2048, -0.5, 2047.5);
00449   totalEtD_Of_ = dataHistCat.at(7).make<TH1I>("totalEtD_Of", "totalEtD_Of;Overflow Bit Status;Number of Events", 2, -0.5, 1.5);
00450   totalEtE_ = emuHistCat.at(7).make<TH1I>("totalEtE", "totalEtE;E_{T};Number of Events", 2048, -0.5, 2047.5);
00451   totalEtE_Of_ = emuHistCat.at(7).make<TH1I>("totalEtE_Of", "totalEtE_Of;Overflow Bit Status;Number of Events", 2, -0.5, 1.5);
00452   totalEt_errorFlag_ = errorHistFlags.make<TH1I>("totalEt_errorFlag","totalEt_errorFlag;Status;Number of Candidates",2,-0.5,1.5);
00453   //Book the Global ET Error histograms in the errorHistCat   
00454   //totalEtD_GlobalError_ = errorHistCat.at(3).make<TH1I>("totalEtD_GlobalError", "totalEtD_GlobalError;E_{T};Number of Events", 1024, -0.5, 1023.5);
00455   //totalEtE_GlobalError_ = errorHistCat.at(3).make<TH1I>("totalEtE_GlobalError", "totalEtE_GlobalError;E_{T};Number of Events", 1024, -0.5, 1023.5);
00456   //totalEtD_GlobalError_Of_ = errorHistCat.at(3).make<TH1I>("totalEtD_GlobalError_Of", "totalEtD_GlobalError_Of;Overflow Bit Status;Number of Events", 2, -0.5, 1.5);
00457   //totalEtE_GlobalError_Of_ = errorHistCat.at(3).make<TH1I>("totalEtE_GlobalError_Of", "totalEtE_GlobalError_Of;Overflow Bit Status;Number of Events", 2, -0.5, 1.5);
00458   //Total HT
00459   totalHtD_ = dataHistCat.at(7).make<TH1I>("totalHtD", "totalHtD;H_{T};Number of Events", 2048, -0.5, 2047.5);
00460   totalHtD_Of_ = dataHistCat.at(7).make<TH1I>("totalHtD_Of", "totalHtD_Of;Overflow Bit Status;Number of Events", 2, -0.5, 1.5);
00461   totalHtE_ = emuHistCat.at(7).make<TH1I>("totalHtE", "totalHtE;H_{T};Number of Events", 2048, -0.5, 2047.5);
00462   totalHtE_Of_ = emuHistCat.at(7).make<TH1I>("totalHtE_Of", "totalHtE_Of;Overflow Bit Status;Number of Events", 2, -0.5, 1.5);
00463   totalHt_errorFlag_ = errorHistFlags.make<TH1I>("totalHt_errorFlag","totalHt_errorFlag;Status;Number of Candidates",2,-0.5,1.5);
00464   //Book the Global HT Error histograms in the errorHistCat
00465   //totalHtD_GlobalError_ = errorHistCat.at(3).make<TH1I>("totalHtD_GlobalError", "totalHtD_GlobalError;E_{T};Number of Events", 1024, -0.5, 1023.5);
00466   //totalHtE_GlobalError_ = errorHistCat.at(3).make<TH1I>("totalHtE_GlobalError", "totalHtE_GlobalError;E_{T};Number of Events", 1024, -0.5, 1023.5);
00467   //totalHtD_GlobalError_Of_ = errorHistCat.at(3).make<TH1I>("totalHtD_GlobalError_Of", "totalHtD_GlobalError_Of;Overflow Bit Status;Number of Events", 2, -0.5, 1.5);
00468   //totalHtE_GlobalError_Of_ = errorHistCat.at(3).make<TH1I>("totalHtE_GlobalError_Of", "totalHtE_GlobalError_Of;Overflow Bit Status;Number of Events", 2, -0.5, 1.5);
00469   //MissingEt
00470   missingEtD_ = dataHistCat.at(8).make<TH1I>("missingEtD", "missingEtD;Missing E_{T};Number of Events", 1024, -0.5, 1023.5);
00471   missingEtD_Of_ = dataHistCat.at(8).make<TH1I>("missingEtD_Of", "missingEtD_Of;Overflow Bit Status;Number of Events", 2, -0.5, 1.5);
00472   missingEtD_Phi_ = dataHistCat.at(8).make<TH1I>("missingEtD_Phi", "missingEtD_Phi;Missing E_{T} #phi;Number of Events", 72, -0.5, 71.5);
00473   missingEtE_ = emuHistCat.at(8).make<TH1I>("missingEtE", "missingEtE;Missing E_{T};Number of Events", 1024, -0.5, 1023.5);
00474   missingEtE_Of_ = emuHistCat.at(8).make<TH1I>("missingEtE_Of", "missingEtE_Of;Overflow Bit Status;Number of Events", 2, -0.5, 1.5);
00475   missingEtE_Phi_ = emuHistCat.at(8).make<TH1I>("missingEtE_Phi", "missingEtE_Phi;Missing E_{T} #phi;Number of Events", 72, -0.5, 71.5);
00476   missingEt_errorFlag_ = errorHistFlags.make<TH1I>("missingEt_errorFlag","missingEt_errorFlag;Status;Number of Candidates",4,-0.5,3.5); 
00477   //MissingHt
00478   missingHtD_ = dataHistCat.at(8).make<TH1I>("missingHtD", "missingHtD;Missing H_{T};Number of Events", 1024, -0.5, 1023.5);
00479   missingHtD_Of_ = dataHistCat.at(8).make<TH1I>("missingHtD_Of", "missingHtD_Of;Overflow Bit Status;Number of Events", 2, -0.5, 1.5);
00480   missingHtD_Phi_ = dataHistCat.at(8).make<TH1I>("missingHtD_Phi", "missingHtD_Phi;Missing H_{T} #phi;Number of Events", 72, -0.5, 71.5);
00481   missingHtE_ = emuHistCat.at(8).make<TH1I>("missingHtE", "missingHtE;Missing H_{T};Number of Events", 1024, -0.5, 1023.5);
00482   missingHtE_Of_ = emuHistCat.at(8).make<TH1I>("missingHtE_Of", "missingHtE_Of;Overflow Bit Status;Number of Events", 2, -0.5, 1.5);
00483   missingHtE_Phi_ = emuHistCat.at(8).make<TH1I>("missingHtE_Phi", "missingHtE_Phi;Missing H_{T} #phi;Number of Events", 72, -0.5, 71.5);
00484   missingHt_errorFlag_ = errorHistFlags.make<TH1I>("missingHt_errorFlag","missingHt_errorFlag;Status;Number of Candidates",4,-0.5,3.5);
00485   //Additional MissingHt Debug histograms
00486   missingHtD_HtXPosLeaf1 = dataHistCat.at(8).make<TH1I>("missingHtD_HtXPosLeaf1", "missingHtD;Missing H_{T} X PosLeaf1;Number of Events", 4096, -2048.5, 2047.5);
00487   missingHtD_HtXPosLeaf2 = dataHistCat.at(8).make<TH1I>("missingHtD_HtXPosLeaf2", "missingHtD;Missing H_{T} X PosLeaf2;Number of Events", 4096, -2048.5, 2047.5);
00488   missingHtD_HtXPosLeaf3 = dataHistCat.at(8).make<TH1I>("missingHtD_HtXPosLeaf3", "missingHtD;Missing H_{T} X PosLeaf3;Number of Events", 4096, -2048.5, 2047.5);
00489   missingHtD_HtXNegLeaf1 = dataHistCat.at(8).make<TH1I>("missingHtD_HtXNegLeaf1", "missingHtD;Missing H_{T} X NegLeaf1;Number of Events", 4096, -2048.5, 2047.5);
00490   missingHtD_HtXNegLeaf2 = dataHistCat.at(8).make<TH1I>("missingHtD_HtXNegLeaf2", "missingHtD;Missing H_{T} X NegLeaf2;Number of Events", 4096, -2048.5, 2047.5);
00491   missingHtD_HtXNegLeaf3 = dataHistCat.at(8).make<TH1I>("missingHtD_HtXNegLeaf3", "missingHtD;Missing H_{T} X NegLeaf3;Number of Events", 4096, -2048.5, 2047.5);
00492 
00493   missingHtD_HtYPosLeaf1 = dataHistCat.at(8).make<TH1I>("missingHtD_HtYPosLeaf1", "missingHtD;Missing H_{T} Y PosLeaf1;Number of Events", 4096, -2048.5, 2047.5);
00494   missingHtD_HtYPosLeaf2 = dataHistCat.at(8).make<TH1I>("missingHtD_HtYPosLeaf2", "missingHtD;Missing H_{T} Y PosLeaf2;Number of Events", 4096, -2048.5, 2047.5);
00495   missingHtD_HtYPosLeaf3 = dataHistCat.at(8).make<TH1I>("missingHtD_HtYPosLeaf3", "missingHtD;Missing H_{T} Y PosLeaf3;Number of Events", 4096, -2048.5, 2047.5);
00496   missingHtD_HtYNegLeaf1 = dataHistCat.at(8).make<TH1I>("missingHtD_HtYNegLeaf1", "missingHtD;Missing H_{T} Y NegLeaf1;Number of Events", 4096, -2048.5, 2047.5);
00497   missingHtD_HtYNegLeaf2 = dataHistCat.at(8).make<TH1I>("missingHtD_HtYNegLeaf2", "missingHtD;Missing H_{T} Y NegLeaf2;Number of Events", 4096, -2048.5, 2047.5);
00498   missingHtD_HtYNegLeaf3 = dataHistCat.at(8).make<TH1I>("missingHtD_HtYNegLeaf3", "missingHtD;Missing H_{T} Y NegLeaf3;Number of Events", 4096, -2048.5, 2047.5);
00499 
00500   //Annotate the labels of the error flags
00501   //For the electrons and jets
00502   std::vector<std::string> errorFlagLabels;
00503   errorFlagLabels.push_back("Matched");
00504   errorFlagLabels.push_back("Unmatched Data Cand");
00505   errorFlagLabels.push_back("Unmatched Emul Cand");
00506    
00507   for(unsigned int i=0;i<errorFlagLabels.size();i++) {
00508     isoEg_errorFlag_->GetXaxis()->SetBinLabel(i+1,errorFlagLabels.at(i).c_str());
00509     nonIsoEg_errorFlag_->GetXaxis()->SetBinLabel(i+1,errorFlagLabels.at(i).c_str());
00510     cenJet_errorFlag_->GetXaxis()->SetBinLabel(i+1,errorFlagLabels.at(i).c_str());
00511     tauJet_errorFlag_->GetXaxis()->SetBinLabel(i+1,errorFlagLabels.at(i).c_str());
00512     forJet_errorFlag_->GetXaxis()->SetBinLabel(i+1,errorFlagLabels.at(i).c_str());
00513   }
00514   errorFlagLabels.clear();
00515    
00516   //For the Total Energy Sums and HF
00517   errorFlagLabels.push_back("Matched");
00518   errorFlagLabels.push_back("Unmatched");
00519 
00520   for(unsigned int i=0;i<errorFlagLabels.size();i++) {
00521     hfRingSum_errorFlag_->GetXaxis()->SetBinLabel(i+1,errorFlagLabels.at(i).c_str());
00522     hfBitCount_errorFlag_->GetXaxis()->SetBinLabel(i+1,errorFlagLabels.at(i).c_str());
00523     totalEt_errorFlag_->GetXaxis()->SetBinLabel(i+1,errorFlagLabels.at(i).c_str());
00524     totalHt_errorFlag_->GetXaxis()->SetBinLabel(i+1,errorFlagLabels.at(i).c_str());
00525   }
00526   errorFlagLabels.clear();
00527 
00528   //For the Missing Energy Sums
00529   errorFlagLabels.push_back("Matched");
00530   errorFlagLabels.push_back("Matched Mag");
00531   errorFlagLabels.push_back("Matched Phi");
00532   errorFlagLabels.push_back("Unmatched");
00533 
00534   for(unsigned int i=0;i<errorFlagLabels.size();i++) {
00535     missingEt_errorFlag_->GetXaxis()->SetBinLabel(i+1,errorFlagLabels.at(i).c_str());
00536     missingHt_errorFlag_->GetXaxis()->SetBinLabel(i+1,errorFlagLabels.at(i).c_str());
00537   }
00538 
00539   //initialise - set all flags to false as they will be set on an event-by-event basis
00540   isIsoError=0;
00541   isNonIsoError=0;
00542   isCenJetError=0; 
00543   isTauJetError=0;
00544   isForJetError=0;
00545   isRingSumError=0;
00546   isBitCountError=0;
00547   isTotalEError=0;
00548   isTotalHError=0;
00549   isMissingEError=0;
00550   isMissingHError=0;
00551 
00552   //fill the struct of MBXinformation. It is easier to pass this information to the respective functions as used below this way
00553   MBxInfo.RCTTrigBx = RCTTrigBx_;
00554   MBxInfo.EmuTrigBx = EmuTrigBx_;
00555   MBxInfo.GCTTrigBx = GCTTrigBx_;
00556 
00557   //set the parameters according to the system chosen
00558   if(useSys_ == "P5") {
00559     RCT_REGION_QUANTA = &RCT_REGION_QUANTA_P5;
00560   }
00561   else if(useSys_ == "Lab") {
00562     RCT_REGION_QUANTA = &RCT_REGION_QUANTA_LAB;
00563   }
00564   else {
00565     edm::LogWarning("ChosenSystem") << " " << "The system you chose to use (" << useSys_ << ") was not recognised. Defaulting to the full system geometry";
00566     RCT_REGION_QUANTA = &RCT_REGION_QUANTA_P5;
00567   }
00568 
00569 }
00570 
00571 
00572 GctErrorAnalyzer::~GctErrorAnalyzer()
00573 {
00574  
00575   // do anything here that needs to be done at desctruction time
00576   // (e.g. close files, deallocate resources etc.)
00577 
00578 }
00579 
00580 
00581 //
00582 // member functions
00583 //
00584 
00585 // ------------ method called to for each event  ------------
00586 void
00587 GctErrorAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
00588 {
00589   using namespace edm;
00590   using namespace std;
00591 
00592   Handle<L1CaloRegionCollection> caloRegions; 
00593   Handle<L1CaloEmCollection> emRegions;
00594 
00595   Handle<L1GctEmCandCollection> nonIsoEgD; 
00596   Handle<L1GctEmCandCollection> nonIsoEgE;
00597   Handle<L1GctEmCandCollection> isoEgD; 
00598   Handle<L1GctEmCandCollection> isoEgE;
00599 
00600   Handle<L1GctJetCandCollection> cenJetsD; 
00601   Handle<L1GctJetCandCollection> cenJetsE; 
00602   Handle<L1GctJetCandCollection> forJetsD; 
00603   Handle<L1GctJetCandCollection> forJetsE; 
00604   Handle<L1GctJetCandCollection> tauJetsD; 
00605   Handle<L1GctJetCandCollection> tauJetsE;
00606 
00607   Handle<L1GctInternJetDataCollection> intJetsE;
00608 
00609   Handle<L1GctHFRingEtSumsCollection> hfRingSumsD;
00610   Handle<L1GctHFRingEtSumsCollection> hfRingSumsE;
00611 
00612   Handle<L1GctHFBitCountsCollection> hfBitCountsD;
00613   Handle<L1GctHFBitCountsCollection> hfBitCountsE;
00614 
00615   Handle<L1GctEtTotalCollection> totalEtD;
00616   Handle<L1GctEtTotalCollection> totalEtE;
00617 
00618   Handle<L1GctEtHadCollection> totalHtD;
00619   Handle<L1GctEtHadCollection> totalHtE;
00620 
00621   Handle<L1GctEtMissCollection> missingEtD;
00622   Handle<L1GctEtMissCollection> missingEtE;
00623 
00624   Handle<L1GctHtMissCollection> missingHtD;
00625   Handle<L1GctHtMissCollection> missingHtE;
00626 
00627   Handle<L1GctInternHtMissCollection> intHtMissD;
00628 
00629   //we need this for all user cases...
00630   iEvent.getByLabel(dataTag_.label(), caloRegions);
00631 
00632   //in order to allow the debug folders to have a unique name (so that when jobs are split in crab, we can merge) 
00633   //use the eventnum in the folder name
00634   eventNumber = iEvent.id().event();
00635 
00636   if(doRCT_) {
00637     if(checkCollections(caloRegions, *RCT_REGION_QUANTA, "RCT CaloRegions")) plotRCTRegions(caloRegions);
00638   }
00639 
00640   if(doEg_) {
00641     iEvent.getByLabel(dataTag_.label(),"nonIsoEm", nonIsoEgD);
00642     iEvent.getByLabel(emuTag_.label(), "nonIsoEm", nonIsoEgE);
00643 
00644     iEvent.getByLabel(dataTag_.label(), "isoEm", isoEgD);
00645     iEvent.getByLabel(emuTag_.label(), "isoEm", isoEgE);
00646 
00647     isIsoError=0;
00648     isNonIsoError=0;
00649 
00650     if(checkCollections(isoEgD, GCT_OBJECT_QUANTA, "Iso e/g Data") && checkCollections(isoEgE, GCT_OBJECT_QUANTA, "Iso e/g Emulator")) {
00651       plotIsoEm(isoEgD, isoEgE);
00652       compareEG isoCompare(isoEgD, isoEgE, MBxInfo);
00653       isIsoError = isoCompare.doCompare(isoEg_errorFlag_, isoEgD_GlobalError_Rank_, isoEgD_GlobalError_EtEtaPhi_, isoEgE_GlobalError_Rank_, isoEgE_GlobalError_EtEtaPhi_);
00654     }
00655     
00656     if(checkCollections(nonIsoEgD, GCT_OBJECT_QUANTA, "NonIso e/g Data") && checkCollections(nonIsoEgE, GCT_OBJECT_QUANTA, "NonIso e/g Emulator")) {
00657       plotNonIsoEm(nonIsoEgD, nonIsoEgE);
00658       compareEG nonIsoCompare(nonIsoEgD, nonIsoEgE, MBxInfo);
00659       isNonIsoError = nonIsoCompare.doCompare(nonIsoEg_errorFlag_, nonIsoEgD_GlobalError_Rank_, nonIsoEgD_GlobalError_EtEtaPhi_, nonIsoEgE_GlobalError_Rank_, nonIsoEgE_GlobalError_EtEtaPhi_);
00660     }
00661 
00662     if( (isIsoError && doIsoDebug_) || (isNonIsoError && doNonIsoDebug_) ) {
00663       iEvent.getByLabel(dataTag_.label(), emRegions);
00664       if(checkCollections(emRegions, RCT_EM_OBJECT_QUANTA, "RCT EMRegions")) plotEGErrors(isoEgD, isoEgE, nonIsoEgD, nonIsoEgE, emRegions);
00665     } 
00666   }
00667 
00668   if(doJets_) {
00669     iEvent.getByLabel(emuTag_.label(), "cenJets", cenJetsE);
00670     iEvent.getByLabel(dataTag_.label(), "cenJets", cenJetsD);
00671 
00672     iEvent.getByLabel(emuTag_.label(), "forJets", forJetsE);
00673     iEvent.getByLabel(dataTag_.label(), "forJets", forJetsD);
00674 
00675     iEvent.getByLabel(emuTag_.label(), "tauJets", tauJetsE);
00676     iEvent.getByLabel(dataTag_.label(), "tauJets", tauJetsD);
00677 
00678     iEvent.getByLabel(emuTag_.label(), intJetsE); 
00679 
00680     isCenJetError=0;
00681     isTauJetError=0;
00682     isForJetError=0;
00683 
00684     //Central Jets
00685     if(checkCollections(cenJetsD, GCT_OBJECT_QUANTA, "Central Jets Data") && checkCollections(cenJetsE, GCT_OBJECT_QUANTA, "Central Jets Emulator")) {
00686       plotCenJets(cenJetsD, cenJetsE);
00687       compareJets cenJetsCompare(cenJetsD, cenJetsE, MBxInfo);
00688       isCenJetError = cenJetsCompare.doCompare(cenJet_errorFlag_, cenJetD_GlobalError_Rank_, cenJetD_GlobalError_EtEtaPhi_, cenJetE_GlobalError_Rank_, cenJetE_GlobalError_EtEtaPhi_);
00689     }
00690 
00691     //Tau Jets
00692     if(checkCollections(tauJetsD, GCT_OBJECT_QUANTA, "Tau Jets Data") && checkCollections(tauJetsE, GCT_OBJECT_QUANTA, "Tau Jets Emulator")) {
00693       plotTauJets(tauJetsD, tauJetsE);
00694       compareJets tauJetsCompare(tauJetsD, tauJetsE, MBxInfo);
00695       isTauJetError = tauJetsCompare.doCompare(tauJet_errorFlag_, tauJetD_GlobalError_Rank_, tauJetD_GlobalError_EtEtaPhi_, tauJetE_GlobalError_Rank_, tauJetE_GlobalError_EtEtaPhi_);
00696     }
00697 
00698     //For Jets
00699     if(checkCollections(forJetsD, GCT_OBJECT_QUANTA, "Forward Jets Data") && checkCollections(forJetsE, GCT_OBJECT_QUANTA, "Forward Jets Emulator")) {
00700       plotForJets(forJetsD, forJetsE);
00701       compareJets forJetsCompare(forJetsD, forJetsE, MBxInfo);
00702       isForJetError = forJetsCompare.doCompare(forJet_errorFlag_, forJetD_GlobalError_Rank_, forJetD_GlobalError_EtEtaPhi_, forJetE_GlobalError_Rank_, forJetE_GlobalError_EtEtaPhi_); 
00703     }
00704 
00705     //Emulator Intermediate Jets
00706     if(checkCollections(intJetsE, NUM_INT_JETS, "Intermediate Jets Emulator")) plotIntJets(intJetsE);
00707 
00708     if( (isCenJetError && doCenJetsDebug_) || (isTauJetError && doTauJetsDebug_) || (isForJetError && doForJetsDebug_) ) {
00709       plotJetErrors(cenJetsD, cenJetsE, tauJetsD, tauJetsE, forJetsD, forJetsE, caloRegions);
00710     }  
00711   }
00712 
00713   if(doHF_) {
00714     iEvent.getByLabel(dataTag_.label(), hfRingSumsD);
00715     iEvent.getByLabel(emuTag_.label(), hfRingSumsE);
00716 
00717     iEvent.getByLabel(dataTag_.label(), hfBitCountsD);
00718     iEvent.getByLabel(emuTag_.label(), hfBitCountsE);
00719     
00720     isRingSumError=0;
00721     isBitCountError=0;
00722     
00723     if(checkCollections(hfRingSumsD, GCT_SUMS_QUANTA, "HF Ring Sums Data") && checkCollections(hfRingSumsE, GCT_SUMS_QUANTA, "HF Ring Sums Emulator")) {
00724       plotHFRingSums(hfRingSumsD, hfRingSumsE);
00725       compareRingSums HFRingSums(hfRingSumsD, hfRingSumsE, MBxInfo);
00726       isRingSumError = HFRingSums.doCompare(hfRingSum_errorFlag_);
00727     }
00728 
00729     if(checkCollections(hfBitCountsD, GCT_SUMS_QUANTA, "HF Bit Counts Data") && checkCollections(hfBitCountsE, GCT_SUMS_QUANTA, "HF Bit Counts Emulator")) {
00730       plotHFBitCounts(hfBitCountsD, hfBitCountsE);
00731       compareBitCounts HFBitCounts(hfBitCountsD, hfBitCountsE, MBxInfo);
00732       isBitCountError = HFBitCounts.doCompare(hfBitCount_errorFlag_); 
00733     }
00734 
00735     if( (isRingSumError && doRingSumDebug_) || (isBitCountError && doBitCountDebug_) ) {
00736       plotHFErrors(hfRingSumsD, hfRingSumsE, hfBitCountsD, hfBitCountsE, caloRegions);
00737     }
00738   }
00739 
00740   if(doTotalEnergySums_) {
00741     iEvent.getByLabel(dataTag_.label(), totalEtD);
00742     iEvent.getByLabel(emuTag_.label(), totalEtE);
00743 
00744     iEvent.getByLabel(dataTag_.label(), totalHtD);
00745     iEvent.getByLabel(emuTag_.label(), totalHtE);
00746 
00747     isTotalEError=0;
00748     isTotalHError=0;
00749 
00750     if(checkCollections(totalEtD, GCT_SUMS_QUANTA, "Total Et Data") && checkCollections(totalEtE, GCT_SUMS_QUANTA, "Total Et Emulator")) {
00751       plotTotalE(totalEtD, totalEtE);   
00752       compareTotalE compareET(totalEtD, totalEtE, MBxInfo);
00753       isTotalEError = compareET.doCompare(totalEt_errorFlag_);
00754     }
00755 
00756     if(checkCollections(totalHtD, GCT_SUMS_QUANTA, "Total Ht Data") && checkCollections(totalHtE, GCT_SUMS_QUANTA, "Total Ht Emulator")) {
00757       plotTotalH(totalHtD, totalHtE);
00758       compareTotalH compareHT(totalHtD, totalHtE, MBxInfo);
00759       isTotalHError = compareHT.doCompare(totalHt_errorFlag_);  
00760     }
00761 
00762     if((isTotalEError && doTotalEtDebug_) || (isTotalHError && doTotalHtDebug_)) {
00763       plotTotalEErrors(totalEtD, totalEtE, totalHtD, totalHtE, caloRegions);
00764     }
00765 
00766   }
00767 
00768   if(doMissingEnergySums_) {
00769 
00770     iEvent.getByLabel(dataTag_.label(), missingEtD);
00771     iEvent.getByLabel(emuTag_.label(), missingEtE);
00772 
00773     iEvent.getByLabel(dataTag_.label(), missingHtD);
00774     iEvent.getByLabel(emuTag_.label(), missingHtE);
00775     
00776     isMissingEError=0;
00777     isMissingHError=0;
00778     
00779     if(checkCollections(missingEtD, GCT_SUMS_QUANTA, "Missing Et Data") && checkCollections(missingEtE, GCT_SUMS_QUANTA, "Missing Et Emulator")) {
00780       plotMissingEt(missingEtD, missingEtE);
00781       compareMissingE compareMET(missingEtD, missingEtE, MBxInfo);
00782       isMissingEError = compareMET.doCompare(missingEt_errorFlag_);
00783     }
00784 
00785     if(checkCollections(missingHtD, GCT_SUMS_QUANTA, "Missing Ht Data") && checkCollections(missingHtE, GCT_SUMS_QUANTA, "Missing Ht Emulator")) {
00786       plotMissingHt(missingHtD, missingHtE);
00787       compareMissingH compareMHT(missingHtD, missingHtE, MBxInfo);
00788       isMissingHError = compareMHT.doCompare(missingHt_errorFlag_);
00789 
00790       //added 19/03/2010 for intermediate information on MissingHt quantities in the data
00791       if(doExtraMissingHTDebug_) {
00792         iEvent.getByLabel(dataTag_.label(), "", intHtMissD);
00793         if(checkCollections(intHtMissD, GCT_INT_HTMISS_QUANTA, "Internal Missing Ht Data")) {
00794           for(unsigned int i=0; i<intHtMissD->size(); i++) {
00795             if(doGCTMBx_ || intHtMissD->at(i).bx() == GCTTrigBx_) {
00796               if(!intHtMissD->at(i).overflow()) {
00797                 //the capBlock 0x301 is the input pipeline at the wheel for positive eta, whereas 0x701 is for negative eta
00798                 if(intHtMissD->at(i).capBlock() == 0x301 && intHtMissD->at(i).capIndex() == 0 && intHtMissD->at(i).isThereHtx()) missingHtD_HtXPosLeaf1->Fill(intHtMissD->at(i).htx());
00799                 if(intHtMissD->at(i).capBlock() == 0x301 && intHtMissD->at(i).capIndex() == 1 && intHtMissD->at(i).isThereHtx()) missingHtD_HtXPosLeaf2->Fill(intHtMissD->at(i).htx());
00800                 if(intHtMissD->at(i).capBlock() == 0x301 && intHtMissD->at(i).capIndex() == 2 && intHtMissD->at(i).isThereHtx()) missingHtD_HtXPosLeaf3->Fill(intHtMissD->at(i).htx());
00801                 if(intHtMissD->at(i).capBlock() == 0x701 && intHtMissD->at(i).capIndex() == 0 && intHtMissD->at(i).isThereHtx()) missingHtD_HtXNegLeaf1->Fill(intHtMissD->at(i).htx());
00802                 if(intHtMissD->at(i).capBlock() == 0x701 && intHtMissD->at(i).capIndex() == 1 && intHtMissD->at(i).isThereHtx()) missingHtD_HtXNegLeaf2->Fill(intHtMissD->at(i).htx());
00803                 if(intHtMissD->at(i).capBlock() == 0x701 && intHtMissD->at(i).capIndex() == 2 && intHtMissD->at(i).isThereHtx()) missingHtD_HtXNegLeaf3->Fill(intHtMissD->at(i).htx());
00804                 
00805                 if(intHtMissD->at(i).capBlock() == 0x301 && intHtMissD->at(i).capIndex() == 0 && intHtMissD->at(i).isThereHty()) missingHtD_HtYPosLeaf1->Fill(intHtMissD->at(i).hty());
00806                 if(intHtMissD->at(i).capBlock() == 0x301 && intHtMissD->at(i).capIndex() == 1 && intHtMissD->at(i).isThereHty()) missingHtD_HtYPosLeaf2->Fill(intHtMissD->at(i).hty());
00807                 if(intHtMissD->at(i).capBlock() == 0x301 && intHtMissD->at(i).capIndex() == 2 && intHtMissD->at(i).isThereHty()) missingHtD_HtYPosLeaf3->Fill(intHtMissD->at(i).hty());
00808                 if(intHtMissD->at(i).capBlock() == 0x701 && intHtMissD->at(i).capIndex() == 0 && intHtMissD->at(i).isThereHty()) missingHtD_HtYNegLeaf1->Fill(intHtMissD->at(i).hty());
00809                 if(intHtMissD->at(i).capBlock() == 0x701 && intHtMissD->at(i).capIndex() == 1 && intHtMissD->at(i).isThereHty()) missingHtD_HtYNegLeaf2->Fill(intHtMissD->at(i).hty());
00810                 if(intHtMissD->at(i).capBlock() == 0x701 && intHtMissD->at(i).capIndex() == 2 && intHtMissD->at(i).isThereHty()) missingHtD_HtYNegLeaf3->Fill(intHtMissD->at(i).hty());       
00811               }
00812             }
00813           }
00814         }
00815       }
00816     }
00817 
00818     if((isMissingEError && doMissingETDebug_) || (isMissingHError && doMissingHTDebug_)) {
00819       plotMissingEErrors(missingEtD, missingEtE, missingHtD, missingHtE, caloRegions, intJetsE, intHtMissD);
00820     }
00821 
00822   }
00823 
00824 }
00825 
00826 
00827 // ------------ method called once each job just before starting event loop  ------------
00828 void 
00829 GctErrorAnalyzer::beginJob()
00830 {
00831 }
00832 
00833 // ------------ method called once each job just after ending the event loop  ------------
00834 void 
00835 GctErrorAnalyzer::endJob() {
00836 }
00837 
00838 void
00839 GctErrorAnalyzer::plotRCTRegions(const edm::Handle<L1CaloRegionCollection> &caloRegions) {
00840   //if more than one Bx is readout per event, then caloRegions->size() will be some multiple of 396
00841   for(unsigned int i=0;i < caloRegions->size();i++) {
00842     //if the RCTMBx flag is set to true, write out all the info into the same histogram
00843     //otherwise only the RCTTrigBx will be written out - could skip (RCT_REGION_QUANTA-1) events here to speed things up...
00844     if(doRCTMBx_ || caloRegions->at(i).bx() == RCTTrigBx_) {
00845       if(caloRegions->at(i).et()>0) RCT_EtEtaPhi_->Fill(caloRegions->at(i).gctEta(),caloRegions->at(i).gctPhi(),caloRegions->at(i).et());
00846       if(caloRegions->at(i).tauVeto()) RCT_TvEtaPhi_->Fill(caloRegions->at(i).gctEta(),caloRegions->at(i).gctPhi());
00847       if(caloRegions->at(i).fineGrain()) RCT_FgEtaPhi_->Fill(caloRegions->at(i).gctEta(),caloRegions->at(i).gctPhi());
00848       if(caloRegions->at(i).overFlow()) RCT_OfEtaPhi_->Fill(caloRegions->at(i).gctEta(),caloRegions->at(i).gctPhi());
00849     }
00850   }
00851 }
00852 
00853 void
00854 GctErrorAnalyzer::plotIsoEm(const edm::Handle<L1GctEmCandCollection> &isoEgD, const edm::Handle<L1GctEmCandCollection> &isoEgE) {
00855   //loop over all the data candidates - if multiple bx, then this should be a multiple of GCT_OBJECT_QUANTA
00856   for (unsigned int i=0; i < isoEgD->size(); i++) {
00857     //if the GCTMBx flag is set, plot all Bx for this quantity, otherwise only plot Bx = GCTTrigBx_
00858     if(doGCTMBx_ || isoEgD->at(i).bx() == GCTTrigBx_) {
00859       isoEgD_Rank_->Fill(isoEgD->at(i).rank());
00860       if(isoEgD->at(i).rank()>0) {
00861         isoEgD_EtEtaPhi_->Fill(isoEgD->at(i).regionId().ieta(), isoEgD->at(i).regionId().iphi(), isoEgD->at(i).rank());
00862         isoEgD_OccEtaPhi_->Fill(isoEgD->at(i).regionId().ieta(), isoEgD->at(i).regionId().iphi());
00863       }
00864     }
00865   }
00866   //now repeat for the emulator candidates
00867   for(unsigned int i=0; i < isoEgE->size(); i++) {
00868     if(doEmuMBx_ || isoEgE->at(i).bx() == EmuTrigBx_) {
00869       isoEgE_Rank_->Fill(isoEgE->at(i).rank());
00870       if(isoEgE->at(i).rank()>0) {
00871         isoEgE_EtEtaPhi_->Fill(isoEgE->at(i).regionId().ieta(), isoEgE->at(i).regionId().iphi(), isoEgE->at(i).rank());
00872         isoEgE_OccEtaPhi_->Fill(isoEgE->at(i).regionId().ieta(), isoEgE->at(i).regionId().iphi());
00873       }
00874     }
00875   }
00876 }
00877 
00878 void
00879 GctErrorAnalyzer::plotNonIsoEm(const edm::Handle<L1GctEmCandCollection> &nonIsoEgD, const edm::Handle<L1GctEmCandCollection> &nonIsoEgE) {
00880   //loop over all the data candidates - if multiple bx, then this should be a multiple of GCT_OBJECT_QUANTA
00881   for (unsigned int i=0; i < nonIsoEgD->size(); i++) {
00882     //if the GCTMBx flag is set, plot all Bx for this quantity, otherwise only plot Bx = GCTTrigBx_
00883     if(doGCTMBx_ || nonIsoEgD->at(i).bx() == GCTTrigBx_) {
00884       nonIsoEgD_Rank_->Fill(nonIsoEgD->at(i).rank());
00885       if(nonIsoEgD->at(i).rank()>0) {
00886         nonIsoEgD_EtEtaPhi_->Fill(nonIsoEgD->at(i).regionId().ieta(), nonIsoEgD->at(i).regionId().iphi(), nonIsoEgD->at(i).rank());
00887         nonIsoEgD_OccEtaPhi_->Fill(nonIsoEgD->at(i).regionId().ieta(), nonIsoEgD->at(i).regionId().iphi());
00888       }
00889     }
00890   }
00891   //now repeat for the emulator candidates
00892   for(unsigned int i=0; i < nonIsoEgE->size(); i++) {
00893     if(doEmuMBx_ || nonIsoEgE->at(i).bx() == EmuTrigBx_) {
00894       nonIsoEgE_Rank_->Fill(nonIsoEgE->at(i).rank());
00895       if(nonIsoEgE->at(i).rank()>0) {
00896         nonIsoEgE_EtEtaPhi_->Fill(nonIsoEgE->at(i).regionId().ieta(), nonIsoEgE->at(i).regionId().iphi(), nonIsoEgE->at(i).rank());
00897         nonIsoEgE_OccEtaPhi_->Fill(nonIsoEgE->at(i).regionId().ieta(), nonIsoEgE->at(i).regionId().iphi());
00898       }
00899     }
00900   }
00901 }
00902 
00903 void
00904 GctErrorAnalyzer::plotEGErrors(const edm::Handle<L1GctEmCandCollection> &isoEgD, const edm::Handle<L1GctEmCandCollection> &isoEgE, const edm::Handle<L1GctEmCandCollection> &nonIsoEgD, const edm::Handle<L1GctEmCandCollection> &nonIsoEgE, const edm::Handle<L1CaloEmCollection> &emRegions) {
00905 
00906   std::string errorDirName = "err_";
00907   if(isIsoError) errorDirName.append("I"); 
00908   if(isNonIsoError) errorDirName.append("N"); 
00909   std::stringstream caseNumber;
00910   caseNumber << eventNumber;
00911   errorDirName.append(caseNumber.str());
00912   TFileDirectory errorDir = errorHistCat.at(0).mkdir(errorDirName);
00913 
00914   TH2I *errorEmRegionIsoEtEtaPhi_ = errorDir.make<TH2I>("errorEmRegionIsoEtEtaPhi", "errorEmRegionIsoEtEtaPhi;#eta (GCT Units);#phi (GCT Units)",22, -0.5, 21.5, 18, -0.5, 17.5);
00915   TH2I *errorEmRegionNonIsoEtEtaPhi_ = errorDir.make<TH2I>("errorEmRegionNonIsoEtEtaPhi", "errorEmRegionNonIsoEtEtaPhi;#eta (GCT Units);#phi (GCT Units)",22, -0.5, 21.5, 18, -0.5, 17.5);
00916   TH2I *errorIsoEtEtaPhiD_ = errorDir.make<TH2I>("errorIsoEtEtaPhiD", "errorIsoEtEtaPhiD;#eta (GCT Units);#phi (GCT Units)",22, -0.5, 21.5, 18, -0.5, 17.5);
00917   TH2I *errorNonIsoEtEtaPhiD_ = errorDir.make<TH2I>("errorNonIsoEtEtaPhiD", "errorNonIsoEtEtaPhiD;#eta (GCT Units);#phi (GCT Units)",22, -0.5, 21.5, 18, -0.5, 17.5);
00918   TH2I *errorIsoEtEtaPhiE_ = errorDir.make<TH2I>("errorIsoEtEtaPhiE", "errorIsoEtEtaPhiE;#eta (GCT Units);#phi (GCT Units)",22, -0.5, 21.5, 18, -0.5, 17.5);
00919   TH2I *errorNonIsoEtEtaPhiE_ = errorDir.make<TH2I>("errorNonIsoEtEtaPhiE", "errorNonIsoEtEtaPhiE;#eta (GCT Units);#phi (GCT Units)",22, -0.5, 21.5, 18, -0.5, 17.5);
00920 
00921   //fill the EM input collection
00922   //should only fill the correct bx for emRegions - and since this is showing an error in the comparison, we should plot the input to this comparison i.e. Bx=RCTTrigBx
00923   //this assumes that comparison is done on the central Bx i.e. RctBx=0 corresponds to GctBx=0, and EmuBx=0 takes RctBx=0
00924   for(unsigned int i=0;i < emRegions->size();i++) {
00925     if(emRegions->at(i).bx() == RCTTrigBx_) {
00926       if(emRegions->at(i).isolated()) {
00927         if(emRegions->at(i).rank()>0) errorEmRegionIsoEtEtaPhi_->Fill(emRegions->at(i).regionId().ieta(),emRegions->at(i).regionId().iphi(),emRegions->at(i).rank());
00928       }
00929       else{
00930         if(emRegions->at(i).rank()>0) errorEmRegionNonIsoEtEtaPhi_->Fill(emRegions->at(i).regionId().ieta(),emRegions->at(i).regionId().iphi(),emRegions->at(i).rank());
00931       }
00932     }
00933   }
00934       
00935   //no need to have the rank plot, because you can't have two electrons in the same place (eta,phi), in the same event...
00936   //in this case, since we're actually comparing the GCTTrigBx_ with the EmuTrigBx_, we plot these individually
00937   for(unsigned int i=0; i < isoEgD->size(); i++) {
00938     if(isoEgD->at(i).bx() == GCTTrigBx_) {
00939       if(isoEgD->at(i).rank()>0) errorIsoEtEtaPhiD_->Fill(isoEgD->at(i).regionId().ieta(),isoEgD->at(i).regionId().iphi(),isoEgD->at(i).rank());
00940     }
00941   }
00942   for(unsigned int i=0; i < nonIsoEgD->size(); i++) {
00943     if(nonIsoEgD->at(i).bx() == GCTTrigBx_) {
00944       if(nonIsoEgD->at(i).rank()>0) errorNonIsoEtEtaPhiD_->Fill(nonIsoEgD->at(i).regionId().ieta(),nonIsoEgD->at(i).regionId().iphi(),nonIsoEgD->at(i).rank());
00945     }
00946   }
00947 
00948   //now for the emulator candidates
00949   for(unsigned int i=0; i < isoEgE->size(); i++) {
00950     if(isoEgE->at(i).bx() == EmuTrigBx_) {
00951       if(isoEgE->at(i).rank()>0) errorIsoEtEtaPhiE_->Fill(isoEgE->at(i).regionId().ieta(),isoEgE->at(i).regionId().iphi(),isoEgE->at(i).rank());
00952     }
00953   }
00954   for(unsigned int i=0; i < nonIsoEgE->size(); i++) {
00955     if(nonIsoEgE->at(i).bx() == EmuTrigBx_) {
00956       if(nonIsoEgE->at(i).rank()>0) errorNonIsoEtEtaPhiE_->Fill(nonIsoEgE->at(i).regionId().ieta(),nonIsoEgE->at(i).regionId().iphi(),nonIsoEgE->at(i).rank());
00957     }
00958   }
00959 }
00960 
00961 void
00962 GctErrorAnalyzer::plotCenJets(const edm::Handle<L1GctJetCandCollection> &cenJetsD, const edm::Handle<L1GctJetCandCollection> &cenJetsE) {
00963 
00964   for (unsigned int i=0; i < cenJetsD->size(); i++) {
00965     if(doGCTMBx_ || cenJetsD->at(i).bx() == GCTTrigBx_) {
00966       cenJetD_Rank_->Fill(cenJetsD->at(i).rank());
00967       if(cenJetsD->at(i).rank()>0) {
00968         cenJetD_EtEtaPhi_->Fill(cenJetsD->at(i).regionId().ieta(),cenJetsD->at(i).regionId().iphi(),cenJetsD->at(i).rank());
00969         cenJetD_OccEtaPhi_->Fill(cenJetsD->at(i).regionId().ieta(),cenJetsD->at(i).regionId().iphi());
00970       }
00971     }
00972   }
00973 
00974   for(unsigned int i=0;  i < cenJetsE->size(); i++) {
00975     if(doEmuMBx_ || cenJetsE->at(i).bx() == EmuTrigBx_) {
00976       cenJetE_Rank_->Fill(cenJetsE->at(i).rank());
00977       if(cenJetsE->at(i).rank()>0) {
00978         cenJetE_EtEtaPhi_->Fill(cenJetsE->at(i).regionId().ieta(),cenJetsE->at(i).regionId().iphi(),cenJetsE->at(i).rank());
00979         cenJetE_OccEtaPhi_->Fill(cenJetsE->at(i).regionId().ieta(),cenJetsE->at(i).regionId().iphi());
00980       }
00981     }
00982   }
00983 }
00984 
00985 void
00986 GctErrorAnalyzer::plotTauJets(const edm::Handle<L1GctJetCandCollection> &tauJetsD, const edm::Handle<L1GctJetCandCollection> &tauJetsE) {
00987 
00988   for (unsigned int i=0; i < tauJetsD->size(); i++) {
00989     if(doGCTMBx_ || tauJetsD->at(i).bx() == GCTTrigBx_) {
00990       tauJetD_Rank_->Fill(tauJetsD->at(i).rank());
00991       if(tauJetsD->at(i).rank()>0) {
00992         tauJetD_EtEtaPhi_->Fill(tauJetsD->at(i).regionId().ieta(),tauJetsD->at(i).regionId().iphi(),tauJetsD->at(i).rank());
00993         tauJetD_OccEtaPhi_->Fill(tauJetsD->at(i).regionId().ieta(),tauJetsD->at(i).regionId().iphi());
00994       }
00995     }
00996   }
00997 
00998   for(unsigned int i=0; i < tauJetsE->size(); i++) {
00999     if(doEmuMBx_ || tauJetsE->at(i).bx() == EmuTrigBx_) {
01000       tauJetE_Rank_->Fill(tauJetsE->at(i).rank());
01001       if(tauJetsE->at(i).rank()>0) {
01002         tauJetE_EtEtaPhi_->Fill(tauJetsE->at(i).regionId().ieta(),tauJetsE->at(i).regionId().iphi(),tauJetsE->at(i).rank());
01003         tauJetE_OccEtaPhi_->Fill(tauJetsE->at(i).regionId().ieta(),tauJetsE->at(i).regionId().iphi());
01004       }
01005     }
01006   }
01007 }
01008 
01009 void
01010 GctErrorAnalyzer::plotForJets(const edm::Handle<L1GctJetCandCollection> &forJetsD, const edm::Handle<L1GctJetCandCollection> &forJetsE) {
01011 
01012   for (unsigned int i=0; i < forJetsD->size(); i++) {
01013     if(doGCTMBx_ || forJetsD->at(i).bx() == GCTTrigBx_) {
01014       forJetD_Rank_->Fill(forJetsD->at(i).rank());
01015       if(forJetsD->at(i).rank()>0) {
01016         forJetD_EtEtaPhi_->Fill(forJetsD->at(i).regionId().ieta(),forJetsD->at(i).regionId().iphi(),forJetsD->at(i).rank());
01017         forJetD_OccEtaPhi_->Fill(forJetsD->at(i).regionId().ieta(),forJetsD->at(i).regionId().iphi());
01018       }
01019     }
01020   }
01021 
01022   for(unsigned int i=0; i < forJetsE->size(); i++) {
01023     if(doEmuMBx_ || forJetsE->at(i).bx() == EmuTrigBx_) {
01024       forJetE_Rank_->Fill(forJetsE->at(i).rank());
01025       if(forJetsE->at(i).rank()>0) {
01026         forJetE_EtEtaPhi_->Fill(forJetsE->at(i).regionId().ieta(),forJetsE->at(i).regionId().iphi(),forJetsE->at(i).rank());
01027         forJetE_OccEtaPhi_->Fill(forJetsE->at(i).regionId().ieta(),forJetsE->at(i).regionId().iphi());
01028       }
01029     }
01030   }
01031 }
01032 
01033 void
01034 GctErrorAnalyzer::plotIntJets(const edm::Handle<L1GctInternJetDataCollection> &intJetsE) {
01035 
01036   jetData intJet;
01037   std::vector<jetData> intJetCollection(NUM_INT_JETS); //define fixed size for the vector to avoid reallocation (i.e. max size possible)
01038 
01039   //since we don't read out the intermediate (i.e. leaf card) jets, we can only plot the emulator distributions
01040   //the 1st-4th jet Et will prove useful in understanding and motivating cuts on individual jets in HT and MHT.
01041   for(unsigned int i=0; i < intJetsE->size(); i++) {
01042 
01043     if(doEmuMBx_ || intJetsE->at(i).bx() == EmuTrigBx_) {
01044 
01045       //the intermediate jets are not sorted in terms of Et so
01046       //in order to do this independently of the data format,
01047       //copy to a user defined struct and sort that way
01048       intJet.et = intJetsE->at(i).et();
01049       intJet.phi = intJetsE->at(i).phi();
01050       intJet.eta = intJetsE->at(i).eta();
01051       intJetCollection.at(i % NUM_INT_JETS) = intJet;
01052 
01053       //remember, if the event has 1 overflowed jet, then we fill the internal jet dist overflow histogram
01054       //and skip the event - there is no point looking at the leading jet distributions etc for an event
01055       //with an overflowed jet - this will imply HT, ET, MET and MHT all overflow too.
01056       if(intJetsE->at(i).oflow()) {
01057         intJetE_Of_->Fill(intJetsE->at(i).oflow());
01058         return;
01059       }
01060 
01061       //plot the (et,eta,phi) distribution of the intermediate jets (for non-zero et)
01062       if(intJetsE->at(i).et()) intJetEtEtaPhiE_->Fill(intJetsE->at(i).regionId().ieta(),intJetsE->at(i).regionId().iphi(),intJetsE->at(i).et());
01063 
01064     }
01065   }
01066 
01067   //if we get this far, there are no jets with an overflow bit so fill the overflow histogram and
01068   //sort the intJetCollection according to the rule defined in sortJets (i.e. largest et first)
01069   intJetE_Of_->Fill(0);
01070   std::sort(intJetCollection.begin(), intJetCollection.end(), sortJets);
01071 
01072   std::vector<TH1I *> leadingJetDist(4);
01073   leadingJetDist.at(0) = intJetE_Jet1Et_;
01074   leadingJetDist.at(1) = intJetE_Jet2Et_;
01075   leadingJetDist.at(2) = intJetE_Jet3Et_;
01076   leadingJetDist.at(3) = intJetE_Jet4Et_;
01077 
01078   unsigned int i=0;
01079   unsigned int j=0;
01080   unsigned int currentEt=0;
01081   while(intJetCollection.at(i).et > 0) {
01082 
01083     if(j < leadingJetDist.size()) {
01084       if(i == 0) {
01085         leadingJetDist.at(j)->Fill(intJetCollection.at(i).et);
01086         currentEt = intJetCollection.at(i).et;
01087         j++;
01088       } else {
01089         if(intJetCollection.at(i).et < currentEt) {
01090           leadingJetDist.at(j)->Fill(intJetCollection.at(i).et);
01091           currentEt = intJetCollection.at(i).et;
01092           j++;
01093         }
01094       }
01095     }
01096 
01097     intJetE_Et_->Fill(intJetCollection.at(i).et);
01098     i++;
01099   }
01100   return;
01101 
01102 }
01103 
01104 bool 
01105 GctErrorAnalyzer::sortJets(const jetData &jet1, const jetData &jet2) {
01106   return jet1.et > jet2.et;
01107 }
01108 
01109 template<class T> 
01110 bool 
01111 GctErrorAnalyzer::checkCollections(const T &collection, const unsigned int &constraint, const std::string &label) {
01112 
01113   //unfortunately, the dataformats are not consistent with the name() method (i.e. some have it, others don't)
01114   //and a typeof() function doesn't exist in ANSI C++, so to identify the templated type, we pass a std::string
01115 
01116   if(!collection.isValid()) {
01117     edm::LogWarning("DataNotFound") << " Could not find " << label << " label";
01118     return false;
01119   }
01120   if(collection->size() % constraint != 0 || collection->size() == 0) {
01121     edm::LogWarning("CollectionSizeError") << " " << label << " collection size is " << collection->size() << ", expected multiple of " << constraint;
01122     return false;
01123   }
01124 
01125   return true;
01126 }
01127 
01128 void
01129 GctErrorAnalyzer::plotJetErrors(const edm::Handle<L1GctJetCandCollection> &cenJetsD, const edm::Handle<L1GctJetCandCollection> &cenJetsE, const edm::Handle<L1GctJetCandCollection> &tauJetsD, const edm::Handle<L1GctJetCandCollection> &tauJetsE, const edm::Handle<L1GctJetCandCollection> &forJetsD, const edm::Handle<L1GctJetCandCollection> &forJetsE, const edm::Handle<L1CaloRegionCollection> &caloRegions) {
01130 
01131   std::string errorDirName = "err_";
01132   if(isCenJetError) errorDirName.append("C"); 
01133   if(isTauJetError) errorDirName.append("T"); 
01134   if(isForJetError) errorDirName.append("F"); 
01135   std::stringstream caseNumber;
01136   caseNumber << eventNumber;
01137   errorDirName.append(caseNumber.str());
01138   TFileDirectory errorDir = errorHistCat.at(1).mkdir(errorDirName);
01139 
01140   TH2I *errorRegionEtEtaPhi_ = errorDir.make<TH2I>("errorRegionEtEtaPhi", "errorRegionEtEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
01141   TH2I *errorRegionTvEtaPhi_ = errorDir.make<TH2I>("errorRegionTvEtaPhi", "errorRegionTvEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
01142   TH2I *errorRegionOfEtaPhi_ = errorDir.make<TH2I>("errorRegionOfEtaPhi", "errorRegionOfEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
01143 
01144   //make sure to only plot the caloRegion bx which corresponds to the data vs emulator comparison
01145   for(unsigned int i=0;i<caloRegions->size();i++) {
01146     if(caloRegions->at(i).bx() == RCTTrigBx_) {
01147       if(caloRegions->at(i).et()>0) errorRegionEtEtaPhi_->Fill(caloRegions->at(i).gctEta(),caloRegions->at(i).gctPhi(),caloRegions->at(i).et());
01148       if(caloRegions->at(i).tauVeto()) errorRegionTvEtaPhi_->Fill(caloRegions->at(i).gctEta(),caloRegions->at(i).gctPhi());
01149       if(caloRegions->at(i).overFlow()) errorRegionOfEtaPhi_->Fill(caloRegions->at(i).gctEta(),caloRegions->at(i).gctPhi());
01150     }
01151   }
01152       
01153   TH2I *cenJet_errorEtEtaPhiData_ = errorDir.make<TH2I>("cenJet_errorEtEtaPhiData", "cenJet_errorEtEtaPhiData;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5); 
01154   TH2I *cenJet_errorEtEtaPhiEmu_ = errorDir.make<TH2I>("cenJet_errorEtEtaPhiEmu", "cenJet_errorEtEtaPhiEmu;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
01155   TH2I *tauJet_errorEtEtaPhiData_ = errorDir.make<TH2I>("tauJet_errorEtEtaPhiData", "tauJet_errorEtEtaPhiData;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
01156   TH2I *tauJet_errorEtEtaPhiEmu_ = errorDir.make<TH2I>("tauJet_errorEtEtaPhiEmu", "tauJet_errorEtEtaPhiEmu;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
01157   TH2I *forJet_errorEtEtaPhiData_ = errorDir.make<TH2I>("forJet_errorEtEtaPhiData", "forJet_errorEtEtaPhiData;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
01158   TH2I *forJet_errorEtEtaPhiEmu_ = errorDir.make<TH2I>("forJet_errorEtEtaPhiEmu", "forJet_errorEtEtaPhiEmu;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
01159         
01160   //first plot the data candiates for the Trigger Bx that this error corresponds to
01161   for(unsigned int i=0; i < cenJetsD->size(); i++) {
01162     if(cenJetsD->at(i).bx() == GCTTrigBx_) {
01163       if(cenJetsD->at(i).rank()>0) cenJet_errorEtEtaPhiData_->Fill(cenJetsD->at(i).regionId().ieta(),cenJetsD->at(i).regionId().iphi(),cenJetsD->at(i).rank());
01164     }
01165   }
01166   for(unsigned int i=0; i < tauJetsD->size(); i++) {
01167     if(tauJetsD->at(i).bx() == GCTTrigBx_) {
01168       if(tauJetsD->at(i).rank()>0) tauJet_errorEtEtaPhiData_->Fill(tauJetsD->at(i).regionId().ieta(),tauJetsD->at(i).regionId().iphi(),tauJetsD->at(i).rank());
01169     }
01170   }
01171   for(unsigned int i=0; i < forJetsD->size(); i++) {
01172     if(forJetsD->at(i).bx() == GCTTrigBx_) {
01173       if(forJetsD->at(i).rank()>0) forJet_errorEtEtaPhiData_->Fill(forJetsD->at(i).regionId().ieta(),forJetsD->at(i).regionId().iphi(),forJetsD->at(i).rank());
01174     }
01175   }
01176 
01177   //now the emulator candidates
01178   for(unsigned int i=0; i < cenJetsE->size(); i++) {
01179     if(cenJetsE->at(i).bx() == EmuTrigBx_) {
01180       if(cenJetsE->at(i).rank()>0) cenJet_errorEtEtaPhiEmu_->Fill(cenJetsE->at(i).regionId().ieta(),cenJetsE->at(i).regionId().iphi(),cenJetsE->at(i).rank());
01181     }
01182   }
01183   for(unsigned int i=0; i < tauJetsE->size(); i++) {
01184     if(tauJetsE->at(i).bx() == EmuTrigBx_) {
01185       if(tauJetsE->at(i).rank()>0) tauJet_errorEtEtaPhiEmu_->Fill(tauJetsE->at(i).regionId().ieta(),tauJetsE->at(i).regionId().iphi(),tauJetsE->at(i).rank());
01186     }
01187   }
01188   for(unsigned int i=0; i < forJetsE->size(); i++) {
01189     if(forJetsE->at(i).bx() == EmuTrigBx_) {
01190       if(forJetsE->at(i).rank()>0) forJet_errorEtEtaPhiEmu_->Fill(forJetsE->at(i).regionId().ieta(),forJetsE->at(i).regionId().iphi(),forJetsE->at(i).rank());
01191     }
01192   }
01193 
01194 }
01195 
01196 void
01197 GctErrorAnalyzer::plotHFRingSums(const edm::Handle<L1GctHFRingEtSumsCollection> &hfRingSumsD, const edm::Handle<L1GctHFRingEtSumsCollection> &hfRingSumsE) {
01198 
01199   for(unsigned int i=0; i < hfRingSumsD->size(); i++) {
01200     if(doGCTMBx_ || hfRingSumsD->at(i).bx() == GCTTrigBx_) {
01201       //there are 4 rings - just fill the histograms
01202       hfRingSumD_1pos_->Fill(hfRingSumsD->at(i).etSum(0));
01203       hfRingSumD_1neg_->Fill(hfRingSumsD->at(i).etSum(1));
01204       hfRingSumD_2pos_->Fill(hfRingSumsD->at(i).etSum(2));
01205       hfRingSumD_2neg_->Fill(hfRingSumsD->at(i).etSum(3));
01206     }
01207   }
01208 
01209   for(unsigned int i=0; i < hfRingSumsE->size(); i++) {
01210     if(doEmuMBx_ || hfRingSumsE->at(i).bx() == EmuTrigBx_) {
01211       hfRingSumE_1pos_->Fill(hfRingSumsE->at(i).etSum(0));
01212       hfRingSumE_1neg_->Fill(hfRingSumsE->at(i).etSum(1));
01213       hfRingSumE_2pos_->Fill(hfRingSumsE->at(i).etSum(2));
01214       hfRingSumE_2neg_->Fill(hfRingSumsE->at(i).etSum(3));
01215     }
01216   }
01217 }
01218 
01219 void
01220 GctErrorAnalyzer::plotHFBitCounts(const edm::Handle<L1GctHFBitCountsCollection> &hfBitCountsD, const edm::Handle<L1GctHFBitCountsCollection> &hfBitCountsE) {
01221 
01222   for(unsigned int i=0; i < hfBitCountsD->size(); i++) {
01223     if(doGCTMBx_ || hfBitCountsD->at(i).bx() == GCTTrigBx_) {
01224       //there are 4 rings - just fill the histograms
01225       hfBitCountD_1pos_->Fill(hfBitCountsD->at(i).bitCount(0));
01226       hfBitCountD_1neg_->Fill(hfBitCountsD->at(i).bitCount(1));
01227       hfBitCountD_2pos_->Fill(hfBitCountsD->at(i).bitCount(2));
01228       hfBitCountD_2neg_->Fill(hfBitCountsD->at(i).bitCount(3));
01229     }
01230   }
01231   for(unsigned int i=0; i < hfBitCountsE->size(); i++) {
01232     if(doEmuMBx_ || hfBitCountsE->at(i).bx() == EmuTrigBx_) {
01233       hfBitCountE_1pos_->Fill(hfBitCountsE->at(i).bitCount(0));
01234       hfBitCountE_1neg_->Fill(hfBitCountsE->at(i).bitCount(1));
01235       hfBitCountE_2pos_->Fill(hfBitCountsE->at(i).bitCount(2));
01236       hfBitCountE_2neg_->Fill(hfBitCountsE->at(i).bitCount(3));
01237     }
01238   }
01239 }
01240 
01241 void
01242 GctErrorAnalyzer::plotHFErrors(const edm::Handle<L1GctHFRingEtSumsCollection> &hfRingSumsD, const edm::Handle<L1GctHFRingEtSumsCollection> &hfRingSumsE, const edm::Handle<L1GctHFBitCountsCollection> &hfBitCountsD, const edm::Handle<L1GctHFBitCountsCollection> &hfBitCountsE, const edm::Handle<L1CaloRegionCollection> &caloRegions) {
01243 
01244   std::string errorDirName = "err_";
01245   if(isRingSumError) errorDirName.append("R"); 
01246   if(isBitCountError) errorDirName.append("B"); 
01247   std::stringstream caseNumber;
01248   caseNumber << eventNumber;
01249   errorDirName.append(caseNumber.str());
01250   TFileDirectory errorDir = errorHistCat.at(2).mkdir(errorDirName);
01251 
01252   TH2I *errorRegionEtEtaPhi_ = errorDir.make<TH2I>("errorRegionEtEtaPhi", "errorRegionEtEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
01253   TH2I *errorRegionFgEtaPhi_ = errorDir.make<TH2I>("errorRegionFgEtaPhi", "errorRegionFgEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
01254   TH2I *errorRegionOfEtaPhi_ = errorDir.make<TH2I>("errorRegionOfEtaPhi", "errorRegionOfEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
01255 
01256   TH1I *errorHFRingSumD_1pos_ = errorDir.make<TH1I>("errorHFRingSumD_1+", "errorHFRingSumD_1+;Rank;Number of Events", 8, -0.5, 7.5);
01257   TH1I *errorHFRingSumD_2pos_ = errorDir.make<TH1I>("errorHFRingSumD_2+", "errorHFRingSumD_2+;Rank;Number of Events", 8, -0.5, 7.5);
01258   TH1I *errorHFRingSumD_1neg_ = errorDir.make<TH1I>("errorHFRingSumD_1-", "errorHFRingSumD_1-;Rank;Number of Events", 8, -0.5, 7.5);
01259   TH1I *errorHFRingSumD_2neg_ = errorDir.make<TH1I>("errorHFRingSumD_2-", "errorHFRingSumD_2-;Rank;Number of Events", 8, -0.5, 7.5);
01260   TH1I *errorHFRingSumE_1pos_ = errorDir.make<TH1I>("errorHFRingSumE_1+", "errorHFRingSumE_1+;Rank;Number of Events", 8, -0.5, 7.5);
01261   TH1I *errorHFRingSumE_2pos_ = errorDir.make<TH1I>("errorHFRingSumE_2+", "errorHFRingSumE_2+;Rank;Number of Events", 8, -0.5, 7.5);
01262   TH1I *errorHFRingSumE_1neg_ = errorDir.make<TH1I>("errorHFRingSumE_1-", "errorHFRingSumE_1-;Rank;Number of Events", 8, -0.5, 7.5);
01263   TH1I *errorHFRingSumE_2neg_ = errorDir.make<TH1I>("errorHFRingSumE_2-", "errorHFRingSumE_2-;Rank;Number of Events", 8, -0.5, 7.5);
01264 
01265   TH1I *errorHFBitCountD_1pos_ = errorDir.make<TH1I>("errorHFBitCountD_1+", "errorHFBitCountD_1+;Rank;Number of Events", 8, -0.5, 7.5);
01266   TH1I *errorHFBitCountD_2pos_ = errorDir.make<TH1I>("errorHFBitCountD_2+", "errorHFBitCountD_2+;Rank;Number of Events", 8, -0.5, 7.5);
01267   TH1I *errorHFBitCountD_1neg_ = errorDir.make<TH1I>("errorHFBitCountD_1-", "errorHFBitCountD_1-;Rank;Number of Events", 8, -0.5, 7.5);
01268   TH1I *errorHFBitCountD_2neg_ = errorDir.make<TH1I>("errorHFBitCountD_2-", "errorHFBitCountD_2-;Rank;Number of Events", 8, -0.5, 7.5);
01269   TH1I *errorHFBitCountE_1pos_ = errorDir.make<TH1I>("errorHFBitCountE_1+", "errorHFBitCountE_1+;Rank;Number of Events", 8, -0.5, 7.5);
01270   TH1I *errorHFBitCountE_2pos_ = errorDir.make<TH1I>("errorHFBitCountE_2+", "errorHFBitCountE_2+;Rank;Number of Events", 8, -0.5, 7.5);
01271   TH1I *errorHFBitCountE_1neg_ = errorDir.make<TH1I>("errorHFBitCountE_1-", "errorHFBitCountE_1-;Rank;Number of Events", 8, -0.5, 7.5);
01272   TH1I *errorHFBitCountE_2neg_ = errorDir.make<TH1I>("errorHFBitCountE_2-", "errorHFBitCountE_2-;Rank;Number of Events", 8, -0.5, 7.5);
01273 
01274   for(unsigned int i=0;i<caloRegions->size();i++) {
01275     if(caloRegions->at(i).bx() == RCTTrigBx_) {
01276       if(caloRegions->at(i).et()>0) errorRegionEtEtaPhi_->Fill(caloRegions->at(i).gctEta(),caloRegions->at(i).gctPhi(),caloRegions->at(i).et());
01277       if(caloRegions->at(i).fineGrain()) errorRegionFgEtaPhi_->Fill(caloRegions->at(i).gctEta(),caloRegions->at(i).gctPhi());
01278       if(caloRegions->at(i).overFlow()) errorRegionOfEtaPhi_->Fill(caloRegions->at(i).gctEta(),caloRegions->at(i).gctPhi());
01279     }
01280   }
01281        
01282   for(unsigned int i=0; i < hfRingSumsD->size(); i++) {
01283     if(hfRingSumsD->at(i).bx() == GCTTrigBx_) {
01284       errorHFRingSumD_1pos_->Fill(hfRingSumsD->at(i).etSum(0));
01285       errorHFRingSumD_1neg_->Fill(hfRingSumsD->at(i).etSum(1));
01286       errorHFRingSumD_2pos_->Fill(hfRingSumsD->at(i).etSum(2));
01287       errorHFRingSumD_2neg_->Fill(hfRingSumsD->at(i).etSum(3));
01288     }
01289   }
01290   for(unsigned int i=0; i < hfRingSumsE->size(); i++) {
01291     if(hfRingSumsE->at(i).bx() == EmuTrigBx_) {
01292       errorHFRingSumE_1pos_->Fill(hfRingSumsE->at(i).etSum(0));
01293       errorHFRingSumE_1neg_->Fill(hfRingSumsE->at(i).etSum(1));
01294       errorHFRingSumE_2pos_->Fill(hfRingSumsE->at(i).etSum(2));
01295       errorHFRingSumE_2neg_->Fill(hfRingSumsE->at(i).etSum(3));
01296     }
01297   }
01298 
01299   for(unsigned int i=0; i < hfBitCountsD->size(); i++) {
01300     if(hfBitCountsD->at(i).bx() == GCTTrigBx_) {
01301       errorHFBitCountD_1pos_->Fill(hfBitCountsD->at(i).bitCount(0));
01302       errorHFBitCountD_1neg_->Fill(hfBitCountsD->at(i).bitCount(1));
01303       errorHFBitCountD_2pos_->Fill(hfBitCountsD->at(i).bitCount(2));
01304       errorHFBitCountD_2neg_->Fill(hfBitCountsD->at(i).bitCount(3));
01305     }
01306   }
01307   for(unsigned int i=0; i < hfBitCountsE->size(); i++) {
01308     if(hfBitCountsE->at(i).bx() == EmuTrigBx_) {
01309       errorHFBitCountE_1pos_->Fill(hfBitCountsE->at(i).bitCount(0));
01310       errorHFBitCountE_1neg_->Fill(hfBitCountsE->at(i).bitCount(1));
01311       errorHFBitCountE_2pos_->Fill(hfBitCountsE->at(i).bitCount(2));
01312       errorHFBitCountE_2neg_->Fill(hfBitCountsE->at(i).bitCount(3));
01313     }
01314   }
01315 }
01316 
01317 void
01318 GctErrorAnalyzer::plotTotalE(const edm::Handle<L1GctEtTotalCollection> &totalEtD, const edm::Handle<L1GctEtTotalCollection> &totalEtE) {
01319 
01320   for(unsigned int i=0; i < totalEtD->size(); i++) {
01321     if(doGCTMBx_ || totalEtD->at(i).bx() == GCTTrigBx_) {
01322       totalEtD_Of_->Fill(totalEtD->at(i).overFlow());
01323       if(!totalEtD->at(i).overFlow()) totalEtD_->Fill(totalEtD->at(i).et());      
01324     }
01325   }
01326   for(unsigned int i=0; i < totalEtE->size(); i++) {
01327     if(doEmuMBx_ || totalEtE->at(i).bx() == EmuTrigBx_) {
01328       totalEtE_Of_->Fill(totalEtE->at(i).overFlow());
01329       if(!totalEtE->at(i).overFlow()) totalEtE_->Fill(totalEtE->at(i).et());
01330     } 
01331   }
01332 }
01333 
01334 void
01335 GctErrorAnalyzer::plotTotalH(const edm::Handle<L1GctEtHadCollection> &totalHtD, const edm::Handle<L1GctEtHadCollection> &totalHtE) {
01336 
01337   for(unsigned int i=0; i < totalHtD->size(); i++) {
01338     if(doGCTMBx_ || totalHtD->at(i).bx() == GCTTrigBx_) {
01339       totalHtD_Of_->Fill(totalHtD->at(i).overFlow());
01340       if(!totalHtD->at(i).overFlow()) totalHtD_->Fill(totalHtD->at(i).et());
01341     }
01342   }
01343   for(unsigned int i=0; i < totalHtE->size(); i++) {
01344     if(doEmuMBx_ || totalHtE->at(i).bx() == EmuTrigBx_) {
01345       totalHtE_Of_->Fill(totalHtE->at(i).overFlow());
01346       if(!totalHtE->at(i).overFlow()) totalHtE_->Fill(totalHtE->at(i).et());
01347     }
01348   }
01349 }
01350 
01351 void
01352 GctErrorAnalyzer::plotTotalEErrors(const edm::Handle<L1GctEtTotalCollection> &totalEtD, const edm::Handle<L1GctEtTotalCollection> &totalEtE, const edm::Handle<L1GctEtHadCollection> &totalHtD, const edm::Handle<L1GctEtHadCollection> &totalHtE, const edm::Handle<L1CaloRegionCollection> &caloRegions) {
01353 
01354   std::string errorDirName = "err_";
01355   if(isTotalEError) errorDirName.append("E");
01356   if(isTotalHError) errorDirName.append("H");
01357   std::stringstream caseNumber;
01358   caseNumber << eventNumber;
01359   errorDirName.append(caseNumber.str());
01360   TFileDirectory errorDir = errorHistCat.at(3).mkdir(errorDirName);
01361 
01362   TH2I *errorRegionEtEtaPhi_ = errorDir.make<TH2I>("errorRegionEtEtaPhi", "errorRegionEtEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
01363   TH2I *errorRegionOfEtaPhi_ = errorDir.make<TH2I>("errorRegionOfEtaPhi", "errorRegionOfEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
01364   TH1I *errorTotalEtD_ = errorDir.make<TH1I>("errorTotalEtD", "errorTotalEtD;E_{T};Number of Events", 1024, -0.5, 1023.5);
01365   TH1I *errorTotalEtD_Of_ = errorDir.make<TH1I>("errorTotalEtD_Of", "errorTotalEtD_Of;Overflow Bit Status;Number of Events", 2, -0.5, 1.5);
01366   TH1I *errorTotalEtE_ = errorDir.make<TH1I>("errorTotalEtE", "errorTotalEtE;E_{T};Number of Events", 1024, -0.5, 1023.5);
01367   TH1I *errorTotalEtE_Of_ = errorDir.make<TH1I>("errorTotalEtE_Of", "errorTotalEtE_Of;Overflow Bit Status;Number of Events", 2, -0.5, 1.5);
01368   TH1I *errorTotalHtD_ = errorDir.make<TH1I>("errorTotalHtD", "errorTotalHtD;E_{T};Number of Events", 1024, -0.5, 1023.5);
01369   TH1I *errorTotalHtD_Of_ = errorDir.make<TH1I>("errorTotalHtD_Of", "errorTotalHtD_Of;Overflow Bit Status;Number of Events", 2, -0.5, 1.5);
01370   TH1I *errorTotalHtE_ = errorDir.make<TH1I>("errorTotalHtE", "errorTotalHtE;E_{T};Number of Events", 1024, -0.5, 1023.5);
01371   TH1I *errorTotalHtE_Of_ = errorDir.make<TH1I>("errorTotalHtE_Of", "errorTotalHtE_Of;Overflow Bit Status;Number of Events", 2, -0.5, 1.5);
01372       
01373   //plot the region ET and OF bits
01374   for(unsigned int i=0;i<caloRegions->size();i++) {
01375     if(caloRegions->at(i).bx() == RCTTrigBx_) {
01376       if(caloRegions->at(i).et()>0) errorRegionEtEtaPhi_->Fill(caloRegions->at(i).gctEta(),caloRegions->at(i).gctPhi(),caloRegions->at(i).et());
01377       if(caloRegions->at(i).overFlow()) errorRegionOfEtaPhi_->Fill(caloRegions->at(i).gctEta(),caloRegions->at(i).gctPhi());
01378     }
01379   }
01380   //now plot the error ET
01381   for(unsigned int i=0; i < totalEtD->size(); i++) {
01382     if(totalEtD->at(i).bx() == GCTTrigBx_) {
01383       errorTotalEtD_Of_->Fill(totalEtD->at(i).overFlow());
01384       if(!totalEtD->at(i).overFlow()) errorTotalEtD_->Fill(totalEtD->at(i).et());
01385     }
01386   }
01387   for(unsigned int i=0; i < totalEtE->size(); i++) {
01388     if(totalEtE->at(i).bx() == EmuTrigBx_) {
01389       errorTotalEtE_Of_->Fill(totalEtE->at(i).overFlow());      
01390       if(!totalEtE->at(i).overFlow()) errorTotalEtE_->Fill(totalEtE->at(i).et());
01391     } 
01392   }
01393   //and now the error HT
01394   for(unsigned int i=0; i < totalHtD->size(); i++) {
01395     if(totalHtD->at(i).bx() == GCTTrigBx_) {
01396       errorTotalHtD_Of_->Fill(totalHtD->at(i).overFlow());
01397       if(!totalHtD->at(i).overFlow()) errorTotalHtD_->Fill(totalHtD->at(i).et());
01398     }
01399   }
01400   for(unsigned int i=0; i < totalHtE->size(); i++) {
01401     if(totalHtE->at(i).bx() == EmuTrigBx_) {
01402       errorTotalHtE_Of_->Fill(totalHtE->at(i).overFlow());
01403       if(!totalHtE->at(i).overFlow()) errorTotalHtE_->Fill(totalHtE->at(i).et());
01404     }
01405   }
01406 }
01407 
01408 void
01409 GctErrorAnalyzer::plotMissingEt(const edm::Handle<L1GctEtMissCollection> &missingEtD, const edm::Handle<L1GctEtMissCollection> &missingEtE) {
01410 
01411   for(unsigned int i=0; i < missingEtD->size(); i++) {
01412     if(doGCTMBx_ || missingEtD->at(i).bx() == GCTTrigBx_) {    
01413       missingEtD_Of_->Fill(missingEtD->at(i).overFlow());
01414       if(!missingEtD->at(i).overFlow() && missingEtD->at(i).et()>0) { 
01415         missingEtD_->Fill(missingEtD->at(i).et());
01416         missingEtD_Phi_->Fill(missingEtD->at(i).phi());
01417       }
01418     }
01419   }
01420   
01421   for(unsigned int i=0; i < missingEtE->size(); i++) {
01422     if(doEmuMBx_ || missingEtE->at(i).bx() == EmuTrigBx_) {
01423       missingEtE_Of_->Fill(missingEtE->at(i).overFlow());
01424       if(!missingEtE->at(i).overFlow() && missingEtE->at(i).et()) {
01425         missingEtE_->Fill(missingEtE->at(i).et());
01426         missingEtE_Phi_->Fill(missingEtE->at(i).phi());
01427       }
01428     }
01429   }
01430 }
01431 
01432 void
01433 GctErrorAnalyzer::plotMissingHt(const edm::Handle<L1GctHtMissCollection> &missingHtD, const edm::Handle<L1GctHtMissCollection> &missingHtE) {
01434 
01435   for(unsigned int i=0; i < missingHtD->size(); i++) {
01436     if(doGCTMBx_ || missingHtD->at(i).bx() == GCTTrigBx_) {
01437       missingHtD_Of_->Fill(missingHtD->at(i).overFlow());
01438       if(!missingHtD->at(i).overFlow() && missingHtD->at(i).et()>0) {
01439         missingHtD_->Fill(missingHtD->at(i).et());
01440         missingHtD_Phi_->Fill(missingHtD->at(i).phi());
01441       }
01442     }
01443   }
01444 
01445   for(unsigned int i=0; i < missingHtE->size(); i++) {
01446     if(doEmuMBx_ || missingHtE->at(i).bx() == EmuTrigBx_) {
01447       missingHtE_Of_->Fill(missingHtE->at(i).overFlow());
01448       if(!missingHtE->at(i).overFlow() && missingHtE->at(i).et()>0) {
01449         missingHtE_->Fill(missingHtE->at(i).et());
01450         missingHtE_Phi_->Fill(missingHtE->at(i).phi());
01451       }
01452     }
01453   }
01454 }
01455 
01456 void
01457 GctErrorAnalyzer::plotMissingEErrors(const edm::Handle<L1GctEtMissCollection> &missingEtD, const edm::Handle<L1GctEtMissCollection> &missingEtE, const edm::Handle<L1GctHtMissCollection> &missingHtD, const edm::Handle<L1GctHtMissCollection> &missingHtE, edm::Handle<L1CaloRegionCollection> &caloRegions, const edm::Handle<L1GctInternJetDataCollection> &intJetsE, const edm::Handle<L1GctInternHtMissCollection> intMissingHtD) {
01458 
01459   std::string errorDirName = "err_"; 
01460   if(isMissingEError) errorDirName.append("E");
01461   if(isMissingHError) errorDirName.append("H");
01462 
01463   //added 05.03.2010 to highlight overflow errors in the missing energy sum calculation
01464   for(unsigned int i=0; i < missingHtE->size(); i++) {
01465     if(missingHtE->at(i).bx() == EmuTrigBx_) {
01466       for(unsigned int j=0; j < missingHtD->size(); j++) {
01467         if(missingHtD->at(j).bx() == GCTTrigBx_) {
01468           if(missingHtD->at(j).overFlow() != missingHtE->at(i).overFlow()) errorDirName.append("O");
01469         }
01470       }  
01471     }
01472   }
01473 
01474   std::stringstream caseNumber;
01475   caseNumber << eventNumber;
01476   errorDirName.append(caseNumber.str());
01477   TFileDirectory errorDir = errorHistCat.at(4).mkdir(errorDirName);
01478 
01479   TH2I *errorRegionEtEtaPhi_ = errorDir.make<TH2I>("errorRegionEtEtaPhi", "errorRegionEtEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
01480   TH2I *errorRegionOfEtaPhi_ = errorDir.make<TH2I>("errorRegionOfEtaPhi", "errorRegionOfEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
01481   TH1I *errorMissingEtD_ = errorDir.make<TH1I>("errorMissingEtD", "errorMissingEtD;E_{T};Number of Events", 1024, -0.5, 1023.5);
01482   TH1I *errorMissingEtD_Of_ = errorDir.make<TH1I>("errorMissingEtD_Of", "errorMissingEtD_Of;Overflow Bit Status;Number of Events", 2, -0.5, 1.5);
01483   TH1I *errorMissingEtD_Phi_= errorDir.make<TH1I>("errorMissingEtD_Phi", "errorMissingEtD_Phi;Missing E_{T} #phi;Number of Events", 72, -0.5, 71.5);
01484   TH1I *errorMissingEtE_ = errorDir.make<TH1I>("errorMissingEtE", "errorMissingEtE;E_{T};Number of Events", 1024, -0.5, 1023.5);
01485   TH1I *errorMissingEtE_Of_ = errorDir.make<TH1I>("errorMissingEtE_Of", "errorMissingEtE_Of;Overflow Bit Status;Number of Events", 2, -0.5, 1.5);
01486   TH1I *errorMissingEtE_Phi_ = errorDir.make<TH1I>("errorMissingEtE_Phi", "errorMissingEtE_Phi;Missing E_{T} #phi;Number of Events", 72, -0.5, 71.5);
01487   TH1I *errorMissingHtD_ = errorDir.make<TH1I>("errorMissingHtD", "errorMissingHtD;H_{T};Number of Events", 1024, -0.5, 1023.5);
01488   TH1I *errorMissingHtD_Of_ = errorDir.make<TH1I>("errorMissingHtD_Of", "errorMissingHtD_Of;Overflow Bit Status;Number of Events", 2, -0.5, 1.5);
01489   TH1I *errorMissingHtD_Phi_= errorDir.make<TH1I>("errorMissingHtD_Phi", "errorMissingHtD_Phi;Missing H_{T} #phi;Number of Events", 72, -0.5, 71.5);
01490   TH1I *errorMissingHtE_ = errorDir.make<TH1I>("errorMissingHtE", "errorMissingHtE;H_{T};Number of Events", 1024, -0.5, 1023.5);
01491   TH1I *errorMissingHtE_Of_ = errorDir.make<TH1I>("errorMissingHtE_Of", "errorMissingHtE_Of;Overflow Bit Status;Number of Events", 2, -0.5, 1.5);
01492   TH1I *errorMissingHtE_Phi_ = errorDir.make<TH1I>("errorMissingHtE_Phi", "errorMissingHtE_Phi;Missing H_{T} #phi;Number of Events", 72, -0.5, 71.5);
01493 
01494   //Added 19.03.2010 to provide additional information in the case of missingHt failures
01495   //1. The MHT from both wheel inputs (i.e. the leaf cards)
01496   //2. The emulator jet et,eta,phi for all jets found in an event
01497   if(doExtraMissingHTDebug_) {
01498     if(checkCollections(intMissingHtD, GCT_INT_HTMISS_QUANTA, "Internal Missing Ht Data")) {
01499 
01500       TH1I *errorMissingHtD_HtXPosLeaf1 = errorDir.make<TH1I>("errorMissingHtD_HtXPosLeaf1", "missingHtD;Missing H_{T} X PosLeaf1;Number of Events", 4096, -2048.5, 2047.5);
01501       TH1I *errorMissingHtD_HtXPosLeaf2 = errorDir.make<TH1I>("errorMissingHtD_HtXPosLeaf2", "missingHtD;Missing H_{T} X PosLeaf2;Number of Events", 4096, -2048.5, 2047.5);
01502       TH1I *errorMissingHtD_HtXPosLeaf3 = errorDir.make<TH1I>("errorMissingHtD_HtXPosLeaf3", "missingHtD;Missing H_{T} X PosLeaf3;Number of Events", 4096, -2048.5, 2047.5);
01503       TH1I *errorMissingHtD_HtXNegLeaf1 = errorDir.make<TH1I>("errorMissingHtD_HtXNegLeaf1", "missingHtD;Missing H_{T} X NegLeaf1;Number of Events", 4096, -2048.5, 2047.5);
01504       TH1I *errorMissingHtD_HtXNegLeaf2 = errorDir.make<TH1I>("errorMissingHtD_HtXNegLeaf2", "missingHtD;Missing H_{T} X NegLeaf2;Number of Events", 4096, -2048.5, 2047.5);
01505       TH1I *errorMissingHtD_HtXNegLeaf3 = errorDir.make<TH1I>("errorMissingHtD_HtXNegLeaf3", "missingHtD;Missing H_{T} X NegLeaf3;Number of Events", 4096, -2048.5, 2047.5);
01506 
01507       TH1I *errorMissingHtD_HtYPosLeaf1 = errorDir.make<TH1I>("errorMissingHtD_HtYPosLeaf1", "missingHtD;Missing H_{T} Y PosLeaf1;Number of Events", 4096, -2048.5, 2047.5);
01508       TH1I *errorMissingHtD_HtYPosLeaf2 = errorDir.make<TH1I>("errorMissingHtD_HtYPosLeaf2", "missingHtD;Missing H_{T} Y PosLeaf2;Number of Events", 4096, -2048.5, 2047.5);
01509       TH1I *errorMissingHtD_HtYPosLeaf3 = errorDir.make<TH1I>("errorMissingHtD_HtYPosLeaf3", "missingHtD;Missing H_{T} Y PosLeaf3;Number of Events", 4096, -2048.5, 2047.5);
01510       TH1I *errorMissingHtD_HtYNegLeaf1 = errorDir.make<TH1I>("errorMissingHtD_HtYNegLeaf1", "missingHtD;Missing H_{T} Y NegLeaf1;Number of Events", 4096, -2048.5, 2047.5);
01511       TH1I *errorMissingHtD_HtYNegLeaf2 = errorDir.make<TH1I>("errorMissingHtD_HtYNegLeaf2", "missingHtD;Missing H_{T} Y NegLeaf2;Number of Events", 4096, -2048.5, 2047.5);
01512       TH1I *errorMissingHtD_HtYNegLeaf3 = errorDir.make<TH1I>("errorMissingHtD_HtYNegLeaf3", "missingHtD;Missing H_{T} Y NegLeaf3;Number of Events", 4096, -2048.5, 2047.5);
01513 
01514       for(unsigned int i=0; i<intMissingHtD->size(); i++) {
01515         if(intMissingHtD->at(i).bx() == GCTTrigBx_) {
01516           if(!intMissingHtD->at(i).overflow()) {
01517           
01518             if(intMissingHtD->at(i).capBlock() == 0x301 && intMissingHtD->at(i).capIndex() == 0 && intMissingHtD->at(i).isThereHtx()) errorMissingHtD_HtXPosLeaf1->Fill(intMissingHtD->at(i).htx());
01519             if(intMissingHtD->at(i).capBlock() == 0x301 && intMissingHtD->at(i).capIndex() == 1 && intMissingHtD->at(i).isThereHtx()) errorMissingHtD_HtXPosLeaf2->Fill(intMissingHtD->at(i).htx());
01520             if(intMissingHtD->at(i).capBlock() == 0x301 && intMissingHtD->at(i).capIndex() == 2 && intMissingHtD->at(i).isThereHtx()) errorMissingHtD_HtXPosLeaf3->Fill(intMissingHtD->at(i).htx());
01521             if(intMissingHtD->at(i).capBlock() == 0x701 && intMissingHtD->at(i).capIndex() == 0 && intMissingHtD->at(i).isThereHtx()) errorMissingHtD_HtXNegLeaf1->Fill(intMissingHtD->at(i).htx());
01522             if(intMissingHtD->at(i).capBlock() == 0x701 && intMissingHtD->at(i).capIndex() == 1 && intMissingHtD->at(i).isThereHtx()) errorMissingHtD_HtXNegLeaf2->Fill(intMissingHtD->at(i).htx());
01523             if(intMissingHtD->at(i).capBlock() == 0x701 && intMissingHtD->at(i).capIndex() == 2 && intMissingHtD->at(i).isThereHtx()) errorMissingHtD_HtXNegLeaf3->Fill(intMissingHtD->at(i).htx());
01524           
01525             if(intMissingHtD->at(i).capBlock() == 0x301 && intMissingHtD->at(i).capIndex() == 0 && intMissingHtD->at(i).isThereHty()) errorMissingHtD_HtYPosLeaf1->Fill(intMissingHtD->at(i).hty());
01526             if(intMissingHtD->at(i).capBlock() == 0x301 && intMissingHtD->at(i).capIndex() == 1 && intMissingHtD->at(i).isThereHty()) errorMissingHtD_HtYPosLeaf2->Fill(intMissingHtD->at(i).hty());
01527             if(intMissingHtD->at(i).capBlock() == 0x301 && intMissingHtD->at(i).capIndex() == 2 && intMissingHtD->at(i).isThereHty()) errorMissingHtD_HtYPosLeaf3->Fill(intMissingHtD->at(i).hty());
01528             if(intMissingHtD->at(i).capBlock() == 0x701 && intMissingHtD->at(i).capIndex() == 0 && intMissingHtD->at(i).isThereHty()) errorMissingHtD_HtYNegLeaf1->Fill(intMissingHtD->at(i).hty());
01529             if(intMissingHtD->at(i).capBlock() == 0x701 && intMissingHtD->at(i).capIndex() == 1 && intMissingHtD->at(i).isThereHty()) errorMissingHtD_HtYNegLeaf2->Fill(intMissingHtD->at(i).hty());
01530             if(intMissingHtD->at(i).capBlock() == 0x701 && intMissingHtD->at(i).capIndex() == 2 && intMissingHtD->at(i).isThereHty()) errorMissingHtD_HtYNegLeaf3->Fill(intMissingHtD->at(i).hty());
01531           }
01532         }
01533       }
01534     }
01535   }
01536   
01537   if(checkCollections(intJetsE, NUM_INT_JETS, "Intermediate Jets Emulator")) {
01538     TH2I *errorIntJetsE_EtEtaPhi = errorDir.make<TH2I>("errorIntJetsE_EtEtaPhi", "errorIntJetsE_EtEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
01539     
01540     for(unsigned int i=0; i < intJetsE->size(); i++) {
01541       if(intJetsE->at(i).bx() == EmuTrigBx_) {
01542         if(!intJetsE->at(i).oflow() && intJetsE->at(i).et()) errorIntJetsE_EtEtaPhi->Fill(intJetsE->at(i).regionId().ieta(),intJetsE->at(i).regionId().iphi(),intJetsE->at(i).et());
01543       }
01544     }
01545   }
01546 
01547   for(unsigned int i=0;i<caloRegions->size();i++) {
01548     if(caloRegions->at(i).bx() == RCTTrigBx_) {
01549       if(caloRegions->at(i).et()>0) errorRegionEtEtaPhi_->Fill(caloRegions->at(i).gctEta(),caloRegions->at(i).gctPhi(),caloRegions->at(i).et());
01550       if(caloRegions->at(i).overFlow()) errorRegionOfEtaPhi_->Fill(caloRegions->at(i).gctEta(),caloRegions->at(i).gctPhi());
01551     }
01552   }
01553 
01554   //plot the data candidates relating to this mismatch
01555   for(unsigned int i=0; i < missingEtD->size(); i++) {
01556     if(missingEtD->at(i).bx() == GCTTrigBx_) {
01557       errorMissingEtD_Of_->Fill(missingEtD->at(i).overFlow());
01558       if(!missingEtD->at(i).overFlow()) {
01559         errorMissingEtD_->Fill(missingEtD->at(i).et());
01560         errorMissingEtD_Phi_->Fill(missingEtD->at(i).phi());
01561       }
01562     }
01563   }
01564   for(unsigned int i=0; i < missingHtD->size(); i++) {
01565     if(missingHtD->at(i).bx() == GCTTrigBx_) {
01566       errorMissingHtD_Of_->Fill(missingHtD->at(i).overFlow());
01567       if(!missingHtD->at(i).overFlow()) {
01568         errorMissingHtD_->Fill(missingHtD->at(i).et());
01569         errorMissingHtD_Phi_->Fill(missingHtD->at(i).phi());
01570       }
01571     }
01572   }
01573   //and now for the emulator candidates
01574   for(unsigned int i=0; i < missingEtE->size(); i++) {
01575     if(missingEtE->at(i).bx() == EmuTrigBx_) {
01576       errorMissingEtE_Of_->Fill(missingEtE->at(i).overFlow());
01577       if(!missingEtE->at(i).overFlow()) {
01578         errorMissingEtE_->Fill(missingEtE->at(i).et());
01579         errorMissingEtE_Phi_->Fill(missingEtE->at(i).phi());
01580       }
01581     }
01582   }
01583   for(unsigned int i=0; i < missingHtE->size(); i++) {
01584     if(missingHtE->at(i).bx() == EmuTrigBx_) {
01585       errorMissingHtE_Of_->Fill(missingHtE->at(i).overFlow());
01586       if(!missingHtE->at(i).overFlow()) { //to see what values the emulator outputs despite the o/f bit being set comment out this statement
01587         errorMissingHtE_->Fill(missingHtE->at(i).et());
01588         errorMissingHtE_Phi_->Fill(missingHtE->at(i).phi());      
01589       }
01590     }
01591   }
01592 }
01593 
01594 //define this as a plug-in
01595 DEFINE_FWK_MODULE(GctErrorAnalyzer);