CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch2/src/DQM/L1TMonitor/src/L1TdeRCT.cc

Go to the documentation of this file.
00001 /*
00002  * \file L1TdeRCT.cc
00003  *
00004  * version 0.0 A.Savin 2008/04/26
00005  * version 1.0 A.Savin 2008/05/05
00006  * this version contains single channel histos and 1D efficiencies
00007  */
00008 
00009 
00010 
00011 
00012 
00013 #include "DQM/L1TMonitor/interface/L1TdeRCT.h"
00014 
00015 // GCT and RCT data formats
00016 #include "DataFormats/L1CaloTrigger/interface/L1CaloCollections.h"
00017 #include "DQMServices/Core/interface/DQMStore.h"
00018 
00019 // TPGs
00020 
00021 #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h"
00022 #include "DataFormats/HcalDigi/interface/HcalDigiCollections.h"
00023 
00024 #include "FWCore/Framework/interface/ESHandle.h"
00025 #include "DataFormats/Provenance/interface/EventAuxiliary.h"
00026 
00027 #include "CondFormats/L1TObjects/interface/L1GtTriggerMenu.h"
00028 #include "CondFormats/DataRecord/interface/L1GtTriggerMenuRcd.h"
00029 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetupFwd.h"
00030 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetup.h"
00031 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h"
00032 
00033 #include "TF2.h"
00034 
00035 #include <iostream>
00036 #include <bitset>
00037 
00038 #include "CondFormats/RunInfo/interface/RunInfo.h"
00039 #include "CondFormats/DataRecord/interface/RunSummaryRcd.h"
00040 
00041 
00042 using namespace edm;
00043 using namespace std;
00044 
00045 const unsigned int PHIBINS = 18;
00046 const float PHIMIN = -0.5;
00047 const float PHIMAX = 17.5;
00048 
00049 const unsigned int ETABINS = 22;
00050 const float ETAMIN = -0.5;
00051 const float ETAMAX = 21.5;
00052 
00053 const unsigned int BITETABINS = 44;
00054 const float BITETAMIN = 0;
00055 const float BITETAMAX = 22;
00056 
00057 const unsigned int BITPHIBINS = 72;
00058 const float BITPHIMIN = 0;
00059 const float BITPHIMAX = 18;
00060 
00061 const unsigned int BITRPHIBINS = 90;
00062 const float BITRPHIMIN = 0;
00063 const float BITRPHIMAX = 18;
00064 
00065 const unsigned int TPGPHIBINS = 72;
00066 const float TPGPHIMIN = -0.5;
00067 const float TPGPHIMAX = 71.5;
00068 
00069 const unsigned int TPGETABINS = 64;
00070 const float TPGETAMIN = -32.;
00071 const float TPGETAMAX = 32.;
00072 
00073 const unsigned int TPGRANK = 256;
00074 const float TPGRANKMIN = -.5;
00075 const float TPGRANKMAX = 255.5;
00076 
00077 const unsigned int DEBINS = 127;
00078 const float DEMIN = -63.5;
00079 const float DEMAX = 63.5;
00080 
00081 const unsigned int ELBINS = 64;
00082 const float ELMIN = -.5;
00083 const float ELMAX = 63.5;
00084 
00085 const unsigned int HCALBINS = 1024;
00086 const float HCALMIN = -.5;
00087 const float HCALMAX = 1023.5;
00088 
00089 const unsigned int PhiEtaMax = 396;
00090 const unsigned int CHNLBINS = 396;
00091 const float CHNLMIN = -0.5;
00092 const float CHNLMAX = 395.5;
00093 
00094 bool first = true ;
00095 
00096 
00097 const int L1TdeRCT::crateFED[90]=
00098     {613, 614, 603, 702, 718,
00099      611, 612, 602, 700, 718,
00100      627, 610, 601,716,  722,
00101      625, 626, 609, 714, 722,
00102      623, 624, 608, 712, 722,
00103      621, 622, 607, 710, 720,
00104      619, 620, 606, 708, 720,
00105      617, 618, 605, 706, 720,
00106      615, 616, 604, 704, 718,
00107      631, 632, 648, 703, 719,
00108      629, 630, 647, 701, 719,
00109      645, 628, 646, 717, 723,
00110      643, 644, 654, 715, 723,
00111      641, 642, 653, 713, 723,
00112      639, 640, 652, 711, 721,
00113      637, 638, 651, 709, 721,
00114      635, 636, 650, 707, 721,
00115      633, 634, 649, 705, 719
00116 };
00117 
00118 
00119 
00120 L1TdeRCT::L1TdeRCT(const ParameterSet & ps) :
00121    rctSourceEmul_( ps.getParameter< InputTag >("rctSourceEmul") ),
00122    rctSourceData_( ps.getParameter< InputTag >("rctSourceData") ),
00123    ecalTPGData_( ps.getParameter< InputTag >("ecalTPGData") ),
00124    hcalTPGData_( ps.getParameter< InputTag >("hcalTPGData") ),
00125    gtDigisLabel_( ps.getParameter< InputTag >("gtDigisLabel") ),
00126    gtEGAlgoName_ ( ps.getParameter< std::string >("gtEGAlgoName") ),
00127    doubleThreshold_ ( ps.getParameter< int >("doubleThreshold") ),
00128    filterTriggerType_ (ps.getParameter< int >("filterTriggerType") )
00129 {
00130 
00131 
00132 
00133   singlechannelhistos_ = ps.getUntrackedParameter < bool > ("singlechannelhistos", false);
00134 
00135   if (singlechannelhistos_)
00136     if(verbose_) std::cout << "L1TdeRCT: single channels histos ON" << std::endl;
00137 
00138   // verbosity switch
00139   verbose_ = ps.getUntrackedParameter < bool > ("verbose", false);
00140 
00141   if (verbose_)
00142     std::cout << "L1TdeRCT: constructor...." << std::endl;
00143 
00144 
00145   dbe = NULL;
00146   if (ps.getUntrackedParameter < bool > ("DQMStore", false)) {
00147     dbe = Service < DQMStore > ().operator->();
00148     dbe->setVerbose(0);
00149   }
00150 
00151   outputFile_ =
00152       ps.getUntrackedParameter < std::string > ("outputFile", "");
00153   if (outputFile_.size() != 0) {
00154     if(verbose_) std::
00155   cout << "L1T Monitoring histograms will be saved to " <<
00156   outputFile_.c_str() << std::endl;
00157   }
00158 
00159   bool disable =
00160       ps.getUntrackedParameter < bool > ("disableROOToutput", false);
00161   if (disable) {
00162     outputFile_ = "";
00163   }
00164 
00165   histFolder_
00166     = ps.getUntrackedParameter<std::string>("HistFolder", "L1TEMU/L1TdeRCT");
00167 
00168   if (dbe != NULL) {
00169     dbe->setCurrentFolder(histFolder_);
00170   }
00171 
00172 
00173 
00174 }
00175 
00176 L1TdeRCT::~L1TdeRCT()
00177 {
00178 }
00179 
00180 void L1TdeRCT::beginJob(void)
00181 {
00182 
00183   nev_ = 0;
00184 
00185   // get hold of back-end interface
00186   DQMStore *dbe = 0;
00187   dbe = Service < DQMStore > ().operator->();
00188 
00189   if (dbe) {
00190     dbe->setCurrentFolder(histFolder_);
00191     dbe->rmdir(histFolder_);
00192   }
00193 
00194 
00195   if (dbe) {
00196 
00197     dbe->setCurrentFolder(histFolder_);
00198 
00199     triggerType_ =
00200       dbe->book1D("TriggerType", "TriggerType", 17, -0.5, 16.5);
00201 
00202     triggerAlgoNumbers_ =
00203       dbe->book1D("gtTriggerAlgoNumbers", "gtTriggerAlgoNumbers", 128, -0.5, 127.5);
00204 
00205     rctInputTPGEcalOcc_ =
00206   dbe->book2D("rctInputTPGEcalOcc", "rctInputTPGEcalOcc", TPGETABINS, TPGETAMIN,
00207         TPGETAMAX, TPGPHIBINS, TPGPHIMIN, TPGPHIMAX);
00208 
00209     rctInputTPGEcalOccNoCut_ =
00210   dbe->book2D("rctInputTPGEcalOccNoCut", "rctInputTPGEcalOccNoCut", TPGETABINS, TPGETAMIN,
00211         TPGETAMAX, TPGPHIBINS, TPGPHIMIN, TPGPHIMAX);
00212 
00213     rctInputTPGEcalRank_ =
00214   dbe->book1D("rctInputTPGEcalRank", "rctInputTPGEcalRank", TPGRANK, TPGRANKMIN, TPGRANKMAX) ;
00215 
00216     rctInputTPGHcalOcc_ =
00217   dbe->book2D("rctInputTPGHcalOcc", "rctInputTPGHcalOcc", TPGETABINS, TPGETAMIN,
00218         TPGETAMAX, TPGPHIBINS, TPGPHIMIN, TPGPHIMAX);
00219 
00220     rctInputTPGHcalSample_ =
00221   dbe->book1D("rctInputTPGHcalSample", "rctInputTPGHcalSample", 10, -0.5, 9.5) ;
00222 
00223     rctInputTPGHcalRank_ =
00224   dbe->book1D("rctInputTPGHcalRank", "rctInputTPGHcalRank", TPGRANK, TPGRANKMIN, TPGRANKMAX) ;
00225 
00226     dbe->setCurrentFolder(histFolder_+"/EffCurves/NisoEm/");
00227 
00228     trigEffThresh_ =
00229       dbe->book2D("trigEffThresh", "Rank occupancy >= 2x trig thresh",
00230                   ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00231 
00232     dbe->setCurrentFolder(histFolder_+"/EffCurves/NisoEm/ServiceData");
00233 
00234     trigEffThreshOcc_ =
00235       dbe->book2D("trigEffThreshOcc", "Rank occupancy >= 2x trig thresh",
00236                   ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00237     trigEffTriggThreshOcc_ =
00238       dbe->book2D("trigEffTriggThreshOcc", "Rank occupancy >= 2x trig thresh, triggered",
00239                   ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00240 
00241     dbe->setCurrentFolder(histFolder_+"/IsoEm");
00242 
00243     rctIsoEmEff1_ =
00244   dbe->book2D("rctIsoEmEff1", "rctIsoEmEff1", ETABINS, ETAMIN,
00245         ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00246 
00247     rctIsoEmEff1oneD_ =
00248   dbe->book1D("rctIsoEmEff1oneD", "rctIsoEmEff1oneD",
00249         CHNLBINS, CHNLMIN, CHNLMAX);
00250 
00251     rctIsoEmEff2_ =
00252   dbe->book2D("rctIsoEmEff2", "rctIsoEmEff2, energy matching required", ETABINS, ETAMIN,
00253         ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00254 
00255     rctIsoEmEff2oneD_ =
00256   dbe->book1D("rctIsoEmEff2oneD", "rctIsoEmEff2oneD, energy matching required",
00257         CHNLBINS, CHNLMIN, CHNLMAX);
00258 
00259     rctIsoEmIneff2_ =
00260   dbe->book2D("rctIsoEmIneff2", "rctIsoEmIneff2, energy matching required", ETABINS, ETAMIN,
00261         ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00262 
00263     rctIsoEmIneff2oneD_ =
00264   dbe->book1D("rctIsoEmIneff2oneD", "rctIsoEmIneff2oneD, energy matching required",
00265         CHNLBINS, CHNLMIN, CHNLMAX);
00266 
00267 
00268     rctIsoEmIneff_ =
00269   dbe->book2D("rctIsoEmIneff", "rctIsoEmIneff", ETABINS, ETAMIN,
00270         ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00271 
00272     rctIsoEmIneff1D_ =
00273   dbe->book1D("rctIsoEmIneff1D", "rctIsoEmIneff1D",
00274                     CHNLBINS, CHNLMIN, CHNLMAX);
00275 
00276     rctIsoEmOvereff_ =
00277   dbe->book2D("rctIsoEmOvereff", "rctIsoEmOvereff", ETABINS, ETAMIN,
00278         ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00279 
00280     rctIsoEmOvereff1D_ =
00281   dbe->book1D("rctIsoEmOvereff1D", "rctIsoEmOvereff1D",
00282                     CHNLBINS, CHNLMIN, CHNLMAX);
00283 
00284     dbe->setCurrentFolder(histFolder_+"/IsoEm/ServiceData");
00285 
00286     rctIsoEmDataOcc_ =
00287   dbe->book2D("rctIsoEmDataOcc", "rctIsoEmDataOcc", ETABINS, ETAMIN,
00288         ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00289 
00290     rctIsoEmDataOcc1D_ =
00291   dbe->book1D("rctIsoEmDataOcc1D", "rctIsoEmDataOcc1D",
00292                     CHNLBINS, CHNLMIN, CHNLMAX);
00293 
00294     rctIsoEmEmulOcc_ =
00295   dbe->book2D("rctIsoEmEmulOcc", "rctIsoEmEmulOcc", ETABINS, ETAMIN,
00296         ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00297 
00298     rctIsoEmEmulOcc1D_ =
00299   dbe->book1D("rctIsoEmEmulOcc1D", "rctIsoEmEmulOcc1D",
00300                     CHNLBINS, CHNLMIN, CHNLMAX);
00301 
00302     rctIsoEmEff1Occ_ =
00303   dbe->book2D("rctIsoEmEff1Occ", "rctIsoEmEff1Occ", ETABINS, ETAMIN,
00304         ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00305 
00306     rctIsoEmEff1Occ1D_ =
00307   dbe->book1D("rctIsoEmEff1Occ1D", "rctIsoEmEff1Occ1D",
00308                     CHNLBINS, CHNLMIN, CHNLMAX);
00309 
00310     rctIsoEmEff2Occ_ =
00311   dbe->book2D("rctIsoEmEff2Occ", "rctIsoEmEff2Occ", ETABINS, ETAMIN,
00312         ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00313 
00314     rctIsoEmEff2Occ1D_ =
00315   dbe->book1D("rctIsoEmEff2Occ1D", "rctIsoEmEff2Occ1D",
00316                     CHNLBINS, CHNLMIN, CHNLMAX);
00317 
00318     rctIsoEmIneff2Occ_ =
00319   dbe->book2D("rctIsoEmIneff2Occ", "rctIsoEmIneff2Occ", ETABINS, ETAMIN,
00320         ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00321 
00322     rctIsoEmIneff2Occ1D_ =
00323   dbe->book1D("rctIsoEmIneff2Occ1D", "rctIsoEmIneff2Occ1D",
00324                     CHNLBINS, CHNLMIN, CHNLMAX);
00325 
00326     rctIsoEmIneffOcc_ =
00327   dbe->book2D("rctIsoEmIneffOcc", "rctIsoEmIneffOcc", ETABINS, ETAMIN,
00328         ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00329 
00330     rctIsoEmIneffOcc1D_ =
00331   dbe->book1D("rctIsoEmIneffOcc1D", "rctIsoEmIneffOcc1D",
00332                     CHNLBINS, CHNLMIN, CHNLMAX);
00333 
00334     rctIsoEmOvereffOcc_ =
00335   dbe->book2D("rctIsoEmOvereffOcc", "rctIsoEmOvereffOcc", ETABINS, ETAMIN,
00336         ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00337 
00338     rctIsoEmOvereffOcc1D_ =
00339   dbe->book1D("rctIsoEmOvereffOcc1D", "rctIsoEmOvereffOcc1D",
00340                     CHNLBINS, CHNLMIN, CHNLMAX);
00341 
00342 
00343     dbe->setCurrentFolder(histFolder_+"/NisoEm");
00344     rctNisoEmEff1_ =
00345   dbe->book2D("rctNisoEmEff1", "rctNisoEmEff1", ETABINS, ETAMIN,
00346         ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00347 
00348     rctNisoEmEff1oneD_ =
00349   dbe->book1D("rctNisoEmEff1oneD", "rctNisoEmEff1oneD",
00350                     CHNLBINS, CHNLMIN, CHNLMAX);
00351 
00352     rctNisoEmEff2_ =
00353   dbe->book2D("rctNisoEmEff2", "rctNisoEmEff2, energy matching required", ETABINS, ETAMIN,
00354         ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00355 
00356     rctNisoEmEff2oneD_ =
00357   dbe->book1D("rctNisoEmEff2oneD", "rctNisoEmEff2oneD, energy matching required",
00358                     CHNLBINS, CHNLMIN, CHNLMAX);
00359 
00360     rctNisoEmIneff2_ =
00361   dbe->book2D("rctNisoEmIneff2", "rctNisoEmIneff2, energy matching required", ETABINS, ETAMIN,
00362         ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00363 
00364     rctNisoEmIneff2oneD_ =
00365   dbe->book1D("rctNisoEmIneff2oneD", "rctNisoEmIneff2oneD, energy matching required",
00366                     CHNLBINS, CHNLMIN, CHNLMAX);
00367 
00368 
00369     rctNisoEmIneff_ =
00370   dbe->book2D("rctNisoEmIneff", "rctNisoEmIneff", ETABINS, ETAMIN,
00371         ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00372 
00373     rctNisoEmIneff1D_ =
00374   dbe->book1D("rctNisoEmIneff1D", "rctNisoEmIneff1D",
00375                     CHNLBINS, CHNLMIN, CHNLMAX);
00376 
00377     rctNisoEmOvereff_ =
00378   dbe->book2D("rctNisoEmOvereff", "rctNisoEmOvereff", ETABINS, ETAMIN,
00379         ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00380 
00381     rctNisoEmOvereff1D_ =
00382   dbe->book1D("rctNisoEmOvereff1D", "rctNisoEmOvereff1D",
00383                     CHNLBINS, CHNLMIN, CHNLMAX);
00384 
00385     dbe->setCurrentFolder(histFolder_+"/NisoEm/ServiceData");
00386 
00387     rctNisoEmDataOcc_ =
00388   dbe->book2D("rctNisoEmDataOcc", "rctNisoEmDataOcc", ETABINS, ETAMIN,
00389         ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00390 
00391     rctNisoEmDataOcc1D_ =
00392   dbe->book1D("rctNisoEmDataOcc1D", "rctNisoEmDataOcc1D",
00393                     CHNLBINS, CHNLMIN, CHNLMAX);
00394 
00395     rctNisoEmEmulOcc_ =
00396   dbe->book2D("rctNisoEmEmulOcc", "rctNisoEmEmulOcc", ETABINS, ETAMIN,
00397         ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00398 
00399     rctNisoEmEmulOcc1D_ =
00400   dbe->book1D("rctNisoEmEmulOcc1D", "rctNisoEmEmulOcc1D",
00401                     CHNLBINS, CHNLMIN, CHNLMAX);
00402 
00403     rctNisoEmEff1Occ_ =
00404   dbe->book2D("rctNisoEmEff1Occ", "rctNisoEmEff1Occ", ETABINS, ETAMIN,
00405         ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00406 
00407     rctNisoEmEff1Occ1D_ =
00408   dbe->book1D("rctNisoEmEff1Occ1D", "rctNisoEmEff1Occ1D",
00409                     CHNLBINS, CHNLMIN, CHNLMAX);
00410 
00411     rctNisoEmEff2Occ_ =
00412   dbe->book2D("rctNisoEmEff2Occ", "rctNisoEmEff2Occ", ETABINS, ETAMIN,
00413         ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00414 
00415     rctNisoEmEff2Occ1D_ =
00416   dbe->book1D("rctNisoEmEff2Occ1D", "rctNisoEmEff2Occ1D",
00417                     CHNLBINS, CHNLMIN, CHNLMAX);
00418 
00419     rctNisoEmIneff2Occ_ =
00420   dbe->book2D("rctNisoEmIneff2Occ", "rctNisoEmIneff2Occ", ETABINS, ETAMIN,
00421         ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00422 
00423     rctNisoEmIneff2Occ1D_ =
00424   dbe->book1D("rctNisoEmIneff2Occ1D", "rctNisoEmIneff2Occ1D",
00425                     CHNLBINS, CHNLMIN, CHNLMAX);
00426 
00427     rctNisoEmIneffOcc_ =
00428   dbe->book2D("rctNisoEmIneffOcc", "rctNisoEmIneffOcc", ETABINS, ETAMIN,
00429         ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00430 
00431     rctNisoEmIneffOcc1D_ =
00432   dbe->book1D("rctNisoEmIneffOcc1D", "rctNisoEmIneffOcc1D",
00433                     CHNLBINS, CHNLMIN, CHNLMAX);
00434 
00435     rctNisoEmOvereffOcc_ =
00436   dbe->book2D("rctNisoEmOvereffOcc", "rctNisoEmOvereffOcc", ETABINS, ETAMIN,
00437         ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00438 
00439     rctNisoEmOvereffOcc1D_ =
00440   dbe->book1D("rctNisoEmOvereffOcc1D", "rctNisoEmOvereffOcc1D",
00441                     CHNLBINS, CHNLMIN, CHNLMAX);
00442 
00443     // region information
00444     dbe->setCurrentFolder(histFolder_+"/RegionData");
00445 
00446     rctRegEff1D_ =
00447       dbe->book1D("rctRegEff1D", "1D region efficiency",
00448       CHNLBINS, CHNLMIN, CHNLMAX);
00449 
00450     rctRegIneff1D_ =
00451       dbe->book1D("rctRegIneff1D", "1D region inefficiency",
00452       CHNLBINS, CHNLMIN, CHNLMAX);
00453 
00454     rctRegOvereff1D_ =
00455       dbe->book1D("rctRegOvereff1D", "1D region overefficiency",
00456       CHNLBINS, CHNLMIN, CHNLMAX);
00457 
00458     rctRegSpEff1D_ =
00459       dbe->book1D("rctRegSpEff1D", "1D region efficiency, energy matching required",
00460       CHNLBINS, CHNLMIN, CHNLMAX);
00461 
00462     rctRegSpIneff1D_ =
00463       dbe->book1D("rctRegSpIneff1D", "1D region inefficiency, energy matching required",
00464       CHNLBINS, CHNLMIN, CHNLMAX);
00465 
00466     rctRegEff2D_ =
00467       dbe->book2D("rctRegEff2D", "2D region efficiency",
00468       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00469 
00470     rctRegIneff2D_ =
00471       dbe->book2D("rctRegIneff2D", "2D region inefficiency",
00472       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00473 
00474     rctRegOvereff2D_ =
00475       dbe->book2D("rctRegOvereff2D", "2D region overefficiency",
00476       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00477 
00478     rctRegSpEff2D_ =
00479       dbe->book2D("rctRegSpEff2D", "2D region efficiency, energy matching required",
00480       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00481 
00482     rctRegSpIneff2D_ =
00483       dbe->book2D("rctRegSpIneff2D", "2D region inefficiency, energy matching required",
00484       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00485 
00486     dbe->setCurrentFolder(histFolder_+"/RegionData/ServiceData");
00487 
00488     rctRegDataOcc1D_ =
00489       dbe->book1D("rctRegDataOcc1D", "1D region occupancy from data",
00490       CHNLBINS, CHNLMIN, CHNLMAX);
00491 
00492     rctRegEmulOcc1D_ =
00493       dbe->book1D("rctRegEmulOcc1D", "1D region occupancy from emulator",
00494       CHNLBINS, CHNLMIN, CHNLMAX);
00495 
00496     rctRegMatchedOcc1D_ =
00497       dbe->book1D("rctRegMatchedOcc1D", "1D region occupancy for matched hits",
00498       CHNLBINS, CHNLMIN, CHNLMAX);
00499 
00500     rctRegUnmatchedDataOcc1D_ =
00501       dbe->book1D("rctRegUnmatchedDataOcc1D", "1D region occupancy for unmatched hardware hits",
00502       CHNLBINS, CHNLMIN, CHNLMAX);
00503 
00504     rctRegUnmatchedEmulOcc1D_ =
00505       dbe->book1D("rctRegUnmatchedEmulOcc1D", "1D region occupancy for unmatched emulator hits",
00506       CHNLBINS, CHNLMIN, CHNLMAX);
00507 
00508     rctRegSpEffOcc1D_ =
00509       dbe->book1D("rctRegSpEffOcc1D", "1D region occupancy for \\Delta E_{T} efficiency",
00510       CHNLBINS, CHNLMIN, CHNLMAX);
00511 
00512     rctRegSpIneffOcc1D_ =
00513       dbe->book1D("rctRegSpIneffOcc1D", "1D region occupancy for \\Delta E_{T} efficiency ",
00514       CHNLBINS, CHNLMIN, CHNLMAX);
00515 
00516     rctRegDataOcc2D_ =
00517       dbe->book2D("rctRegDataOcc2D", "2D region occupancy from hardware",
00518       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00519 
00520     rctRegEmulOcc2D_ =
00521       dbe->book2D("rctRegEmulOcc2D", "2D region occupancy from emulator",
00522       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00523 
00524     rctRegMatchedOcc2D_ =
00525       dbe->book2D("rctRegMatchedOcc2D", "2D region occupancy for matched hits",
00526       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00527 
00528     rctRegUnmatchedDataOcc2D_ =
00529       dbe->book2D("rctRegUnmatchedDataOcc2D", "2D region occupancy for unmatched hardware hits",
00530       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00531 
00532     rctRegUnmatchedEmulOcc2D_ =
00533       dbe->book2D("rctRegUnmatchedEmulOcc2D", "2D region occupancy for unmatched emulator hits",
00534       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00535 
00536 //    rctRegDeltaEt2D_ =
00537 //      dbe->book2D("rctRegDeltaEt2D", " \\Delta E_{T}  for each channel",
00538 //      CHNLBINS, CHNLMIN, CHNLMAX, 100, -50., 50.);
00539 
00540     rctRegSpEffOcc2D_ =
00541       dbe->book2D("rctRegSpEffOcc2D", "2D region occupancy for \\Delta E_{T} efficiency",
00542       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00543 
00544     rctRegSpIneffOcc2D_ =
00545       dbe->book2D("rctRegSpIneffOcc2D", "2D region occupancy for \\Delta E_{T} inefficiency",
00546       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00547 
00548     // bit information
00549     dbe->setCurrentFolder(histFolder_+"/BitData");
00550 
00551     rctBitOverFlowEff2D_ =
00552       dbe->book2D("rctBitOverFlowEff2D", "2D overflow bit efficiency",
00553       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00554 
00555     rctBitOverFlowIneff2D_ =
00556       dbe->book2D("rctBitOverFlowIneff2D", "2D overflow bit inefficiency",
00557       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00558 
00559     rctBitOverFlowOvereff2D_ =
00560       dbe->book2D("rctBitOverFlowOvereff2D", "2D overflow bit overefficiency",
00561       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00562 
00563     rctBitTauVetoEff2D_ =
00564       dbe->book2D("rctBitTauVetoEff2D", "2D tau veto bit efficiency",
00565       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00566 
00567     rctBitTauVetoIneff2D_ =
00568       dbe->book2D("rctBitTauVetoIneff2D", "2D tau veto bit inefficiency",
00569       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00570 
00571     rctBitTauVetoOvereff2D_ =
00572       dbe->book2D("rctBitTauVetoOvereff2D", "2D tau veto bit overefficiency",
00573       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00574 
00575     rctBitMipEff2D_ =
00576       dbe->book2D("rctBitMipEff2D", "2D mip bit efficiency",
00577       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00578 
00579     rctBitMipIneff2D_ =
00580       dbe->book2D("rctBitMipIneff2D", "2D mip bit inefficiency",
00581       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00582 
00583     rctBitMipOvereff2D_ =
00584       dbe->book2D("rctBitMipOvereff2D", "2D mip bit overefficiency",
00585       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00586 
00587     // QUIETBIT: To add quiet bit information, uncomment following 11 lines:
00588     // rctBitQuietEff2D_ =
00589       // dbe->book2D("rctBitQuietEff2D", "2D quiet bit efficiency",
00590       // ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00591 
00592     // rctBitQuietIneff2D_ =
00593       // dbe->book2D("rctBitQuietIneff2D", "2D quiet bit inefficiency",
00594       // ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00595 
00596     // rctBitQuietOvereff2D_ =
00597       // dbe->book2D("rctBitQuietOvereff2D", "2D quiet bit overefficiency",
00598       // ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00599 
00600     rctBitHfPlusTauEff2D_ =
00601       dbe->book2D("rctBitHfPlusTauEff2D", "2D HfPlusTau bit efficiency",
00602       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00603 
00604     rctBitHfPlusTauIneff2D_ =
00605       dbe->book2D("rctBitHfPlusTauIneff2D", "2D HfPlusTau bit inefficiency",
00606       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00607 
00608     rctBitHfPlusTauOvereff2D_ =
00609       dbe->book2D("rctBitHfPlusTauOvereff2D", "2D HfPlusTau bit overefficiency",
00610       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00611 
00612     dbe->setCurrentFolder(histFolder_+"/BitData/ServiceData");
00613 
00614     rctBitEmulOverFlow2D_ =
00615       dbe->book2D("rctBitEmulOverFlow2D", "2D overflow bit from emulator",
00616       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00617 
00618     rctBitDataOverFlow2D_ =
00619       dbe->book2D("rctBitDataOverFlow2D", "2D overflow bit from hardware",
00620       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00621 
00622     rctBitMatchedOverFlow2D_ =
00623       dbe->book2D("rctBitMatchedOverFlow2D", "2D overflow bit for matched hits",
00624       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00625 
00626     rctBitUnmatchedEmulOverFlow2D_ =
00627       dbe->book2D("rctBitUnmatchedEmulOverFlow2D", "2D overflow bit for unmatched emulator hits",
00628       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00629 
00630     rctBitUnmatchedDataOverFlow2D_ =
00631       dbe->book2D("rctBitUnmatchedDataOverFlow2D", "2D overflow bit for unmatched hardware hits",
00632       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00633 
00634     rctBitEmulTauVeto2D_ =
00635       dbe->book2D("rctBitEmulTauVeto2D", "2D tau veto bit from emulator",
00636       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00637 
00638     rctBitDataTauVeto2D_ =
00639       dbe->book2D("rctBitDataTauVeto2D", "2D tau veto bit from hardware",
00640       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00641 
00642     rctBitMatchedTauVeto2D_ =
00643       dbe->book2D("rctBitMatchedTauVeto2D", "2D tau veto bit for matched hits",
00644       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00645 
00646     rctBitUnmatchedEmulTauVeto2D_ =
00647       dbe->book2D("rctBitUnmatchedEmulTauVeto2D", "2D tau veto bit for unmatched emulator hits",
00648       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00649 
00650     rctBitUnmatchedDataTauVeto2D_ =
00651       dbe->book2D("rctBitUnmatchedDataTauVeto2D", "2D tau veto bit for unmatched hardware hits",
00652       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00653 
00654     rctBitEmulMip2D_ =
00655       dbe->book2D("rctBitEmulMip2D", "2D mip bit from emulator",
00656       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00657 
00658     rctBitDataMip2D_ =
00659       dbe->book2D("rctBitDataMip2D", "2D mip bit from hardware",
00660       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00661 
00662     rctBitMatchedMip2D_ =
00663       dbe->book2D("rctBitMatchedMip2D", "2D mip bit for matched hits",
00664       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00665 
00666     rctBitUnmatchedEmulMip2D_ =
00667       dbe->book2D("rctBitUnmatchedEmulMip2D", "2D mip bit for unmatched emulator hits",
00668       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00669 
00670     rctBitUnmatchedDataMip2D_ =
00671       dbe->book2D("rctBitUnmatchedDataMip2D", "2D mip bit for unmatched hardware hits",
00672       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00673 
00674     rctBitEmulQuiet2D_ =
00675       dbe->book2D("rctBitEmulQuiet2D", "2D quiet bit from emulator",
00676       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00677 
00678     rctBitDataQuiet2D_ =
00679       dbe->book2D("rctBitDataQuiet2D", "2D quiet bit from hardware",
00680       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00681 
00682     rctBitMatchedQuiet2D_ =
00683       dbe->book2D("rctBitMatchedQuiet2D", "2D quiet bit for matched hits",
00684       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00685 
00686     rctBitUnmatchedEmulQuiet2D_ =
00687       dbe->book2D("rctBitUnmatchedEmulQuiet2D", "2D quiet bit for unmatched emulator hits",
00688       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00689 
00690     rctBitUnmatchedDataQuiet2D_ =
00691       dbe->book2D("rctBitUnmatchedDataQuiet2D", "2D quiet bit for unmatched hardware hits",
00692       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00693 
00694     rctBitEmulHfPlusTau2D_ =
00695       dbe->book2D("rctBitEmulHfPlusTau2D", "2D HfPlusTau bit from emulator",
00696       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00697 
00698     rctBitDataHfPlusTau2D_ =
00699       dbe->book2D("rctBitDataHfPlusTau2D", "2D HfPlusTau bit from hardware",
00700       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00701 
00702     rctBitMatchedHfPlusTau2D_ =
00703       dbe->book2D("rctBitMatchedHfPlusTau2D", "2D HfPlusTau bit for matched hits",
00704       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00705 
00706     rctBitUnmatchedEmulHfPlusTau2D_ =
00707       dbe->book2D("rctBitUnmatchedEmulHfPlusTau2D", "2D HfPlusTau bit for unmatched emulator hits",
00708       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00709 
00710     rctBitUnmatchedDataHfPlusTau2D_ =
00711       dbe->book2D("rctBitUnmatchedDataHfPlusTau2D", "2D HfPlusTau bit for unmatched hardware hits",
00712       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00713  
00714     dbe->setCurrentFolder(histFolder_+"/BitMon");
00715     rctRegBitOn_ = 
00716       dbe->book2D("rctRegBitOn", "Monitoring for Bits Stuck On",
00717       BITETABINS, BITETAMIN, BITETAMAX, BITRPHIBINS, BITRPHIMIN, BITRPHIMAX);
00718 
00719     rctRegBitOff_ = 
00720       dbe->book2D("rctRegBitOff", "Monitoring for Bits Stuck Off",
00721       BITETABINS, BITETAMIN, BITETAMAX, BITRPHIBINS, BITRPHIMIN, BITRPHIMAX);
00722 
00723     rctRegBitDiff_ = 
00724       dbe->book2D("rctRegBitDiff", "Monitoring for Bits Difference",
00725       BITETABINS, BITETAMIN, BITETAMAX, BITRPHIBINS, BITRPHIMIN, BITRPHIMAX);
00726 
00727     rctIsoEmBitOn_ = 
00728       dbe->book2D("rctIsoEmBitOn", "Monitoring for Bits Stuck On",
00729       BITETABINS, BITETAMIN, BITETAMAX, BITPHIBINS, BITPHIMIN, BITPHIMAX);
00730 
00731     rctIsoEmBitOff_ = 
00732       dbe->book2D("rctIsoEmBitOff", "Monitoring for Bits Stuck Off",
00733       BITETABINS, BITETAMIN, BITETAMAX, BITPHIBINS, BITPHIMIN, BITPHIMAX);
00734 
00735     rctIsoEmBitDiff_ = 
00736       dbe->book2D("rctIsoEmBitDiff", "Monitoring for Bits Difference",
00737       BITETABINS, BITETAMIN, BITETAMAX, BITPHIBINS, BITPHIMIN, BITPHIMAX);
00738 
00739     rctNIsoEmBitOn_ = 
00740       dbe->book2D("rctNIsoEmBitOn", "Monitoring for Bits Stuck On",
00741       BITETABINS, BITETAMIN, BITETAMAX, BITPHIBINS, BITPHIMIN, BITPHIMAX);
00742 
00743     rctNIsoEmBitOff_ = 
00744       dbe->book2D("rctNIsoEmBitOff", "Monitoring for Bits Stuck Off",
00745       BITETABINS, BITETAMIN, BITETAMAX, BITPHIBINS, BITPHIMIN, BITPHIMAX);
00746 
00747     rctNIsoEmBitDiff_ = 
00748       dbe->book2D("rctNIsoEmBitDiff", "Monitoring for Bits Difference",
00749       BITETABINS, BITETAMIN, BITETAMAX, BITPHIBINS, BITPHIMIN, BITPHIMAX);
00750 
00751 
00752     dbe->setCurrentFolder(histFolder_+"/DBData");
00753     fedVectorMonitorRUN_ = dbe->book2D("rctFedVectorMonitorRUN", "FED Vector Monitor Per Run",90,0,90,2,0,2);
00754     fedVectorMonitorLS_ = dbe->book2D("rctFedVectorMonitorLS", "FED Vector Monitor Per LS",90,0,90,2,0,2);
00755 
00756     for(unsigned int i=0;i<90;++i) {
00757       char fed[10];
00758       sprintf(fed,"%d",crateFED[i]);
00759       fedVectorMonitorRUN_->getTH2F()->GetXaxis()->SetBinLabel(i+1,fed);
00760       fedVectorMonitorLS_->getTH2F()->GetXaxis()->SetBinLabel(i+1,fed);
00761     }
00762       fedVectorMonitorRUN_->getTH2F()->GetYaxis()->SetBinLabel(1,"OUT");
00763       fedVectorMonitorRUN_->getTH2F()->GetYaxis()->SetBinLabel(2,"IN");
00764       fedVectorMonitorLS_->getTH2F()->GetYaxis()->SetBinLabel(1,"OUT");
00765       fedVectorMonitorLS_->getTH2F()->GetYaxis()->SetBinLabel(2,"IN");
00766 
00767     
00768 
00769 // for single channels
00770 
00771     if(singlechannelhistos_)
00772    {
00773     for(int m=0; m<12; m++)
00774     {
00775     if(m==0) dbe->setCurrentFolder(histFolder_+"/IsoEm/ServiceData/Eff1SnglChnls");
00776     if(m==1) dbe->setCurrentFolder(histFolder_+"/NisoEm/ServiceData/Eff1SnglChnls");
00777     if(m==2) dbe->setCurrentFolder(histFolder_+"/RegionData/ServiceData/EffSnglChnls");
00778     if(m==3) dbe->setCurrentFolder(histFolder_+"/IsoEm/ServiceData/IneffSnglChnls");
00779     if(m==4) dbe->setCurrentFolder(histFolder_+"/NisoEm/ServiceData/IneffSnglChnls");
00780     if(m==5) dbe->setCurrentFolder(histFolder_+"/RegionData/ServiceData/IneffSnglChnls");
00781     if(m==6) dbe->setCurrentFolder(histFolder_+"/IsoEm/ServiceData/OvereffSnglChnls");
00782     if(m==7) dbe->setCurrentFolder(histFolder_+"/NisoEm/ServiceData/OvereffSnglChnls");
00783     if(m==8) dbe->setCurrentFolder(histFolder_+"/RegionData/ServiceData/OvereffSnglChnls");
00784     if(m==9) dbe->setCurrentFolder(histFolder_+"/EffCurves/NisoEm/ServiceData/SingleChannels");
00785     if(m==10) dbe->setCurrentFolder(histFolder_+"/EffCurves/NisoEm/ServiceData/SingleChannels");
00786     if(m==11) dbe->setCurrentFolder(histFolder_+"/EffCurves/NisoEm/ServiceData/SingleChannels");
00787 
00788     for(int i=0; i<ETAMAX; i++)
00789     {
00790      for(int j=0; j<PHIMAX; j++)
00791      {
00792      char name[80], channel[80]={""} ;
00793 
00794      if(m==0) strcpy(name,"(Eemul-Edata)Chnl") ;
00795      if(m==1) strcpy(name,"(Eemul-Edata)Chnl") ;
00796      if(m==2) strcpy(name,"(Eemul-Edata)Chnl") ;
00797      if(m==3) strcpy(name,"EemulChnl") ;
00798      if(m==4) strcpy(name,"EemulChnl") ;
00799      if(m==5) strcpy(name,"EemulChnl") ;
00800      if(m==6) strcpy(name,"EdataChnl") ;
00801      if(m==7) strcpy(name,"EdataChnl") ;
00802      if(m==8) strcpy(name,"EdataChnl") ;
00803      if(m==9) strcpy(name,"EemulChnlEff") ;
00804      if(m==10) strcpy(name,"EemulChnlTrig") ;
00805      if(m==11) strcpy(name,"EemulChnl") ;
00806 
00807      if(i<10 && j<10) sprintf(channel,"_0%d0%d",i,j);
00808      else if(i<10) sprintf(channel,"_0%d%d",i,j);
00809       else if(j<10) sprintf(channel,"_%d0%d",i,j);
00810        else sprintf(channel,"_%d%d",i,j);
00811      strcat(name,channel);
00812 
00813      int chnl=PHIBINS*i+j;
00814 
00815      if(m==0) rctIsoEffChannel_[chnl] =
00816   dbe->book1D(name, name, DEBINS, DEMIN, DEMAX);
00817      if(m==1) rctNisoEffChannel_[chnl] =
00818   dbe->book1D(name, name, DEBINS, DEMIN, DEMAX);
00819      if(m==2) rctRegEffChannel_[chnl] =
00820   dbe->book1D(name, name, DEBINS, DEMIN, DEMAX);
00821      if(m==3) rctIsoIneffChannel_[chnl] =
00822   dbe->book1D(name, name, DEBINS, DEMIN, DEMAX);
00823      if(m==4) rctNisoIneffChannel_[chnl] =
00824   dbe->book1D(name, name, DEBINS, DEMIN, DEMAX);
00825      if(m==5) rctRegIneffChannel_[chnl] =
00826   dbe->book1D(name, name, DEBINS, DEMIN, DEMAX);
00827      if(m==6) rctIsoOvereffChannel_[chnl] =
00828   dbe->book1D(name, name, DEBINS, DEMIN, DEMAX);
00829      if(m==7) rctNisoOvereffChannel_[chnl] =
00830   dbe->book1D(name, name, DEBINS, DEMIN, DEMAX);
00831      if(m==8) rctRegOvereffChannel_[chnl] =
00832   dbe->book1D(name, name, DEBINS, DEMIN, DEMAX);
00833      if(m==9) trigEff_[chnl] =
00834          dbe->book1D(name, name, ELBINS, ELMIN, ELMAX);
00835      if(m==10) trigEffOcc_[chnl] =
00836          dbe->book1D(name, name, ELBINS, ELMIN, ELMAX);
00837      if(m==11) trigEffTriggOcc_[chnl] =
00838          dbe->book1D(name, name, ELBINS, ELMIN, ELMAX);
00839      }
00840     }
00841     }
00842    }
00843 
00844 //end of single channels
00845 
00846 
00847   }
00848   notrigCount=0;
00849   trigCount=0;
00850 
00851 }
00852 
00853 
00854 void L1TdeRCT::endJob(void)
00855 {
00856   if (verbose_)
00857     std::cout << "L1TdeRCT: end job...." << std::endl;
00858   LogInfo("EndJob") << "analyzed " << nev_ << " events";
00859 
00860   if (outputFile_.size() != 0 && dbe)
00861     dbe->save(outputFile_);
00862 
00863   //std::cout << "trig count is " << trigCount << std::endl;
00864   //std::cout << "no trig count is " << notrigCount << std::endl;
00865 
00866 
00867   return;
00868 }
00869 
00870 void L1TdeRCT::analyze(const Event & e, const EventSetup & c)
00871 {
00872   nev_++;
00873   if (verbose_) {
00874     std::cout << "L1TdeRCT: analyze...." << std::endl;
00875   }
00876 
00877     // filter according trigger type
00878     //  enum ExperimentType {
00879     //        Undefined          =  0,
00880     //        PhysicsTrigger     =  1,
00881     //        CalibrationTrigger =  2,
00882     //        RandomTrigger      =  3,
00883     //        Reserved           =  4,
00884     //        TracedEvent        =  5,
00885     //        TestTrigger        =  6,
00886     //        ErrorTrigger       = 15
00887 
00888   // fill a histogram with the trigger type, for normalization fill also last bin
00889     // ErrorTrigger + 1
00890     double triggerType = static_cast<double> (e.experimentType()) + 0.001;
00891     double triggerTypeLast = static_cast<double> (edm::EventAuxiliary::ExperimentType::ErrorTrigger)
00892                             + 0.001;
00893     triggerType_->Fill(triggerType);
00894     triggerType_->Fill(triggerTypeLast + 1);
00895 
00896     // filter only if trigger type is greater than 0, negative values disable filtering
00897     if (filterTriggerType_ >= 0) {
00898 
00899         // now filter, for real data only
00900         if (e.isRealData()) {
00901             if (!(e.experimentType() == filterTriggerType_)) {
00902 
00903                 edm::LogInfo("L1TdeRCT") << "\n Event of TriggerType "
00904                         << e.experimentType() << " rejected" << std::endl;
00905                 return;
00906 
00907             }
00908         }
00909 
00910     }
00911 
00912   // for GT decision word
00913 //  edm::ESHandle<L1GtTriggerMenu> menuRcd;
00914   edm::Handle< L1GlobalTriggerReadoutRecord > gtRecord;
00915 
00916   // get GT trigger menu, maps algorithms to the bits read out
00917 //  c.get<L1GtTriggerMenuRcd>().get(menuRcd) ;
00918 //  const L1GtTriggerMenu* menu = menuRcd.product();
00919 
00920   // get GT decision word
00921   //e.getByLabel( edm::InputTag("gtDigis"), gtRecord);
00922   e.getByLabel( gtDigisLabel_ , gtRecord );
00923   const DecisionWord dWord = gtRecord->decisionWord();  // this will get the decision word *before* masking disabled bits
00924  int effEGThresholdBitNumber = 999;
00925   if (gtEGAlgoName_ == "L1_SingleEG1")
00926     {
00927       effEGThresholdBitNumber = 46;
00928     }
00929   if (gtEGAlgoName_ == "L1_SingleEG5_0001")
00930     {
00931       effEGThresholdBitNumber = 47;
00932     }
00933   if (gtEGAlgoName_ == "L1_SingleEG8_0001")
00934     {
00935       effEGThresholdBitNumber = 48;
00936     }
00937   if (gtEGAlgoName_ == "L1_SingleEG10_0001")
00938     {
00939       effEGThresholdBitNumber = 49;
00940   }
00941   if (gtEGAlgoName_ == "L1_SingleEG12_0001")
00942     {
00943       effEGThresholdBitNumber = 50;
00944     }
00945   if (gtEGAlgoName_ == "L1_SingleEG15_0001")
00946     {
00947       effEGThresholdBitNumber = 51;
00948     }
00949   if (gtEGAlgoName_ == "L1_SingleEG20_0001")
00950     {
00951       effEGThresholdBitNumber = 52;
00952     }
00953 
00954   int algoBitNumber = 0;
00955   bool triggered = false;
00956   bool independent_triggered = false;
00957   DecisionWord::const_iterator algoItr;
00958   for (algoItr = dWord.begin(); algoItr != dWord.end(); algoItr++)
00959     {
00960       if (*algoItr)
00961         {
00962           triggerAlgoNumbers_->Fill(algoBitNumber);
00963           if (algoBitNumber == effEGThresholdBitNumber)
00964             {
00965               triggered = true;// Fill triggered events (numerator) here!
00966             }
00967           if (algoBitNumber <= 45 || algoBitNumber >= 53)
00968             {
00969               independent_triggered = true;// use the muon path only !
00970             }
00971         }
00972       algoBitNumber++;
00973     }
00974 
00975 
00976   if(triggered)
00977     trigCount++;
00978   else
00979     notrigCount++;
00980 
00981   // get TPGs
00982   edm::Handle<EcalTrigPrimDigiCollection> ecalTpData;
00983   edm::Handle<HcalTrigPrimDigiCollection> hcalTpData;
00984 
00985   // Get the RCT digis
00986   edm::Handle < L1CaloEmCollection > emData;
00987   edm::Handle < L1CaloRegionCollection > rgnData;
00988 
00989   // Get the RCT digis
00990   edm::Handle < L1CaloEmCollection > emEmul;
00991   edm::Handle < L1CaloRegionCollection > rgnEmul;
00992 
00993   // need to change to getByLabel
00994   // bool doEm = true; FIXME gcc461: variable 'doEm' set but not used
00995   // bool doHd = true; FIXME gcc461: variable 'doHd' set but not used
00996   bool doEcal = true;
00997   bool doHcal = true;
00998 
00999   // TPG, first try:
01000   e.getByLabel(ecalTPGData_,ecalTpData);
01001   e.getByLabel(hcalTPGData_,hcalTpData);
01002 
01003   if (!ecalTpData.isValid()) {
01004     edm::LogInfo("TPG DataNotFound") << "can't find EcalTrigPrimDigiCollection with label "
01005              << ecalTPGData_.label() ;
01006     if (verbose_)std::cout << "Can not find ecalTpData!" << std::endl ;
01007 
01008     doEcal = false ;
01009   }
01010 
01011   if(doEcal)
01012   {
01013   for(EcalTrigPrimDigiCollection::const_iterator iEcalTp = ecalTpData->begin(); iEcalTp != ecalTpData->end(); iEcalTp++)
01014     if(iEcalTp->compressedEt() > 0)
01015     {
01016 
01017   rctInputTPGEcalRank_ -> Fill(1.*(iEcalTp->compressedEt())) ;
01018 
01019   if(iEcalTp->id().ieta() > 0)
01020   {
01021   rctInputTPGEcalOccNoCut_ -> Fill(1.*(iEcalTp->id().ieta())-0.5,iEcalTp->id().iphi()) ;
01022   if(iEcalTp->compressedEt() > 3) rctInputTPGEcalOcc_ -> Fill(1.*(iEcalTp->id().ieta())-0.5,iEcalTp->id().iphi()) ;
01023   }
01024   else
01025   {
01026   rctInputTPGEcalOccNoCut_ -> Fill(1.*(iEcalTp->id().ieta())+0.5,iEcalTp->id().iphi()) ;
01027   if(iEcalTp->compressedEt() > 3) rctInputTPGEcalOcc_ -> Fill(1.*(iEcalTp->id().ieta())+0.5,iEcalTp->id().iphi()) ;
01028   }
01029 
01030 if(verbose_) std::cout << " ECAL data: Energy: " << iEcalTp->compressedEt() << " eta " << iEcalTp->id().ieta() << " phi " << iEcalTp->id().iphi() << std::endl ;
01031     }
01032    }
01033 
01034   if (!hcalTpData.isValid()) {
01035     edm::LogInfo("TPG DataNotFound") << "can't find HcalTrigPrimDigiCollection with label "
01036              << hcalTPGData_.label() ;
01037     if (verbose_)std::cout << "Can not find hcalTpData!" << std::endl ;
01038 
01039     doHcal = false ;
01040   }
01041 
01042 
01043   if(doHcal)
01044   {
01045 
01046   for(HcalTrigPrimDigiCollection::const_iterator iHcalTp = hcalTpData->begin(); iHcalTp != hcalTpData->end(); iHcalTp++)
01047   {
01048     int highSample=0;
01049     int highEt=0;
01050 
01051     for (int nSample = 0; nSample < 10; nSample++)
01052       {
01053   if (iHcalTp->sample(nSample).compressedEt() != 0)
01054     {
01055       if(verbose_) std::cout << "HCAL data: Et "
01056           << iHcalTp->sample(nSample).compressedEt()
01057           << "  fg "
01058           << iHcalTp->sample(nSample).fineGrain()
01059           << "  ieta " << iHcalTp->id().ieta()
01060           << "  iphi " << iHcalTp->id().iphi()
01061           << "  sample " << nSample
01062                       << std::endl ;
01063       if (iHcalTp->sample(nSample).compressedEt() > highEt)
01064         {
01065     highSample = nSample;
01066                 highEt =  iHcalTp->sample(nSample).compressedEt() ;
01067         }
01068     }
01069 
01070        }
01071 
01072      if(highEt != 0)
01073       {
01074                   if(iHcalTp->id().ieta() > 0)
01075                   rctInputTPGHcalOcc_ -> Fill(1.*(iHcalTp->id().ieta())-0.5,iHcalTp->id().iphi()) ;
01076                   else
01077                   rctInputTPGHcalOcc_ -> Fill(1.*(iHcalTp->id().ieta())+0.5,iHcalTp->id().iphi()) ;
01078                   rctInputTPGHcalSample_ -> Fill(highSample,highEt) ;
01079                   rctInputTPGHcalRank_ -> Fill(highEt) ;
01080        }
01081 
01082     }
01083   }
01084 
01085 
01086   e.getByLabel(rctSourceData_,rgnData);
01087   e.getByLabel(rctSourceEmul_,rgnEmul);
01088 
01089   if (!rgnData.isValid()) {
01090     edm::LogInfo("DataNotFound") << "can't find L1CaloRegionCollection with label "
01091              << rctSourceData_.label() ;
01092     if (verbose_)std::cout << "Can not find rgnData!" << std::endl ;
01093     // doHd = false;
01094   }
01095 
01096 //  if ( doHd ) {
01097   if (!rgnEmul.isValid()) {
01098     edm::LogInfo("DataNotFound") << "can't find L1CaloRegionCollection with label "
01099              << rctSourceEmul_.label() ;
01100     // doHd = false;
01101     if (verbose_)std::cout << "Can not find rgnEmul!" << std::endl ;
01102   }
01103 //  }
01104 
01105 
01106   e.getByLabel(rctSourceData_,emData);
01107   e.getByLabel(rctSourceEmul_,emEmul);
01108 
01109   if (!emData.isValid()) {
01110     edm::LogInfo("DataNotFound") << "can't find L1CaloEmCollection with label "
01111              << rctSourceData_.label() ;
01112     if (verbose_)std::cout << "Can not find emData!" << std::endl ;
01113     // doEm = false;
01114   }
01115 
01116 //  if ( doEm ) {
01117 
01118   if (!emEmul.isValid()) {
01119     edm::LogInfo("DataNotFound") << "can't find L1CaloEmCollection with label "
01120              << rctSourceEmul_.label() ;
01121     if (verbose_)std::cout << "Can not find emEmul!" << std::endl ;
01122     // doEm = false;
01123     return ;
01124   }
01125 
01126 //  }
01127 
01128 
01129   // Isolated and non-isolated EM
01130 
01131   // StepI: Reset
01132 
01133   int nelectrIsoData = 0;
01134   int nelectrNisoData = 0;
01135   int nelectrIsoEmul = 0;
01136   int nelectrNisoEmul = 0;
01137 
01138   int electronDataRank[2][PhiEtaMax]={{0}};
01139   int electronDataEta[2][PhiEtaMax]={{0}};
01140   int electronDataPhi[2][PhiEtaMax]={{0}};
01141   int electronEmulRank[2][PhiEtaMax]={{0}};
01142   int electronEmulEta[2][PhiEtaMax]={{0}};
01143   int electronEmulPhi[2][PhiEtaMax]={{0}};
01144 
01145     // region/bit arrays
01146   int nRegionData = 0;
01147   int nRegionEmul = 0;
01148 
01149   int regionDataRank[PhiEtaMax] = {0};
01150   int regionDataEta [PhiEtaMax] = {0};
01151   int regionDataPhi [PhiEtaMax] = {0};
01152 
01153   bool regionDataOverFlow [PhiEtaMax] = {false};
01154   bool regionDataTauVeto  [PhiEtaMax] = {false};
01155   bool regionDataMip      [PhiEtaMax] = {false};
01156   bool regionDataQuiet    [PhiEtaMax] = {false};
01157   bool regionDataHfPlusTau[PhiEtaMax] = {false};
01158 
01159   int regionEmulRank[PhiEtaMax] = {0};
01160   int regionEmulEta [PhiEtaMax] = {0};
01161   int regionEmulPhi [PhiEtaMax] = {0};
01162 
01163   bool regionEmulOverFlow [PhiEtaMax] = {false};
01164   bool regionEmulTauVeto  [PhiEtaMax] = {false};
01165   bool regionEmulMip      [PhiEtaMax] = {false};
01166   bool regionEmulQuiet    [PhiEtaMax] = {false};
01167   bool regionEmulHfPlusTau[PhiEtaMax] = {false};
01168 
01169 if(first)
01170 {
01171   first = false ;
01172 }
01173 
01174 
01175   // StepII: fill variables
01176 
01177   for (L1CaloEmCollection::const_iterator iem = emEmul->begin();
01178        iem != emEmul->end();
01179        iem++)
01180   {
01181     if(iem->rank() >= 1)
01182     {
01183       if(iem->isolated())
01184       {
01185         rctIsoEmEmulOcc_->Fill(iem->regionId().ieta(), iem->regionId().iphi());
01186 
01187         // to  show bad channles in the 2D efficiency plots
01188         rctIsoEmIneffOcc_->Fill (iem->regionId().ieta(), iem->regionId().iphi(), 0.01);
01189         rctIsoEmEff1Occ_->Fill  (iem->regionId().ieta(), iem->regionId().iphi(), 0.01);
01190 
01191         int channel;
01192 
01193         channel=PHIBINS*iem->regionId().ieta()+iem->regionId().iphi();
01194         rctIsoEmEmulOcc1D_->Fill(channel);
01195         electronEmulRank[0][nelectrIsoEmul]=iem->rank() ;
01196         electronEmulEta[0][nelectrIsoEmul]=iem->regionId().ieta();
01197         electronEmulPhi[0][nelectrIsoEmul]=iem->regionId().iphi();
01198         nelectrIsoEmul++ ;
01199       }
01200 
01201       else
01202       {
01203         rctNisoEmEmulOcc_->Fill(iem->regionId().ieta(), iem->regionId().iphi());
01204 
01205         // to  show bad channles in the 2D efficiency plots
01206         rctNisoEmIneffOcc_->Fill (iem->regionId().ieta(), iem->regionId().iphi(), 0.01);
01207         rctNisoEmEff1Occ_->Fill  (iem->regionId().ieta(), iem->regionId().iphi(), 0.01);
01208 
01209         int channel;
01210 //
01211 
01212         channel=PHIBINS*iem->regionId().ieta()+iem->regionId().iphi();
01213         rctNisoEmEmulOcc1D_->Fill(channel);
01214         electronEmulRank[1][nelectrNisoEmul]=iem->rank() ;
01215         electronEmulEta[1][nelectrNisoEmul]=iem->regionId().ieta();
01216         electronEmulPhi[1][nelectrNisoEmul]=iem->regionId().iphi();
01217         nelectrNisoEmul++ ;
01218       }
01219     }
01220   }
01221 
01222   for (L1CaloEmCollection::const_iterator iem = emData->begin();
01223        iem != emData->end();
01224        iem++)
01225   {
01226     if(iem->rank() >= 1)
01227     {
01228       if (iem->isolated())
01229       {
01230         rctIsoEmDataOcc_->Fill(iem->regionId().ieta(), iem->regionId().iphi());
01231 
01232         // new stuff to avoid 0's in emulator 2D //
01233         // rctIsoEmEmulOcc_->Fill(iem->regionId().ieta(), iem->regionId().iphi(),0.01);
01234         rctIsoEmOvereffOcc_->Fill (iem->regionId().ieta(),
01235                                    iem->regionId().iphi(), 0.01);
01236 
01237         int channel;
01238 
01239         channel=PHIBINS*iem->regionId().ieta()+iem->regionId().iphi();
01240         rctIsoEmDataOcc1D_->Fill(channel);
01241 
01242         // new stuff to avoid 0's
01243         // rctIsoEmEmulOcc1D_->Fill(channel);
01244 
01245         electronDataRank[0][nelectrIsoData]=iem->rank() ;
01246         electronDataEta[0][nelectrIsoData]=iem->regionId().ieta();
01247         electronDataPhi[0][nelectrIsoData]=iem->regionId().iphi();
01248         nelectrIsoData++ ;
01249       }
01250 
01251       else
01252       {
01253         rctNisoEmDataOcc_->Fill(iem->regionId().ieta(), iem->regionId().iphi());
01254 
01255         // new stuff to avoid 0's in emulator 2D //
01256         // rctNisoEmEmulOcc_->Fill(iem->regionId().ieta(), iem->regionId().iphi(),0.01);
01257         rctNisoEmOvereffOcc_->Fill (iem->regionId().ieta(),
01258                                     iem->regionId().iphi(), 0.01);
01259 
01260         int channel;
01261 
01262         channel=PHIBINS*iem->regionId().ieta()+iem->regionId().iphi();
01263         rctNisoEmDataOcc1D_->Fill(channel);
01264 
01265         // new stuff to avoid 0's
01266         // rctNisoEmEmulOcc1D_->Fill(channel);
01267 
01268         electronDataRank[1][nelectrNisoData]=iem->rank() ;
01269         electronDataEta[1][nelectrNisoData]=iem->regionId().ieta();
01270         electronDataPhi[1][nelectrNisoData]=iem->regionId().iphi();
01271         nelectrNisoData++ ;
01272       }
01273     }
01274   }
01275 
01276     // fill region/bit arrays for emulator
01277   for(L1CaloRegionCollection::const_iterator ireg = rgnEmul->begin();
01278       ireg != rgnEmul->end();
01279       ireg++)
01280   {
01281 //     std::cout << "Emul: " << nRegionEmul << " " << ireg->gctEta() << " " << ireg->gctPhi() << std::endl;
01282     if(ireg->overFlow())  rctBitEmulOverFlow2D_ ->Fill(ireg->gctEta(), ireg->gctPhi());
01283     if(ireg->tauVeto())   rctBitEmulTauVeto2D_  ->Fill(ireg->gctEta(), ireg->gctPhi());
01284     if(ireg->mip())       rctBitEmulMip2D_      ->Fill(ireg->gctEta(), ireg->gctPhi());
01285     if(ireg->quiet())     rctBitEmulQuiet2D_    ->Fill(ireg->gctEta(), ireg->gctPhi());
01286     if(ireg->fineGrain()) rctBitEmulHfPlusTau2D_->Fill(ireg->gctEta(), ireg->gctPhi());
01287     if(ireg->et() > 0)
01288     {
01289       rctRegEmulOcc1D_->Fill(PHIBINS*ireg->gctEta() + ireg->gctPhi());
01290       rctRegEmulOcc2D_->Fill(ireg->gctEta(), ireg->gctPhi());
01291     }
01292 
01293     // to show bad channels in 2D efficiency plots:
01294     if(ireg->overFlow()) {
01295       rctBitUnmatchedEmulOverFlow2D_->Fill (ireg->gctEta(), ireg->gctPhi(), 0.01);
01296       rctBitMatchedOverFlow2D_->Fill       (ireg->gctEta(), ireg->gctPhi(), 0.01);
01297     }
01298 
01299     if(ireg->tauVeto()) {
01300       rctBitUnmatchedEmulTauVeto2D_->Fill (ireg->gctEta(), ireg->gctPhi(), 0.01);
01301       rctBitMatchedTauVeto2D_->Fill       (ireg->gctEta(), ireg->gctPhi(), 0.01);
01302     }
01303 
01304     if(ireg->mip()) {
01305       rctBitUnmatchedEmulMip2D_->Fill (ireg->gctEta(), ireg->gctPhi(), 0.01);
01306       rctBitMatchedMip2D_->Fill       (ireg->gctEta(), ireg->gctPhi(), 0.01);
01307     }
01308 
01309     if(ireg->quiet()) {
01310       rctBitUnmatchedEmulQuiet2D_->Fill (ireg->gctEta(), ireg->gctPhi(), 0.01);
01311       rctBitMatchedQuiet2D_->Fill       (ireg->gctEta(), ireg->gctPhi(), 0.01);
01312     }
01313 
01314     if(ireg->fineGrain()) {
01315       rctBitUnmatchedEmulHfPlusTau2D_->Fill (ireg->gctEta(), ireg->gctPhi(), 0.01);
01316       rctBitMatchedHfPlusTau2D_->Fill       (ireg->gctEta(), ireg->gctPhi(), 0.01);
01317     }
01318 
01319     if(ireg->et() > 0) {
01320       rctRegUnmatchedEmulOcc2D_->Fill (ireg->gctEta(), ireg->gctPhi(), 0.01);
01321       rctRegMatchedOcc2D_->Fill       (ireg->gctEta(), ireg->gctPhi(), 0.01);
01322 /*      rctRegDeltaEtOcc2D_->Fill       (ireg->gctEta(), ireg->gctPhi(), 0.01); */
01323     }
01324 
01325     nRegionEmul = PHIBINS * ireg->gctEta() + ireg->gctPhi();
01326 
01327     regionEmulRank     [nRegionEmul] = ireg->et() ;
01328     regionEmulEta      [nRegionEmul] = ireg->gctEta();
01329     regionEmulPhi      [nRegionEmul] = ireg->gctPhi();
01330     regionEmulOverFlow [nRegionEmul] = ireg->overFlow();
01331     regionEmulTauVeto  [nRegionEmul] = ireg->tauVeto();
01332     regionEmulMip      [nRegionEmul] = ireg->mip();
01333     regionEmulQuiet    [nRegionEmul] = ireg->quiet();
01334     regionEmulHfPlusTau[nRegionEmul] = ireg->fineGrain();
01335   }
01336       // fill region/bit arrays for hardware
01337   for(L1CaloRegionCollection::const_iterator ireg = rgnData->begin();
01338       ireg != rgnData->end();
01339       ireg++)
01340   {
01341 //     std::cout << "Data: " << nRegionData << " " << ireg->gctEta() << " " << ireg->gctPhi() << std::endl;
01342     if(ireg->overFlow())  rctBitDataOverFlow2D_ ->Fill(ireg->gctEta(), ireg->gctPhi());
01343     if(ireg->tauVeto())   rctBitDataTauVeto2D_  ->Fill(ireg->gctEta(), ireg->gctPhi());
01344     if(ireg->mip())       rctBitDataMip2D_      ->Fill(ireg->gctEta(), ireg->gctPhi());
01345     if(ireg->quiet())     rctBitDataQuiet2D_    ->Fill(ireg->gctEta(), ireg->gctPhi());
01346     if(ireg->fineGrain()) rctBitDataHfPlusTau2D_->Fill(ireg->gctEta(), ireg->gctPhi());
01347     if(ireg->et() > 0)
01348       {
01349       rctRegDataOcc1D_      ->Fill(PHIBINS*ireg->gctEta() + ireg->gctPhi());
01350       rctRegDataOcc2D_      ->Fill(ireg->gctEta(), ireg->gctPhi());
01351       }
01352     // to show bad channels in 2D inefficiency:
01353     // if(ireg->overFlow())  rctBitEmulOverFlow2D_ ->Fill(ireg->gctEta(), ireg->gctPhi(), 0.01);
01354     // if(ireg->tauVeto())   rctBitEmulTauVeto2D_  ->Fill(ireg->gctEta(), ireg->gctPhi(), 0.01);
01355     // if(ireg->mip())       rctBitEmulMip2D_      ->Fill(ireg->gctEta(), ireg->gctPhi(), 0.01);
01356     // if(ireg->quiet())     rctBitEmulQuiet2D_    ->Fill(ireg->gctEta(), ireg->gctPhi(), 0.01);
01357     // if(ireg->fineGrain()) rctBitEmulHfPlusTau2D_->Fill(ireg->gctEta(), ireg->gctPhi(), 0.01);
01358     // if(ireg->et() > 0)    rctRegEmulOcc2D_      ->Fill(ireg->gctEta(), ireg->gctPhi(), 0.01);
01359     if(ireg->overFlow())  rctBitUnmatchedDataOverFlow2D_ ->Fill(ireg->gctEta(), ireg->gctPhi(), 0.01);
01360     if(ireg->tauVeto())   rctBitUnmatchedDataTauVeto2D_  ->Fill(ireg->gctEta(), ireg->gctPhi(), 0.01);
01361     if(ireg->mip())       rctBitUnmatchedDataMip2D_      ->Fill(ireg->gctEta(), ireg->gctPhi(), 0.01);
01362     if(ireg->quiet())     rctBitUnmatchedDataQuiet2D_    ->Fill(ireg->gctEta(), ireg->gctPhi(), 0.01);
01363     if(ireg->fineGrain()) rctBitUnmatchedDataHfPlusTau2D_->Fill(ireg->gctEta(), ireg->gctPhi(), 0.01);
01364     if(ireg->et() > 0)    rctRegUnmatchedDataOcc2D_      ->Fill(ireg->gctEta(), ireg->gctPhi(), 0.01);
01365 
01366     nRegionData = PHIBINS * ireg->gctEta() + ireg->gctPhi();
01367 
01368     regionDataRank     [nRegionData] = ireg->et() ;
01369     regionDataEta      [nRegionData] = ireg->gctEta();
01370     regionDataPhi      [nRegionData] = ireg->gctPhi();
01371     regionDataOverFlow [nRegionData] = ireg->overFlow();
01372     regionDataTauVeto  [nRegionData] = ireg->tauVeto();
01373     regionDataMip      [nRegionData] = ireg->mip();
01374     regionDataQuiet    [nRegionData] = ireg->quiet();
01375     regionDataHfPlusTau[nRegionData] = ireg->fineGrain();
01376   }
01377 
01378  if(verbose_)
01379 {
01380   std::cout << "I found Data! Iso: " << nelectrIsoData << " Niso: " << nelectrNisoData <<  std::endl ;
01381   for(int i=0; i<nelectrIsoData; i++)
01382   std::cout << " Iso Energy " << electronDataRank[0][i] << " eta " << electronDataEta[0][i] << " phi " << electronDataPhi[0][i] << std::endl ;
01383   for(int i=0; i<nelectrNisoData; i++)
01384   std::cout << " Niso Energy " << electronDataRank[1][i] << " eta " << electronDataEta[1][i] << " phi " << electronDataPhi[1][i] << std::endl ;
01385 
01386   std::cout << "I found Emul! Iso: " << nelectrIsoEmul << " Niso: " << nelectrNisoEmul <<  std::endl ;
01387   for(int i=0; i<nelectrIsoEmul; i++)
01388   std::cout << " Iso Energy " << electronEmulRank[0][i] << " eta " << electronEmulEta[0][i] << " phi " << electronEmulPhi[0][i] << std::endl ;
01389   for(int i=0; i<nelectrNisoEmul; i++)
01390   std::cout << " Niso Energy " << electronEmulRank[1][i] << " eta " << electronEmulEta[1][i] << " phi " << electronEmulPhi[1][i] << std::endl ;
01391 
01392   std::cout << "I found Data! Regions: " << PhiEtaMax <<  std::endl ;
01393   for(int i=0; i<(int)PhiEtaMax; i++)
01394  if(regionDataRank[i] !=0 )  std::cout << " Energy " << regionDataRank[i] << " eta " << regionDataEta[i] << " phi " << regionDataPhi[i] << std::endl ;
01395 
01396   std::cout << "I found Emul! Regions: " << PhiEtaMax <<  std::endl ;
01397   for(int i=0; i<(int)PhiEtaMax; i++)
01398  if(regionEmulRank[i] !=0 )  std::cout << " Energy " << regionEmulRank[i] << " eta " << regionEmulEta[i] << " phi " << regionEmulPhi[i] << std::endl ;
01399 }
01400 
01401   // StepIII: calculate and fill
01402 
01403   for(int k=0; k<2; k++)
01404   {
01405     int nelectrE, nelectrD;
01406 
01407     if(k==0)
01408     {
01409       nelectrE=nelectrIsoEmul;
01410       nelectrD=nelectrIsoData;
01411     }
01412 
01413     else
01414     {
01415       nelectrE=nelectrNisoEmul;
01416       nelectrD=nelectrNisoData;
01417     }
01418 
01419     for(int i = 0; i < nelectrE; i++)
01420       {
01421         //bool triggered = l1SingleEG2; //false; //HACK until true trigger implimented
01422         double trigThresh = doubleThreshold_;  //ditto
01423           if(singlechannelhistos_) {
01424             int chnl=PHIBINS*electronEmulEta[k][i]+electronEmulPhi[k][i];
01425             if(k==1 && independent_triggered) { //non-iso
01426               //std::cout << "eta " << electronEmulEta[k][i] << " phi " << electronEmulPhi[k][i] << " with rank " <<  electronEmulRank[k][i] << std::endl;
01427               trigEffOcc_[chnl]->Fill(electronEmulRank[k][i]);
01428 //          }
01429             if(triggered)
01430               trigEffTriggOcc_[chnl]->Fill(electronEmulRank[k][i]); }
01431           }
01432           //find number of objects with rank above 2x trigger threshold
01433           //and number after requiring a trigger too
01434           if(electronEmulRank[k][i]>=trigThresh){
01435             if(k==1 && independent_triggered) { //non-iso
01436               trigEffThreshOcc_->Fill(electronEmulEta[k][i], electronEmulPhi[k][i]);
01437               trigEffTriggThreshOcc_->Fill(electronEmulEta[k][i], electronEmulPhi[k][i], 0.01);
01438 //          }
01439             if(triggered)
01440               trigEffTriggThreshOcc_->Fill(electronEmulEta[k][i], electronEmulPhi[k][i], 0.98001); }
01441           }
01442 
01443 
01444 
01445         Bool_t found = kFALSE;
01446 
01447         for(int j = 0; j < nelectrD; j++)
01448       {
01449         if(electronEmulEta[k][i]==electronDataEta[k][j] &&
01450            electronEmulPhi[k][i]==electronDataPhi[k][j])
01451         {
01452           if(k==0)
01453           {
01454             rctIsoEmEff1Occ_->Fill(electronEmulEta[k][i], electronEmulPhi[k][i], 0.98001);
01455             // Weight is for ROOT; when added to initial weight of 0.01, should just exceed 0.99
01456 
01457             int chnl;
01458 
01459             chnl=PHIBINS*electronEmulEta[k][i]+electronEmulPhi[k][i];
01460             rctIsoEmEff1Occ1D_->Fill(chnl);
01461             if(singlechannelhistos_)
01462             {
01463               int energy_difference;
01464 
01465               energy_difference=(electronEmulRank[k][i] - electronDataRank[k][j]);
01466               rctIsoEffChannel_[chnl]->Fill(energy_difference);
01467             }
01468             
01469             if(electronEmulRank[k][i]==electronDataRank[k][j])
01470             {
01471               rctIsoEmEff2Occ1D_->Fill(chnl);
01472               rctIsoEmEff2Occ_->Fill(electronEmulEta[k][i], electronEmulPhi[k][i], 0.98012);
01473               // Weight is for ROOT; should just exceed 0.99
01474               // NOTE: Weight is different for eff 2 because this isn't filled initially
01475               // for current definition of Eff2 and Ineff2 we need to add additional
01476               // factor 0.99 since we divide over eff1 which is 0.99001 e.g. we use 0.99001**2 !
01477               rctIsoEmIneff2Occ_->Fill(electronEmulEta[k][i], electronEmulPhi[k][i], 0.0099);
01478             }
01479             else
01480             {
01481               rctIsoEmIneff2Occ1D_->Fill(chnl);
01482               rctIsoEmIneff2Occ_->Fill(electronEmulEta[k][i], electronEmulPhi[k][i], 0.9801);
01483               //Check for the bit that is different and store it
01484               bitset<8> bitDifference( electronEmulRank[k][i]^electronDataRank[k][j] );
01485               for( size_t n=0; n < bitDifference.size(); n++){
01486                   if( n < 4 ){ rctIsoEmBitDiff_->Fill( electronEmulEta[k][i], electronEmulPhi[k][i]+n*0.25, bitDifference[n] ); }
01487                   if( n >= 4 ){ rctIsoEmBitDiff_->Fill( electronEmulEta[k][i]+0.5, electronEmulPhi[k][i]+(n-4)*0.25, bitDifference[n] ); }
01488               }
01489             }
01490           }
01491 
01492           else
01493           {
01494             rctNisoEmEff1Occ_->Fill(electronEmulEta[k][i], electronEmulPhi[k][i], 0.98001);
01495             // Weight is for ROOT; when added to initial weight of 0.01, should just exceed 0.99
01496 
01497             int chnl;
01498 
01499             chnl=PHIBINS*electronEmulEta[k][i]+electronEmulPhi[k][i];
01500             rctNisoEmEff1Occ1D_->Fill(chnl);
01501             if(singlechannelhistos_)
01502             {
01503               int energy_difference;
01504 
01505               energy_difference=(electronEmulRank[k][i] - electronDataRank[k][j]) ;
01506               rctNisoEffChannel_[chnl]->Fill(energy_difference) ;
01507             }
01508 
01509 
01510             if(electronEmulRank[k][i]==electronDataRank[k][j])
01511             {
01512               rctNisoEmEff2Occ1D_->Fill(chnl);
01513               rctNisoEmEff2Occ_->Fill(electronEmulEta[k][i], electronEmulPhi[k][i], 0.98012);
01514               // Weight is for ROOT; should just exceed 0.99
01515               // NOTE: Weight is different for eff 2 because this isn't filled initially
01516               // see comments fo Iso
01517               rctNisoEmIneff2Occ_->Fill(electronEmulEta[k][i], electronEmulPhi[k][i], 0.0099);
01518             }
01519             else
01520             {
01521               rctNisoEmIneff2Occ1D_->Fill(chnl);
01522               rctNisoEmIneff2Occ_->Fill(electronEmulEta[k][i], electronEmulPhi[k][i], 0.9801);
01523               //Check for the bit that is different and store it
01524               bitset<8> bitDifference( electronEmulRank[k][i]^electronDataRank[k][j] );
01525               for( size_t n=0; n < bitDifference.size(); n++){
01526                   if( n < 4 ){ rctNIsoEmBitDiff_->Fill( electronEmulEta[k][i], electronEmulPhi[k][i]+n*0.25, bitDifference[n] ); }
01527                   if( n >= 4 ){ rctNIsoEmBitDiff_->Fill( electronEmulEta[k][i]+0.5, electronEmulPhi[k][i]+(n-4)*0.25, bitDifference[n] ); }
01528               }
01529             }
01530           }
01531 
01532           found = kTRUE;
01533         }
01534       }
01535 
01536       if(found == kFALSE)
01537       {
01538         if(k==0)
01539         {
01540           rctIsoEmIneffOcc_->Fill(electronEmulEta[k][i], electronEmulPhi[k][i], 0.98);
01541           // Weight is for ROOT; when added to initial weight of 0.01, should equal 0.99
01542 
01543           int chnl;
01544 
01545           //Store the bit map for the emulator
01546           bitset<8> bit( electronEmulRank[k][i] );
01547           for( size_t n=0; n < bit.size(); n++){
01548              if( n < 4 ){ rctIsoEmBitOff_->Fill( electronEmulEta[k][i], electronEmulPhi[k][i]+n*0.25, bit[n] ); }
01549              if( n >= 4 ){ rctIsoEmBitOff_->Fill( electronEmulEta[k][i]+0.5, electronEmulPhi[k][i]+(n-4)*0.25, bit[n] ); }
01550           }
01551 
01552           chnl=PHIBINS*electronEmulEta[k][i]+electronEmulPhi[k][i];
01553           rctIsoEmIneffOcc1D_->Fill(chnl);
01554           if(singlechannelhistos_)
01555           {
01556             rctIsoIneffChannel_[chnl]->Fill(electronEmulRank[k][i]);
01557           }
01558         }
01559 
01560         else
01561         {
01562           rctNisoEmIneffOcc_->Fill(electronEmulEta[k][i], electronEmulPhi[k][i], 0.98);
01563           // Weight is for ROOT; when added to initial weight of 0.01, should equal 0.99
01564 
01565           int chnl;
01566 
01567           chnl=PHIBINS*electronEmulEta[k][i]+electronEmulPhi[k][i];
01568           rctNisoEmIneffOcc1D_->Fill(chnl);
01569 
01570           //Store the bit map for the emulator
01571           bitset<8> bit( electronEmulRank[k][i] );
01572           for( size_t n=0; n < bit.size(); n++){
01573              if( n < 4 ){ rctNIsoEmBitOff_->Fill( electronEmulEta[k][i], electronEmulPhi[k][i]+n*0.25, bit[n] ); }
01574              if( n >= 4 ){ rctNIsoEmBitOff_->Fill( electronEmulEta[k][i]+0.5, electronEmulPhi[k][i]+(n-4)*0.25, bit[n] ); }
01575           }
01576 
01577           if(singlechannelhistos_)
01578           {
01579             rctNisoIneffChannel_[chnl]->Fill(electronEmulRank[k][i]);
01580           }
01581         }
01582       }
01583 
01584     }
01585 
01586     DivideME1D(rctIsoEmEff1Occ1D_, rctIsoEmEmulOcc1D_, rctIsoEmEff1oneD_);
01587     DivideME2D(rctIsoEmEff1Occ_, rctIsoEmEmulOcc_, rctIsoEmEff1_) ;
01588 //    DivideME1D(rctIsoEmEff2Occ1D_, rctIsoEmEmulOcc1D_, rctIsoEmEff2oneD_);
01589 //    DivideME2D(rctIsoEmEff2Occ_, rctIsoEmEmulOcc_, rctIsoEmEff2_) ;
01590     DivideME1D(rctIsoEmEff2Occ1D_, rctIsoEmEff1Occ1D_, rctIsoEmEff2oneD_);
01591     DivideME2D(rctIsoEmEff2Occ_, rctIsoEmEff1Occ_, rctIsoEmEff2_) ;
01592 //    DivideME1D(rctIsoEmIneff2Occ1D_, rctIsoEmEmulOcc1D_, rctIsoEmIneff2oneD_);
01593 //    DivideME2D(rctIsoEmIneff2Occ_, rctIsoEmEmulOcc_, rctIsoEmIneff2_) ;
01594     DivideME1D(rctIsoEmIneff2Occ1D_, rctIsoEmEff1Occ1D_, rctIsoEmIneff2oneD_);
01595     DivideME2D(rctIsoEmIneff2Occ_, rctIsoEmEff1Occ_, rctIsoEmIneff2_) ;
01596 
01597     DivideME1D(rctNisoEmEff1Occ1D_, rctNisoEmEmulOcc1D_, rctNisoEmEff1oneD_);
01598     DivideME2D(rctNisoEmEff1Occ_, rctNisoEmEmulOcc_, rctNisoEmEff1_);
01599 //    DivideME1D(rctNisoEmEff2Occ1D_, rctNisoEmEmulOcc1D_, rctNisoEmEff2oneD_);
01600 //    DivideME2D(rctNisoEmEff2Occ_, rctNisoEmEmulOcc_, rctNisoEmEff2_);
01601     DivideME1D(rctNisoEmEff2Occ1D_, rctNisoEmEff1Occ1D_, rctNisoEmEff2oneD_);
01602     DivideME2D(rctNisoEmEff2Occ_, rctNisoEmEff1Occ_, rctNisoEmEff2_);
01603 //    DivideME1D(rctNisoEmIneff2Occ1D_, rctNisoEmEmulOcc1D_, rctNisoEmIneff2oneD_);
01604 //    DivideME2D(rctNisoEmIneff2Occ_, rctNisoEmEmulOcc_, rctNisoEmIneff2_);
01605     DivideME1D(rctNisoEmIneff2Occ1D_, rctNisoEmEff1Occ1D_, rctNisoEmIneff2oneD_);
01606     DivideME2D(rctNisoEmIneff2Occ_, rctNisoEmEff1Occ_, rctNisoEmIneff2_);
01607 
01608     DivideME1D(rctIsoEmIneffOcc1D_, rctIsoEmEmulOcc1D_, rctIsoEmIneff1D_);
01609     DivideME2D(rctIsoEmIneffOcc_, rctIsoEmEmulOcc_, rctIsoEmIneff_);
01610     DivideME1D(rctNisoEmIneffOcc1D_, rctNisoEmEmulOcc1D_, rctNisoEmIneff1D_);
01611     DivideME2D(rctNisoEmIneffOcc_, rctNisoEmEmulOcc_, rctNisoEmIneff_);
01612 
01613     DivideME2D(trigEffTriggThreshOcc_, trigEffThreshOcc_, trigEffThresh_);
01614     if(singlechannelhistos_) {
01615       for(int i = 0; i < nelectrE; i++)
01616         {
01617           int chnl=PHIBINS*electronEmulEta[k][i]+electronEmulPhi[k][i];
01618           DivideME1D(trigEffTriggOcc_[chnl], trigEffOcc_[chnl], trigEff_[chnl]);
01619         }
01620     }
01621 
01622     for(int i = 0; i < nelectrD; i++)
01623     {
01624       Bool_t found = kFALSE;
01625 
01626       for(int j = 0; j < nelectrE; j++)
01627       {
01628         if(electronEmulEta[k][j]==electronDataEta[k][i] &&
01629            electronEmulPhi[k][j]==electronDataPhi[k][i])
01630         {
01631           found = kTRUE;
01632         }
01633       }
01634 
01635       if(found == kFALSE)
01636       {
01637         if(k==0)
01638         {
01639           rctIsoEmOvereffOcc_->Fill(electronDataEta[k][i], electronDataPhi[k][i], 0.98);
01640           // Weight is for ROOT; when added to initial weight of 0.01, should equal 0.99
01641 
01642           int chnl;
01643 
01644           //Store the bit map for the emulator
01645           bitset<8> bit( electronDataRank[k][i] );
01646           for( size_t n=0; n < bit.size(); n++){
01647              if( n < 4 ){ rctIsoEmBitOn_->Fill( electronDataEta[k][i], electronDataPhi[k][i]+n*0.25, bit[n] ); }
01648              if( n >= 4 ){ rctIsoEmBitOn_->Fill( electronDataEta[k][i]+0.5, electronDataPhi[k][i]+(n-4)*0.25, bit[n] ); }
01649           }
01650 
01651           chnl=PHIBINS*electronDataEta[k][i]+electronDataPhi[k][i];
01652           rctIsoEmOvereffOcc1D_->Fill(chnl);
01653 
01654           if(singlechannelhistos_)
01655           {
01656             rctIsoOvereffChannel_[chnl]->Fill(electronDataRank[k][i]);
01657           }
01658         }
01659 
01660         else
01661         {
01662           rctNisoEmOvereffOcc_->Fill(electronDataEta[k][i], electronDataPhi[k][i], 0.98);
01663           // Weight is for ROOT; when added to initial weight of 0.01, should equal 0.99
01664 
01665           int chnl;
01666 
01667           //Store the bit map for the emulator
01668           bitset<8> bit( electronDataRank[k][i] );
01669           for( size_t n=0; n < bit.size(); n++){
01670              if( n < 4 ){ rctNIsoEmBitOn_->Fill( electronDataEta[k][i], electronDataPhi[k][i]+n*0.25, bit[n] ); }
01671              if( n >= 4 ){ rctNIsoEmBitOn_->Fill( electronDataEta[k][i]+0.5, electronDataPhi[k][i]+(n-4)*0.25, bit[n] ); }
01672           }
01673 
01674           chnl=PHIBINS*electronDataEta[k][i]+electronDataPhi[k][i];
01675           rctNisoEmOvereffOcc1D_->Fill(chnl) ;
01676 
01677           if(singlechannelhistos_)
01678           {
01679             rctNisoOvereffChannel_[chnl]->Fill(electronDataRank[k][i]);
01680           }
01681         }
01682       }
01683     }
01684 
01685   }
01686 
01687     // we try new definition of overefficiency:
01688     DivideME1D(rctIsoEmOvereffOcc1D_, rctIsoEmDataOcc1D_, rctIsoEmOvereff1D_);
01689     DivideME2D(rctIsoEmOvereffOcc_, rctIsoEmDataOcc_, rctIsoEmOvereff_);
01690     DivideME1D(rctNisoEmOvereffOcc1D_, rctNisoEmDataOcc1D_, rctNisoEmOvereff1D_);
01691     DivideME2D(rctNisoEmOvereffOcc_, rctNisoEmDataOcc_, rctNisoEmOvereff_);
01692 
01693 
01694     // calculate region/bit information
01695   for(unsigned int i = 0; i < (int)PhiEtaMax; i++)
01696 {
01697       Bool_t regFound       = kFALSE;
01698       Bool_t overFlowFound  = kFALSE;
01699       Bool_t tauVetoFound   = kFALSE;
01700       Bool_t mipFound       = kFALSE;
01701       Bool_t quietFound     = kFALSE;
01702       Bool_t hfPlusTauFound = kFALSE;
01703 
01704 //       for(int j = 0; j < nRegionData; j++)
01705 //    {
01706 //         if(regionEmulEta[i] == regionDataEta[j] &&
01707 //            regionEmulPhi[i] == regionDataPhi[j])
01708 //         {
01709           if(regionDataRank[i] >= 1 && regionEmulRank[i] >= 1)
01710           {
01711             int chnl;
01712 
01713             chnl = PHIBINS*regionEmulEta[i] + regionEmulPhi[i];
01714             rctRegMatchedOcc1D_->Fill(chnl);
01715             rctRegMatchedOcc2D_->Fill(regionEmulEta[i], regionEmulPhi[i], 0.98001);
01716             // Weight is for ROOT; when added to initial weight of 0.01, should just exceed 0.99
01717 
01718             if(singlechannelhistos_) rctRegEffChannel_[chnl]->Fill(regionEmulRank[i] - regionDataRank[i]);
01719 
01720            // see comments for Iso Eff2
01721 
01722             if(regionEmulRank[i] == regionDataRank[i])
01723              {
01724              rctRegSpEffOcc1D_->Fill(chnl);
01725 //             rctRegSpEffOcc2D_->Fill(regionEmulEta[i], regionEmulPhi[i], 0.99001);
01726              rctRegSpEffOcc2D_->Fill(regionEmulEta[i], regionEmulPhi[i], 0.98012);
01727              rctRegSpIneffOcc2D_->Fill(regionEmulEta[i], regionEmulPhi[i], 0.0099);
01728              }
01729             else
01730              {
01731              rctRegSpIneffOcc1D_->Fill(chnl);
01732              rctRegSpIneffOcc2D_->Fill(regionEmulEta[i], regionEmulPhi[i], 0.9801);
01733 
01734               bitset<10> bitDifference( regionEmulRank[i]^regionDataRank[i] );
01735               for( size_t n=0; n < bitDifference.size(); n++){
01736                   if( n < 5 ){ rctRegBitDiff_->Fill( regionEmulEta[i], regionEmulPhi[i]+n*0.2, bitDifference[n] ); }
01737                   if( n >= 5 ){ rctRegBitDiff_->Fill( regionEmulEta[i]+0.5, regionEmulPhi[i]+(n-5)*0.2, bitDifference[n] ); }
01738               }
01739 
01740              }
01741             // Weight is for ROOT; should just exceed 0.99
01742             // NOTE: Weight is different for eff 2 because this isn't filled initially
01743 
01744             regFound = kTRUE;
01745           }
01746 
01747           if(regionEmulOverFlow[i] == true &&
01748              regionDataOverFlow[i] == true)
01749           {
01750             rctBitMatchedOverFlow2D_->Fill(regionEmulEta[i], regionEmulPhi[i], 0.98001);
01751             overFlowFound = kTRUE;
01752           }
01753 
01754           if(regionEmulTauVeto[i] == true &&
01755              regionDataTauVeto[i] == true)
01756           {
01757             rctBitMatchedTauVeto2D_->Fill(regionEmulEta[i], regionEmulPhi[i], 0.98001);
01758             tauVetoFound = kTRUE;
01759           }
01760 
01761           if (regionEmulMip[i] == true && regionDataMip[i] == true) {
01762             rctBitMatchedMip2D_->Fill (regionEmulEta[i], regionEmulPhi[i], 0.98001);
01763             mipFound = kTRUE;
01764           }
01765 
01766           if (regionEmulQuiet[i] == true && regionDataQuiet[i] == true) {
01767             rctBitMatchedQuiet2D_->Fill (regionEmulEta[i], regionEmulPhi[i], 0.98001);
01768             quietFound = kTRUE;
01769           }
01770 
01771           if (regionEmulHfPlusTau[i] == true && regionDataHfPlusTau[i] == true) {
01772             rctBitMatchedHfPlusTau2D_->Fill (regionEmulEta[i], regionEmulPhi[i], 0.98001);
01773             hfPlusTauFound = kTRUE;
01774           }
01775 
01776 
01777 //         }
01778 //       }
01779 
01780 
01781 
01782       if(regFound == kFALSE && regionEmulRank[i] >= 1 )
01783       {
01784         int chnl;
01785 
01786         bitset<10> bit( regionEmulRank[i] );
01787         for( size_t n=0; n < bit.size(); n++){
01788            if( n < 5 ){ rctRegBitOff_->Fill( regionEmulEta[i], regionEmulPhi[i]+n*0.2, bit[n] ); }
01789            if( n >= 5 ){ rctRegBitOff_->Fill( regionEmulEta[i]+0.5, regionEmulPhi[i]+(n-5)*0.2, bit[n] ); }
01790         }
01791 
01792         chnl = PHIBINS*regionEmulEta[i] + regionEmulPhi[i];
01793         rctRegUnmatchedEmulOcc1D_->Fill(chnl);
01794         rctRegUnmatchedEmulOcc2D_->Fill(regionEmulEta[i], regionEmulPhi[i],0.98);
01795         // Weight is for ROOT; when added to initial weight of 0.01, should equal 0.99
01796 
01797         if(singlechannelhistos_) rctRegIneffChannel_[chnl]->Fill(regionEmulRank[i]);
01798       }
01799 
01800       if(overFlowFound == kFALSE && regionEmulOverFlow[i] == true)
01801       {
01802         rctBitUnmatchedEmulOverFlow2D_->Fill(regionEmulEta[i], regionEmulPhi[i], 0.98);
01803       }
01804 
01805       if(tauVetoFound == kFALSE && regionEmulTauVeto[i] == true)
01806       {
01807         rctBitUnmatchedEmulTauVeto2D_->Fill(regionEmulEta[i], regionEmulPhi[i], 0.98);
01808       }
01809 
01810       if (mipFound == kFALSE && regionEmulMip[i] == true) {
01811         rctBitUnmatchedEmulMip2D_->Fill (regionEmulEta[i], regionEmulPhi[i], 0.98);
01812       }
01813 
01814       if (quietFound == kFALSE && regionEmulQuiet[i] == true) {
01815         rctBitUnmatchedEmulQuiet2D_->Fill (regionEmulEta[i], regionEmulPhi[i], 0.98);
01816       }
01817 
01818       if (hfPlusTauFound == kFALSE && regionEmulHfPlusTau[i] == true ) {
01819         rctBitUnmatchedEmulHfPlusTau2D_->Fill (regionEmulEta[i], regionEmulPhi[i], 0.98);
01820       }
01821 
01822 
01823 }
01824 
01825 
01826       DivideME1D(rctRegMatchedOcc1D_, rctRegEmulOcc1D_, rctRegEff1D_);
01827       DivideME2D(rctRegMatchedOcc2D_, rctRegEmulOcc2D_, rctRegEff2D_);
01828 //      DivideME1D(rctRegSpEffOcc1D_, rctRegEmulOcc1D_, rctRegSpEff1D_);
01829 //      DivideME2D(rctRegSpEffOcc2D_, rctRegEmulOcc2D_, rctRegSpEff2D_);
01830       DivideME1D(rctRegSpEffOcc1D_, rctRegMatchedOcc1D_, rctRegSpEff1D_);
01831       DivideME2D(rctRegSpEffOcc2D_, rctRegMatchedOcc2D_, rctRegSpEff2D_);
01832 //      DivideME1D(rctRegSpIneffOcc1D_, rctRegEmulOcc1D_, rctRegSpIneff1D_);
01833 //      DivideME2D(rctRegSpIneffOcc2D_, rctRegEmulOcc2D_, rctRegSpIneff2D_);
01834       DivideME1D(rctRegSpIneffOcc1D_, rctRegMatchedOcc1D_, rctRegSpIneff1D_);
01835       DivideME2D(rctRegSpIneffOcc2D_, rctRegMatchedOcc2D_, rctRegSpIneff2D_);
01836       DivideME2D(rctBitMatchedOverFlow2D_, rctBitEmulOverFlow2D_, rctBitOverFlowEff2D_);
01837       DivideME2D(rctBitMatchedTauVeto2D_, rctBitEmulTauVeto2D_, rctBitTauVetoEff2D_);
01838       DivideME2D (rctBitMatchedMip2D_, rctBitEmulMip2D_, rctBitMipEff2D_);
01839       // QUIETBIT: To add quiet bit information, uncomment following line:
01840       // DivideME2D (rctBitMatchedQuiet2D_, rctBitEmulQuiet2D_, rctBitQuietEff2D_);
01841       DivideME2D (rctBitMatchedHfPlusTau2D_, rctBitEmulHfPlusTau2D_, rctBitHfPlusTauEff2D_);
01842 
01843       DivideME1D (rctRegUnmatchedEmulOcc1D_, rctRegEmulOcc1D_, rctRegIneff1D_);
01844       DivideME2D (rctRegUnmatchedEmulOcc2D_, rctRegEmulOcc2D_, rctRegIneff2D_);
01845       DivideME2D (rctBitUnmatchedEmulOverFlow2D_, rctBitEmulOverFlow2D_, rctBitOverFlowIneff2D_);
01846       DivideME2D (rctBitUnmatchedEmulTauVeto2D_, rctBitEmulTauVeto2D_, rctBitTauVetoIneff2D_);
01847       DivideME2D (rctBitUnmatchedEmulMip2D_, rctBitEmulMip2D_, rctBitMipIneff2D_);
01848       // QUIETBIT: To add quiet bit information, uncomment the following line:
01849       // DivideME2D (rctBitUnmatchedEmulQuiet2D_, rctBitEmulQuiet2D_, rctBitQuietIneff2D_);
01850       DivideME2D (rctBitUnmatchedEmulHfPlusTau2D_, rctBitEmulHfPlusTau2D_, rctBitHfPlusTauIneff2D_);
01851 
01852 
01853   // for(int i = 0; i < nRegionData; i++)
01854   for (int i = 0; i < (int)PhiEtaMax; i++)
01855 {
01856       Bool_t regFound       = kFALSE;
01857       Bool_t overFlowFound  = kFALSE;
01858       Bool_t tauVetoFound   = kFALSE;
01859       Bool_t mipFound       = kFALSE;
01860       Bool_t quietFound     = kFALSE;
01861       Bool_t hfPlusTauFound = kFALSE;
01862 
01863 //       for(int j = 0; j < nRegionEmul; j++)
01864 //      {
01865 //         if(regionEmulEta[j] == regionDataEta[i] &&
01866 //            regionEmulPhi[j] == regionDataPhi[i])
01867 //         {
01868 
01869           if(regionEmulRank[i] >= 1 && regionDataRank[i] >= 1)
01870             regFound = kTRUE;
01871 
01872           if(regionDataOverFlow[i] == true &&
01873              regionEmulOverFlow[i] == true)
01874             overFlowFound = kTRUE;
01875 
01876           if(regionDataTauVeto[i] == true &&
01877              regionEmulTauVeto[i] == true)
01878             tauVetoFound = kTRUE;
01879 
01880           if (regionDataMip[i] == true && regionEmulMip[i] == true)
01881             mipFound = kTRUE;
01882 
01883           if (regionDataQuiet[i] == true && regionEmulQuiet[i] == true)
01884             quietFound = kTRUE;
01885 
01886           if (regionDataHfPlusTau[i] == true && regionEmulHfPlusTau[i] == true)
01887             hfPlusTauFound = kTRUE;
01888 //         }
01889 //       }
01890 
01891       if(regFound == kFALSE && regionDataRank[i] >= 1)
01892       {
01893         int chnl;
01894 
01895         bitset<10> bit( regionDataRank[i] );
01896         for( size_t n=0; n < bit.size(); n++){
01897             if( n < 5 ){ rctRegBitOn_->Fill( regionDataEta[i], regionDataPhi[i]+n*0.2, bit[n] ); }
01898             if( n >= 5 ){ rctRegBitOn_->Fill( regionDataEta[i]+0.5, regionDataPhi[i]+(n-5)*0.2, bit[n] ); }
01899         }
01900 
01901 
01902         chnl = PHIBINS*regionDataEta[i] + regionDataPhi[i];
01903         rctRegUnmatchedDataOcc1D_->Fill(chnl);
01904         rctRegUnmatchedDataOcc2D_->Fill(regionDataEta[i], regionDataPhi[i], 0.98);
01905         // Weight is for ROOT; when added to initial weight of 0.01, should equal 0.99
01906 
01907         // we try a new definition of overefficiency:
01908         // DivideME1D(rctRegUnmatchedDataOcc1D_, rctRegDataOcc1D_, rctRegOvereff1D_);
01909         // DivideME2D(rctRegUnmatchedDataOcc2D_, rctRegDataOcc2D_, rctRegOvereff2D_);
01910 
01911         if(singlechannelhistos_) rctRegOvereffChannel_[chnl]->Fill(regionDataRank[i]);
01912       }
01913 
01914       if(overFlowFound == kFALSE && regionDataOverFlow[i] == true )
01915       {
01916         rctBitUnmatchedDataOverFlow2D_->Fill(regionDataEta[i], regionDataPhi[i], 0.98);
01917       }
01918 
01919       if(tauVetoFound == kFALSE && regionDataTauVeto[i] == true )
01920       {
01921         rctBitUnmatchedDataTauVeto2D_->Fill(regionDataEta[i], regionDataPhi[i], 0.98);
01922       }
01923 
01924       if (mipFound == kFALSE && regionDataMip[i] == true ) {
01925         rctBitUnmatchedDataMip2D_->Fill (regionDataEta[i], regionDataPhi[i], 0.98);
01926       }
01927 
01928       if (quietFound == kFALSE && regionDataQuiet[i] == true ) {
01929         rctBitUnmatchedDataQuiet2D_->Fill (regionDataEta[i], regionDataPhi[i], 0.98);
01930       }
01931 
01932       if (hfPlusTauFound == kFALSE && regionDataHfPlusTau[i] == true ) {
01933         rctBitUnmatchedDataHfPlusTau2D_->Fill (regionDataEta[i], regionDataPhi[i], 0.98);
01934       }
01935 
01936 }
01937 
01938     // we try a new definition of overefficiency:
01939     DivideME1D(rctRegUnmatchedDataOcc1D_, rctRegDataOcc1D_, rctRegOvereff1D_);
01940     DivideME2D(rctRegUnmatchedDataOcc2D_, rctRegDataOcc2D_, rctRegOvereff2D_);
01941     DivideME2D(rctBitUnmatchedDataOverFlow2D_, rctBitDataOverFlow2D_, rctBitOverFlowOvereff2D_);
01942     DivideME2D(rctBitUnmatchedDataTauVeto2D_, rctBitDataTauVeto2D_, rctBitTauVetoOvereff2D_);
01943     DivideME2D (rctBitUnmatchedDataMip2D_, rctBitDataMip2D_,
01944           rctBitMipOvereff2D_);
01945     // QUIETBIT: To add quiet bit information, uncomment following 2 lines:
01946     // DivideME2D (rctBitUnmatchedDataQuiet2D_, rctBitDataQuiet2D_,
01947           // rctBitQuietOvereff2D_);
01948     DivideME2D (rctBitUnmatchedDataHfPlusTau2D_, rctBitDataHfPlusTau2D_,
01949           rctBitHfPlusTauOvereff2D_);
01950 
01951 }
01952 
01953 void L1TdeRCT::DivideME2D(MonitorElement* numerator, MonitorElement* denominator, MonitorElement* result){
01954 
01955    TH2F* num = numerator->getTH2F();
01956    TH2F* den = denominator->getTH2F();
01957    TH2F* res = result->getTH2F();
01958 
01959    res->Divide(num,den,1,1,"");
01960 
01961 }
01962 
01963 void L1TdeRCT::DivideME1D(MonitorElement* numerator, MonitorElement* denominator, MonitorElement* result){
01964 
01965    TH1F* num = numerator->getTH1F();
01966    TH1F* den = denominator->getTH1F();
01967    TH1F* res = result->getTH1F();
01968 
01969    res->Divide(num,den,1,1,"");
01970 
01971 }
01972 
01973 
01974 void L1TdeRCT::beginRun(const edm::Run& run , const edm::EventSetup& es) 
01975 {
01976   readFEDVector(fedVectorMonitorRUN_,es);
01977 
01978 }
01979 
01980 void L1TdeRCT::beginLuminosityBlock(const edm::LuminosityBlock& ls,const edm::EventSetup& es)
01981 {
01982   readFEDVector(fedVectorMonitorLS_,es);
01983 }
01984 
01985 void L1TdeRCT::readFEDVector(MonitorElement* histogram,const edm::EventSetup& es)
01986 {
01987   // adding fed mask into channel mask
01988   edm::ESHandle<RunInfo> sum;
01989   es.get<RunInfoRcd>().get(sum);
01990   const RunInfo* summary=sum.product();
01991 
01992   std::vector<int> caloFeds;  // pare down the feds to the intresting ones
01993 
01994   const std::vector<int> Feds = summary->m_fed_in;
01995   for(std::vector<int>::const_iterator cf = Feds.begin(); cf != Feds.end(); ++cf){
01996     int fedNum = *cf;
01997     if(fedNum > 600 && fedNum <724) 
01998       caloFeds.push_back(fedNum);
01999   }
02000   
02001   for(unsigned int i=0;i<90;++i) {
02002     std::vector<int>::iterator fv = std::find(caloFeds.begin(),caloFeds.end(),crateFED[i]);
02003     if(fv!=caloFeds.end()) {
02004       histogram->setBinContent(i+1,2,1);
02005       histogram->setBinContent(i+1,1,0);
02006     }
02007     else
02008       {
02009         histogram->setBinContent(i+1,2,0);
02010         histogram->setBinContent(i+1,1,1);
02011 
02012       }
02013     
02014   }
02015   
02016 }