CMS 3D CMS Logo

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