CMS 3D CMS Logo

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 #include "DQM/L1TMonitor/interface/L1TdeRCT.h"
00010 
00011 // GCT and RCT data formats
00012 #include "DataFormats/L1CaloTrigger/interface/L1CaloCollections.h"
00013 #include "DQMServices/Core/interface/DQMStore.h"
00014 
00015 // TPGs
00016 
00017 #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h"
00018 #include "DataFormats/HcalDigi/interface/HcalDigiCollections.h"
00019 
00020 
00021 #include "TF2.h"
00022 
00023 #include <iostream>
00024 
00025 using namespace edm;
00026 
00027 const unsigned int PHIBINS = 18;
00028 const float PHIMIN = -0.5;
00029 const float PHIMAX = 17.5;
00030 
00031 const unsigned int ETABINS = 22;
00032 const float ETAMIN = -0.5;
00033 const float ETAMAX = 21.5;
00034 
00035 const unsigned int TPGPHIBINS = 72;
00036 const float TPGPHIMIN = -0.5;
00037 const float TPGPHIMAX = 71.5;
00038 
00039 const unsigned int TPGETABINS = 64;
00040 const float TPGETAMIN = -32.;
00041 const float TPGETAMAX = 32.;
00042 
00043 
00044 const unsigned int DEBINS = 127;
00045 const float DEMIN = -63.5;
00046 const float DEMAX = 63.5;
00047 
00048 const unsigned int PhiEtaMax = 396;
00049 const unsigned int CHNLBINS = 396;
00050 const float CHNLMIN = -0.5;
00051 const float CHNLMAX = 395.5;
00052 
00053 bool first = true ;
00054 
00055 
00056 L1TdeRCT::L1TdeRCT(const ParameterSet & ps) :
00057    rctSourceEmul_( ps.getParameter< InputTag >("rctSourceEmul") ),
00058    rctSourceData_( ps.getParameter< InputTag >("rctSourceData") ),
00059    ecalTPGData_( ps.getParameter< InputTag >("ecalTPGData") ),
00060    hcalTPGData_( ps.getParameter< InputTag >("hcalTPGData") )
00061 
00062 {
00063 
00064 
00065   singlechannelhistos_ = ps.getUntrackedParameter < bool > ("singlechannelhistos", false);
00066 
00067   if (singlechannelhistos_)
00068     if(verbose_) std::cout << "L1TdeRCT: single channels histos ON" << std::endl;
00069 
00070   // verbosity switch
00071   verbose_ = ps.getUntrackedParameter < bool > ("verbose", false);
00072 
00073   if (verbose_)
00074     std::cout << "L1TdeRCT: constructor...." << std::endl;
00075 
00076 
00077   dbe = NULL;
00078   if (ps.getUntrackedParameter < bool > ("DQMStore", false)) {
00079     dbe = Service < DQMStore > ().operator->();
00080     dbe->setVerbose(0);
00081   }
00082 
00083   outputFile_ =
00084       ps.getUntrackedParameter < std::string > ("outputFile", "");
00085   if (outputFile_.size() != 0) {
00086     if(verbose_) std::
00087   cout << "L1T Monitoring histograms will be saved to " <<
00088   outputFile_.c_str() << std::endl;
00089   }
00090 
00091   bool disable =
00092       ps.getUntrackedParameter < bool > ("disableROOToutput", false);
00093   if (disable) {
00094     outputFile_ = "";
00095   }
00096 
00097   histFolder_
00098     = ps.getUntrackedParameter<std::string>("HistFolder", "L1TEMU/L1TdeRCT/");
00099 
00100   if (dbe != NULL) {
00101     dbe->setCurrentFolder(histFolder_);
00102   }
00103 
00104 
00105 
00106 }
00107 
00108 L1TdeRCT::~L1TdeRCT()
00109 {
00110 }
00111 
00112 void L1TdeRCT::beginJob(const EventSetup & c)
00113 {
00114 
00115   nev_ = 0;
00116 
00117   // get hold of back-end interface
00118   DQMStore *dbe = 0;
00119   dbe = Service < DQMStore > ().operator->();
00120 
00121   if (dbe) {
00122     dbe->setCurrentFolder(histFolder_);
00123     dbe->rmdir(histFolder_);
00124   }
00125 
00126 
00127   if (dbe) {
00128 
00129     dbe->setCurrentFolder(histFolder_);
00130 
00131     rctInputTPGEcalOcc_ =
00132   dbe->book2D("rctInputTPGEcalOcc", "rctInputTPGEcalOcc", TPGETABINS, TPGETAMIN,
00133         TPGETAMAX, TPGPHIBINS, TPGPHIMIN, TPGPHIMAX);
00134 
00135     rctInputTPGHcalOcc_ =
00136   dbe->book2D("rctInputTPGHcalOcc", "rctInputTPGHcalOcc", TPGETABINS, TPGETAMIN,
00137         TPGETAMAX, TPGPHIBINS, TPGPHIMIN, TPGPHIMAX);
00138 
00139     rctInputTPGHcalSample_ =
00140   dbe->book1D("rctInputTPGHcalSample", "rctInputTPGHcalSample", 10, -0.5, 9.5) ;
00141 
00142     dbe->setCurrentFolder(histFolder_+"IsoEm");
00143 
00144     rctIsoEmEff1_ =
00145   dbe->book2D("rctIsoEmEff1", "rctIsoEmEff1", ETABINS, ETAMIN,
00146         ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00147 
00148     rctIsoEmEff1oneD_ =
00149   dbe->book1D("rctIsoEmEff1oneD", "rctIsoEmEff1oneD",
00150         CHNLBINS, CHNLMIN, CHNLMAX);
00151 
00152     rctIsoEmEff2_ =
00153   dbe->book2D("rctIsoEmEff2", "rctIsoEmEff2", ETABINS, ETAMIN,
00154         ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00155 
00156     rctIsoEmEff2oneD_ =
00157   dbe->book1D("rctIsoEmEff2oneD", "rctIsoEmEff2oneD",
00158         CHNLBINS, CHNLMIN, CHNLMAX);
00159 
00160     rctIsoEmIneff_ =
00161   dbe->book2D("rctIsoEmIneff", "rctIsoEmIneff", ETABINS, ETAMIN,
00162         ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00163 
00164     rctIsoEmIneff1D_ =
00165   dbe->book1D("rctIsoEmIneff1D", "rctIsoEmIneff1D",
00166                     CHNLBINS, CHNLMIN, CHNLMAX);
00167 
00168     rctIsoEmOvereff_ =
00169   dbe->book2D("rctIsoEmOvereff", "rctIsoEmOvereff", ETABINS, ETAMIN,
00170         ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00171 
00172     rctIsoEmOvereff1D_ =
00173   dbe->book1D("rctIsoEmOvereff1D", "rctIsoEmOvereff1D",
00174                     CHNLBINS, CHNLMIN, CHNLMAX);
00175 
00176     dbe->setCurrentFolder(histFolder_+"IsoEm/ServiceData");
00177 
00178     rctIsoEmDataOcc_ =
00179   dbe->book2D("rctIsoEmDataOcc", "rctIsoEmDataOcc", ETABINS, ETAMIN,
00180         ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00181 
00182     rctIsoEmDataOcc1D_ =
00183   dbe->book1D("rctIsoEmDataOcc1D", "rctIsoEmDataOcc1D",
00184                     CHNLBINS, CHNLMIN, CHNLMAX);
00185 
00186     rctIsoEmEmulOcc_ =
00187   dbe->book2D("rctIsoEmEmulOcc", "rctIsoEmEmulOcc", ETABINS, ETAMIN,
00188         ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00189 
00190     rctIsoEmEmulOcc1D_ =
00191   dbe->book1D("rctIsoEmEmulOcc1D", "rctIsoEmEmulOcc1D",
00192                     CHNLBINS, CHNLMIN, CHNLMAX);
00193 
00194     rctIsoEmEff1Occ_ =
00195   dbe->book2D("rctIsoEmEff1Occ", "rctIsoEmEff1Occ", ETABINS, ETAMIN,
00196         ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00197 
00198     rctIsoEmEff1Occ1D_ =
00199   dbe->book1D("rctIsoEmEff1Occ1D", "rctIsoEmEff1Occ1D",
00200                     CHNLBINS, CHNLMIN, CHNLMAX);
00201 
00202     rctIsoEmEff2Occ_ =
00203   dbe->book2D("rctIsoEmEff2Occ", "rctIsoEmEff2Occ", ETABINS, ETAMIN,
00204         ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00205 
00206     rctIsoEmEff2Occ1D_ =
00207   dbe->book1D("rctIsoEmEff2Occ1D", "rctIsoEmEff2Occ1D",
00208                     CHNLBINS, CHNLMIN, CHNLMAX);
00209 
00210     rctIsoEmIneffOcc_ =
00211   dbe->book2D("rctIsoEmIneffOcc", "rctIsoEmIneffOcc", ETABINS, ETAMIN,
00212         ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00213 
00214     rctIsoEmIneffOcc1D_ =
00215   dbe->book1D("rctIsoEmIneffOcc1D", "rctIsoEmIneffOcc1D",
00216                     CHNLBINS, CHNLMIN, CHNLMAX);
00217 
00218     rctIsoEmOvereffOcc_ =
00219   dbe->book2D("rctIsoEmOvereffOcc", "rctIsoEmOvereffOcc", ETABINS, ETAMIN,
00220         ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00221 
00222     rctIsoEmOvereffOcc1D_ =
00223   dbe->book1D("rctIsoEmOvereffOcc1D", "rctIsoEmOvereffOcc1D",
00224                     CHNLBINS, CHNLMIN, CHNLMAX);
00225 
00226 
00227     dbe->setCurrentFolder(histFolder_+"NisoEm");
00228     rctNisoEmEff1_ =
00229   dbe->book2D("rctNisoEmEff1", "rctNisoEmEff1", ETABINS, ETAMIN,
00230         ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00231 
00232     rctNisoEmEff1oneD_ =
00233   dbe->book1D("rctNisoEmEff1oneD", "rctNisoEmEff1oneD",
00234                     CHNLBINS, CHNLMIN, CHNLMAX);
00235 
00236     rctNisoEmEff2_ =
00237   dbe->book2D("rctNisoEmEff2", "rctNisoEmEff2", ETABINS, ETAMIN,
00238         ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00239 
00240     rctNisoEmEff2oneD_ =
00241   dbe->book1D("rctNisoEmEff2oneD", "rctNisoEmEff2oneD",
00242                     CHNLBINS, CHNLMIN, CHNLMAX);
00243 
00244     rctNisoEmIneff_ =
00245   dbe->book2D("rctNisoEmIneff", "rctNisoEmIneff", ETABINS, ETAMIN,
00246         ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00247 
00248     rctNisoEmIneff1D_ =
00249   dbe->book1D("rctNisoEmIneff1D", "rctNisoEmIneff1D",
00250                     CHNLBINS, CHNLMIN, CHNLMAX);
00251 
00252     rctNisoEmOvereff_ =
00253   dbe->book2D("rctNisoEmOvereff", "rctNisoEmOvereff", ETABINS, ETAMIN,
00254         ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00255 
00256     rctNisoEmOvereff1D_ =
00257   dbe->book1D("rctNisoEmOvereff1D", "rctNisoEmOvereff1D",
00258                     CHNLBINS, CHNLMIN, CHNLMAX);
00259 
00260     dbe->setCurrentFolder(histFolder_+"NisoEm/ServiceData");
00261 
00262     rctNisoEmDataOcc_ =
00263   dbe->book2D("rctNisoEmDataOcc", "rctNisoEmDataOcc", ETABINS, ETAMIN,
00264         ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00265 
00266     rctNisoEmDataOcc1D_ =
00267   dbe->book1D("rctNisoEmDataOcc1D", "rctNisoEmDataOcc1D",
00268                     CHNLBINS, CHNLMIN, CHNLMAX);
00269 
00270     rctNisoEmEmulOcc_ =
00271   dbe->book2D("rctNisoEmEmulOcc", "rctNisoEmEmulOcc", ETABINS, ETAMIN,
00272         ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00273 
00274     rctNisoEmEmulOcc1D_ =
00275   dbe->book1D("rctNisoEmEmulOcc1D", "rctNisoEmEmulOcc1D",
00276                     CHNLBINS, CHNLMIN, CHNLMAX);
00277 
00278     rctNisoEmEff1Occ_ =
00279   dbe->book2D("rctNisoEmEff1Occ", "rctNisoEmEff1Occ", ETABINS, ETAMIN,
00280         ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00281 
00282     rctNisoEmEff1Occ1D_ =
00283   dbe->book1D("rctNisoEmEff1Occ1D", "rctNisoEmEff1Occ1D",
00284                     CHNLBINS, CHNLMIN, CHNLMAX);
00285 
00286     rctNisoEmEff2Occ_ =
00287   dbe->book2D("rctNisoEmEff2Occ", "rctNisoEmEff2Occ", ETABINS, ETAMIN,
00288         ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00289 
00290     rctNisoEmEff2Occ1D_ =
00291   dbe->book1D("rctNisoEmEff2Occ1D", "rctNisoEmEff2Occ1D",
00292                     CHNLBINS, CHNLMIN, CHNLMAX);
00293 
00294     rctNisoEmIneffOcc_ =
00295   dbe->book2D("rctNisoEmIneffOcc", "rctNisoEmIneffOcc", ETABINS, ETAMIN,
00296         ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00297 
00298     rctNisoEmIneffOcc1D_ =
00299   dbe->book1D("rctNisoEmIneffOcc1D", "rctNisoEmIneffOcc1D",
00300                     CHNLBINS, CHNLMIN, CHNLMAX);
00301 
00302     rctNisoEmOvereffOcc_ =
00303   dbe->book2D("rctNisoEmOvereffOcc", "rctNisoEmOvereffOcc", ETABINS, ETAMIN,
00304         ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00305 
00306     rctNisoEmOvereffOcc1D_ =
00307   dbe->book1D("rctNisoEmOvereffOcc1D", "rctNisoEmOvereffOcc1D",
00308                     CHNLBINS, CHNLMIN, CHNLMAX);
00309 
00310     // region information
00311     dbe->setCurrentFolder(histFolder_+"RegionData");
00312 
00313     rctRegEff1D_ =
00314       dbe->book1D("rctRegEff1D", "1D region efficiency",
00315       CHNLBINS, CHNLMIN, CHNLMAX);
00316 
00317     rctRegIneff1D_ =
00318       dbe->book1D("rctRegIneff1D", "1D region inefficiency",
00319       CHNLBINS, CHNLMIN, CHNLMAX);
00320 
00321     rctRegOvereff1D_ =
00322       dbe->book1D("rctRegOvereff1D", "1D region overefficiency",
00323       CHNLBINS, CHNLMIN, CHNLMAX);
00324 
00325     rctRegEff2D_ =
00326       dbe->book2D("rctRegEff2D", "2D region efficiency",
00327       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00328 
00329     rctRegIneff2D_ =
00330       dbe->book2D("rctRegIneff2D", "2D region inefficiency",
00331       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00332 
00333     rctRegOvereff2D_ =
00334       dbe->book2D("rctRegOvereff2D", "2D region overefficiency",
00335       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00336 
00337     rctRegSpEff2D_ =
00338       dbe->book2D("rctRegSpEff2D", "2D region special efficiency",
00339       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00340 
00341     dbe->setCurrentFolder(histFolder_+"RegionData/ServiceData");
00342 
00343     rctRegDataOcc1D_ =
00344       dbe->book1D("rctRegDataOcc1D", "1D region occupancy from data",
00345       CHNLBINS, CHNLMIN, CHNLMAX);
00346 
00347     rctRegEmulOcc1D_ =
00348       dbe->book1D("rctRegEmulOcc1D", "1D region occupancy from emulator",
00349       CHNLBINS, CHNLMIN, CHNLMAX);
00350 
00351     rctRegMatchedOcc1D_ =
00352       dbe->book1D("rctRegMatchedOcc1D", "1D region occupancy for matched hits",
00353       CHNLBINS, CHNLMIN, CHNLMAX);
00354 
00355     rctRegUnmatchedDataOcc1D_ =
00356       dbe->book1D("rctRegUnmatchedDataOcc1D", "1D region occupancy for unmatched hardware hits",
00357       CHNLBINS, CHNLMIN, CHNLMAX);
00358 
00359     rctRegUnmatchedEmulOcc1D_ =
00360       dbe->book1D("rctRegUnmatchedEmulOcc1D", "1D region occupancy for unmatched emulator hits",
00361       CHNLBINS, CHNLMIN, CHNLMAX);
00362 
00363     rctRegDataOcc2D_ =
00364       dbe->book2D("rctRegDataOcc2D", "2D region occupancy from hardware",
00365       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00366 
00367     rctRegEmulOcc2D_ =
00368       dbe->book2D("rctRegEmulOcc2D", "2D region occupancy from emulator",
00369       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00370 
00371     rctRegMatchedOcc2D_ =
00372       dbe->book2D("rctRegMatchedOcc2D", "2D region occupancy for matched hits",
00373       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00374 
00375     rctRegUnmatchedDataOcc2D_ =
00376       dbe->book2D("rctRegUnmatchedDataOcc2D", "2D region occupancy for unmatched hardware hits",
00377       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00378 
00379     rctRegUnmatchedEmulOcc2D_ =
00380       dbe->book2D("rctRegUnmatchedEmulOcc2D", "2D region occupancy for unmatched emulator hits",
00381       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00382 
00383     rctRegDeltaEt2D_ =
00384       dbe->book2D("rctRegDeltaEt2D", "2D region \\Delta E_{T}",
00385       CHNLBINS, CHNLMIN, CHNLMAX, 100, -50., 50.);
00386 
00387     rctRegDeltaEtOcc2D_ =
00388       dbe->book2D("rctRegDeltaEtOcc2D", "2D region occupancy for \\Delta E_{T}",
00389       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00390 
00391     // bit information
00392     dbe->setCurrentFolder(histFolder_+"BitData");
00393 
00394     rctBitOverFlowEff2D_ =
00395       dbe->book2D("rctBitOverFlowEff2D", "2D overflow bit efficiency",
00396       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00397 
00398     rctBitOverFlowIneff2D_ =
00399       dbe->book2D("rctBitOverFlowIneff2D", "2D overflow bit inefficiency",
00400       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00401 
00402     rctBitOverFlowOvereff2D_ =
00403       dbe->book2D("rctBitOverFlowOvereff2D", "2D overflow bit overefficiency",
00404       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00405 
00406     rctBitTauVetoEff2D_ =
00407       dbe->book2D("rctBitTauVetoEff2D", "2D tau veto bit efficiency",
00408       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00409 
00410     rctBitTauVetoIneff2D_ =
00411       dbe->book2D("rctBitTauVetoIneff2D", "2D tau veto bit inefficiency",
00412       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00413 
00414     rctBitTauVetoOvereff2D_ =
00415       dbe->book2D("rctBitTauVetoOvereff2D", "2D tau veto bit overefficiency",
00416       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00417 
00418     rctBitMipEff2D_ =
00419       dbe->book2D("rctBitMipEff2D", "2D mip bit efficiency",
00420       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00421 
00422     rctBitMipIneff2D_ =
00423       dbe->book2D("rctBitMipIneff2D", "2D mip bit inefficiency",
00424       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00425 
00426     rctBitMipOvereff2D_ =
00427       dbe->book2D("rctBitMipOvereff2D", "2D mip bit overefficiency",
00428       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00429 
00430     rctBitQuietEff2D_ =
00431       dbe->book2D("rctBitQuietEff2D", "2D quiet bit efficiency",
00432       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00433 
00434     rctBitQuietIneff2D_ =
00435       dbe->book2D("rctBitQuietIneff2D", "2D quiet bit inefficiency",
00436       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00437 
00438     rctBitQuietOvereff2D_ =
00439       dbe->book2D("rctBitQuietOvereff2D", "2D quiet bit overefficiency",
00440       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00441 
00442     rctBitHfPlusTauEff2D_ =
00443       dbe->book2D("rctBitHfPlusTauEff2D", "2D HfPlusTau bit efficiency",
00444       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00445 
00446     rctBitHfPlusTauIneff2D_ =
00447       dbe->book2D("rctBitHfPlusTauIneff2D", "2D HfPlusTau bit inefficiency",
00448       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00449 
00450     rctBitHfPlusTauOvereff2D_ =
00451       dbe->book2D("rctBitHfPlusTauOvereff2D", "2D HfPlusTau bit overefficiency",
00452       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00453 
00454     dbe->setCurrentFolder(histFolder_+"BitData/ServiceData");
00455 
00456     rctBitEmulOverFlow2D_ =
00457       dbe->book2D("rctBitEmulOverFlow2D", "2D overflow bit from emulator",
00458       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00459 
00460     rctBitDataOverFlow2D_ =
00461       dbe->book2D("rctBitDataOverFlow2D", "2D overflow bit from hardware",
00462       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00463 
00464     rctBitMatchedOverFlow2D_ =
00465       dbe->book2D("rctBitMatchedOverFlow2D", "2D overflow bit for matched hits",
00466       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00467 
00468     rctBitUnmatchedEmulOverFlow2D_ =
00469       dbe->book2D("rctBitUnmatchedEmulOverFlow2D", "2D overflow bit for unmatched emulator hits",
00470       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00471 
00472     rctBitUnmatchedDataOverFlow2D_ =
00473       dbe->book2D("rctBitUnmatchedDataOverFlow2D", "2D overflow bit for unmatched hardware hits",
00474       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00475 
00476     rctBitEmulTauVeto2D_ =
00477       dbe->book2D("rctBitEmulTauVeto2D", "2D tau veto bit from emulator",
00478       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00479 
00480     rctBitDataTauVeto2D_ =
00481       dbe->book2D("rctBitDataTauVeto2D", "2D tau veto bit from hardware",
00482       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00483 
00484     rctBitMatchedTauVeto2D_ =
00485       dbe->book2D("rctBitMatchedTauVeto2D", "2D tau veto bit for matched hits",
00486       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00487 
00488     rctBitUnmatchedEmulTauVeto2D_ =
00489       dbe->book2D("rctBitUnmatchedEmulTauVeto2D", "2D tau veto bit for unmatched emulator hits",
00490       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00491 
00492     rctBitUnmatchedDataTauVeto2D_ =
00493       dbe->book2D("rctBitUnmatchedDataTauVeto2D", "2D tau veto bit for unmatched hardware hits",
00494       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00495 
00496     rctBitEmulMip2D_ =
00497       dbe->book2D("rctBitEmulMip2D", "2D mip bit from emulator",
00498       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00499 
00500     rctBitDataMip2D_ =
00501       dbe->book2D("rctBitDataMip2D", "2D mip bit from hardware",
00502       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00503 
00504     rctBitMatchedMip2D_ =
00505       dbe->book2D("rctBitMatchedMip2D", "2D mip bit for matched hits",
00506       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00507 
00508     rctBitUnmatchedEmulMip2D_ =
00509       dbe->book2D("rctBitUnmatchedEmulMip2D", "2D mip bit for unmatched emulator hits",
00510       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00511 
00512     rctBitUnmatchedDataMip2D_ =
00513       dbe->book2D("rctBitUnmatchedDataMip2D", "2D mip bit for unmatched hardware hits",
00514       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00515 
00516     rctBitEmulQuiet2D_ =
00517       dbe->book2D("rctBitEmulQuiet2D", "2D quiet bit from emulator",
00518       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00519 
00520     rctBitDataQuiet2D_ =
00521       dbe->book2D("rctBitDataQuiet2D", "2D quiet bit from hardware",
00522       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00523 
00524     rctBitMatchedQuiet2D_ =
00525       dbe->book2D("rctBitMatchedQuiet2D", "2D quiet bit for matched hits",
00526       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00527 
00528     rctBitUnmatchedEmulQuiet2D_ =
00529       dbe->book2D("rctBitUnmatchedEmulQuiet2D", "2D quiet bit for unmatched emulator hits",
00530       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00531 
00532     rctBitUnmatchedDataQuiet2D_ =
00533       dbe->book2D("rctBitUnmatchedDataQuiet2D", "2D quiet bit for unmatched hardware hits",
00534       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00535 
00536     rctBitEmulHfPlusTau2D_ =
00537       dbe->book2D("rctBitEmulHfPlusTau2D", "2D HfPlusTau bit from emulator",
00538       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00539 
00540     rctBitDataHfPlusTau2D_ =
00541       dbe->book2D("rctBitDataHfPlusTau2D", "2D HfPlusTau bit from hardware",
00542       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00543 
00544     rctBitMatchedHfPlusTau2D_ =
00545       dbe->book2D("rctBitMatchedHfPlusTau2D", "2D HfPlusTau bit for matched hits",
00546       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00547 
00548     rctBitUnmatchedEmulHfPlusTau2D_ =
00549       dbe->book2D("rctBitUnmatchedEmulHfPlusTau2D", "2D HfPlusTau bit for unmatched emulator hits",
00550       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00551 
00552     rctBitUnmatchedDataHfPlusTau2D_ =
00553       dbe->book2D("rctBitUnmatchedDataHfPlusTau2D", "2D HfPlusTau bit for unmatched hardware hits",
00554       ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
00555 
00556 // for single channels
00557 
00558     if(singlechannelhistos_)
00559    {
00560     for(int m=0; m<9; m++)
00561     {
00562     if(m==0) dbe->setCurrentFolder(histFolder_+"IsoEm/ServiceData/Eff1SnglChnls");
00563     if(m==1) dbe->setCurrentFolder(histFolder_+"NisoEm/ServiceData/Eff1SnglChnls");
00564     if(m==2) dbe->setCurrentFolder(histFolder_+"RegionData/ServiceData/EffSnglChnls");
00565     if(m==3) dbe->setCurrentFolder(histFolder_+"IsoEm/ServiceData/IneffSnglChnls");
00566     if(m==4) dbe->setCurrentFolder(histFolder_+"NisoEm/ServiceData/IneffSnglChnls");
00567     if(m==5) dbe->setCurrentFolder(histFolder_+"RegionData/ServiceData/IneffSnglChnls");
00568     if(m==6) dbe->setCurrentFolder(histFolder_+"IsoEm/ServiceData/OvereffSnglChnls");
00569     if(m==7) dbe->setCurrentFolder(histFolder_+"NisoEm/ServiceData/OvereffSnglChnls");
00570     if(m==8) dbe->setCurrentFolder(histFolder_+"RegionData/ServiceData/OvereffSnglChnls");
00571 
00572     for(int i=0; i<ETAMAX; i++)
00573     {
00574      for(int j=0; j<PHIMAX; j++)
00575      {
00576      char name[80], channel[80]={""} ;
00577 
00578      if(m==0) strcpy(name,"(Eemul-Edata)Chnl") ;
00579      if(m==1) strcpy(name,"(Eemul-Edata)Chnl") ;
00580      if(m==2) strcpy(name,"(Eemul-Edata)Chnl") ;
00581      if(m==3) strcpy(name,"EemulChnl") ;
00582      if(m==4) strcpy(name,"EemulChnl") ;
00583      if(m==5) strcpy(name,"EemulChnl") ;
00584      if(m==6) strcpy(name,"EdataChnl") ;
00585      if(m==7) strcpy(name,"EdataChnl") ;
00586      if(m==8) strcpy(name,"EdataChnl") ;
00587 
00588      if(i<10 && j<10) sprintf(channel,"_0%d0%d",i,j);
00589      else if(i<10) sprintf(channel,"_0%d%d",i,j);
00590       else if(j<10) sprintf(channel,"_%d0%d",i,j);
00591        else sprintf(channel,"_%d%d",i,j);
00592      strcat(name,channel);
00593 
00594      int chnl=PHIBINS*i+j;
00595 
00596      if(m==0) rctIsoEffChannel_[chnl] =
00597   dbe->book1D(name, name, DEBINS, DEMIN, DEMAX);
00598      if(m==1) rctNisoEffChannel_[chnl] =
00599   dbe->book1D(name, name, DEBINS, DEMIN, DEMAX);
00600      if(m==2) rctRegEffChannel_[chnl] =
00601   dbe->book1D(name, name, DEBINS, DEMIN, DEMAX);
00602      if(m==3) rctIsoIneffChannel_[chnl] =
00603   dbe->book1D(name, name, DEBINS, DEMIN, DEMAX);
00604      if(m==4) rctNisoIneffChannel_[chnl] =
00605   dbe->book1D(name, name, DEBINS, DEMIN, DEMAX);
00606      if(m==5) rctRegIneffChannel_[chnl] =
00607   dbe->book1D(name, name, DEBINS, DEMIN, DEMAX);
00608      if(m==6) rctIsoOvereffChannel_[chnl] =
00609   dbe->book1D(name, name, DEBINS, DEMIN, DEMAX);
00610      if(m==7) rctNisoOvereffChannel_[chnl] =
00611   dbe->book1D(name, name, DEBINS, DEMIN, DEMAX);
00612      if(m==8) rctRegOvereffChannel_[chnl] =
00613   dbe->book1D(name, name, DEBINS, DEMIN, DEMAX);
00614      }
00615     }
00616     }
00617    }
00618 
00619 //end of single channels
00620 
00621 
00622   }
00623 }
00624 
00625 
00626 void L1TdeRCT::endJob(void)
00627 {
00628   if (verbose_)
00629     std::cout << "L1TdeRCT: end job...." << std::endl;
00630   LogInfo("EndJob") << "analyzed " << nev_ << " events";
00631 
00632   if (outputFile_.size() != 0 && dbe)
00633     dbe->save(outputFile_);
00634 
00635   return;
00636 }
00637 
00638 void L1TdeRCT::analyze(const Event & e, const EventSetup & c)
00639 {
00640 //    std::cout << "I am here!" << std::endl ;
00641   nev_++;
00642   if (verbose_) {
00643     std::cout << "L1TdeRCT: analyze...." << std::endl;
00644   }
00645 
00646   // get TPGs
00647   edm::Handle<EcalTrigPrimDigiCollection> ecalTpData;
00648   edm::Handle<HcalTrigPrimDigiCollection> hcalTpData;
00649 
00650   // Get the RCT digis
00651   edm::Handle < L1CaloEmCollection > emData;
00652   edm::Handle < L1CaloRegionCollection > rgnData;
00653 
00654   // Get the RCT digis
00655   edm::Handle < L1CaloEmCollection > emEmul;
00656   edm::Handle < L1CaloRegionCollection > rgnEmul;
00657 
00658   // need to change to getByLabel
00659   bool doEm = true;
00660   bool doHd = true;
00661   bool doEcal = true;
00662   bool doHcal = true;
00663 
00664   // TPG, first try:
00665   e.getByLabel(ecalTPGData_,ecalTpData);
00666   e.getByLabel(hcalTPGData_,hcalTpData);
00667 
00668   if (!ecalTpData.isValid()) {
00669     edm::LogInfo("TPG DataNotFound") << "can't find EcalTrigPrimDigiCollection with label "
00670              << ecalTPGData_.label() ;
00671     if (verbose_)std::cout << "Can not find ecalTpData!" << std::endl ;
00672 
00673     doEcal = false ;
00674   }
00675 
00676   if(doEcal)
00677   {
00678   for(EcalTrigPrimDigiCollection::const_iterator iEcalTp = ecalTpData->begin(); iEcalTp != ecalTpData->end(); iEcalTp++)
00679     if(iEcalTp->compressedEt() > 0)
00680     {
00681 
00682   if(iEcalTp->id().ieta() > 0)
00683   rctInputTPGEcalOcc_ -> Fill(1.*(iEcalTp->id().ieta())-0.5,iEcalTp->id().iphi()) ;
00684   else
00685   rctInputTPGEcalOcc_ -> Fill(1.*(iEcalTp->id().ieta())+0.5,iEcalTp->id().iphi()) ;
00686 
00687 if(verbose_) std::cout << " ECAL data: Energy: " << iEcalTp->compressedEt() << " eta " << iEcalTp->id().ieta() << " phi " << iEcalTp->id().iphi() << std::endl ;
00688     }
00689    }
00690 
00691   if (!hcalTpData.isValid()) {
00692     edm::LogInfo("TPG DataNotFound") << "can't find HcalTrigPrimDigiCollection with label "
00693              << hcalTPGData_.label() ;
00694     if (verbose_)std::cout << "Can not find hcalTpData!" << std::endl ;
00695 
00696     doHcal = false ;
00697   }
00698 
00699 
00700   if(doHcal)
00701   {
00702 
00703   for(HcalTrigPrimDigiCollection::const_iterator iHcalTp = hcalTpData->begin(); iHcalTp != hcalTpData->end(); iHcalTp++)
00704   {
00705     int highSample=0;
00706     int highEt=0;
00707 
00708     for (int nSample = 0; nSample < 10; nSample++)
00709       {
00710   if (iHcalTp->sample(nSample).compressedEt() != 0)
00711     {
00712       if(verbose_) std::cout << "HCAL data: Et "
00713           << iHcalTp->sample(nSample).compressedEt()
00714           << "  fg "
00715           << iHcalTp->sample(nSample).fineGrain()
00716           << "  ieta " << iHcalTp->id().ieta()
00717           << "  iphi " << iHcalTp->id().iphi()
00718           << "  sample " << nSample
00719                       << std::endl ;
00720       if (iHcalTp->sample(nSample).compressedEt() > highEt)
00721         {
00722     highSample = nSample;
00723                 highEt =  iHcalTp->sample(nSample).compressedEt() ;
00724         }
00725     }
00726 
00727        }
00728 
00729      if(highEt != 0)
00730       {
00731                   if(iHcalTp->id().ieta() > 0)
00732                   rctInputTPGHcalOcc_ -> Fill(1.*(iHcalTp->id().ieta())-0.5,iHcalTp->id().iphi()) ;
00733                   else
00734                   rctInputTPGHcalOcc_ -> Fill(1.*(iHcalTp->id().ieta())+0.5,iHcalTp->id().iphi()) ;
00735                   rctInputTPGHcalSample_ -> Fill(highSample) ;
00736        }
00737 
00738     }
00739   }
00740 
00741 
00742   e.getByLabel(rctSourceData_,rgnData);
00743   e.getByLabel(rctSourceEmul_,rgnEmul);
00744 
00745   if (!rgnData.isValid()) {
00746     edm::LogInfo("DataNotFound") << "can't find L1CaloRegionCollection with label "
00747              << rctSourceData_.label() ;
00748     if (verbose_)std::cout << "Can not find rgnData!" << std::endl ;
00749     doHd = false;
00750   }
00751 
00752 //  if ( doHd ) {
00753   if (!rgnEmul.isValid()) {
00754     edm::LogInfo("DataNotFound") << "can't find L1CaloRegionCollection with label "
00755              << rctSourceEmul_.label() ;
00756     doHd = false;
00757     if (verbose_)std::cout << "Can not find rgnEmul!" << std::endl ;
00758   }
00759 //  }
00760 
00761 
00762   e.getByLabel(rctSourceData_,emData);
00763   e.getByLabel(rctSourceEmul_,emEmul);
00764 
00765   if (!emData.isValid()) {
00766     edm::LogInfo("DataNotFound") << "can't find L1CaloEmCollection with label "
00767              << rctSourceData_.label() ;
00768     if (verbose_)std::cout << "Can not find emData!" << std::endl ;
00769     doEm = false;
00770   }
00771 
00772 //  if ( doEm ) {
00773 
00774   if (!emEmul.isValid()) {
00775     edm::LogInfo("DataNotFound") << "can't find L1CaloEmCollection with label "
00776              << rctSourceEmul_.label() ;
00777     if (verbose_)std::cout << "Can not find emEmul!" << std::endl ;
00778     doEm = false; return ;
00779   }
00780 
00781 //  }
00782 
00783 
00784   // Isolated and non-isolated EM
00785 
00786   // StepI: Reset
00787 
00788   int nelectrIsoData = 0;
00789   int nelectrNisoData = 0;
00790   int nelectrIsoEmul = 0;
00791   int nelectrNisoEmul = 0;
00792 
00793   int electronDataRank[2][PhiEtaMax]={0};
00794   int electronDataEta[2][PhiEtaMax]={0};
00795   int electronDataPhi[2][PhiEtaMax]={0};
00796   int electronEmulRank[2][PhiEtaMax]={0};
00797   int electronEmulEta[2][PhiEtaMax]={0};
00798   int electronEmulPhi[2][PhiEtaMax]={0};
00799 
00800     // region/bit arrays
00801   int nRegionData = 0;
00802   int nRegionEmul = 0;
00803 
00804   int regionDataRank[PhiEtaMax] = {0};
00805   int regionDataEta [PhiEtaMax] = {0};
00806   int regionDataPhi [PhiEtaMax] = {0};
00807 
00808   bool regionDataOverFlow [PhiEtaMax] = {false};
00809   bool regionDataTauVeto  [PhiEtaMax] = {false};
00810   bool regionDataMip      [PhiEtaMax] = {false};
00811   bool regionDataQuiet    [PhiEtaMax] = {false};
00812   bool regionDataHfPlusTau[PhiEtaMax] = {false};
00813 
00814   int regionEmulRank[PhiEtaMax] = {0};
00815   int regionEmulEta [PhiEtaMax] = {0};
00816   int regionEmulPhi [PhiEtaMax] = {0};
00817 
00818   bool regionEmulOverFlow [PhiEtaMax] = {false};
00819   bool regionEmulTauVeto  [PhiEtaMax] = {false};
00820   bool regionEmulMip      [PhiEtaMax] = {false};
00821   bool regionEmulQuiet    [PhiEtaMax] = {false};
00822   bool regionEmulHfPlusTau[PhiEtaMax] = {false};
00823 
00824 // just to fix a scale for the ratios //
00825 if(first)
00826 {
00827 //   rctIsoEmEmulOcc_->Fill(0.,0.) ;
00828 //   rctIsoEmDataOcc_->Fill(0.,0.) ;
00829 //   rctIsoEmEff1Occ_->Fill(0.,0.) ;
00830 //   rctIsoEmEff2Occ_->Fill(0.,0.) ;
00831 //   rctIsoEmIneffOcc_->Fill(0.,0.) ;
00832 //   rctIsoEmOvereffOcc_->Fill(0.,0.) ;
00833 //   rctNisoEmEmulOcc_->Fill(0.,0.) ;
00834 //   rctNisoEmDataOcc_->Fill(0.,0.) ;
00835 //   rctNisoEmEff1Occ_->Fill(0.,0.) ;
00836 //   rctNisoEmEff2Occ_->Fill(0.,0.) ;
00837 //   rctNisoEmIneffOcc_->Fill(0.,0.) ;
00838 //   rctNisoEmOvereffOcc_->Fill(0.,0.) ;
00839 // 
00840 //   rctRegDataOcc2D_->Fill(0.,0.) ;
00841 //   rctRegEmulOcc2D_->Fill(0.,0.) ;
00842 //   rctRegMatchedOcc2D_->Fill(0.,0.) ;
00843 //   rctRegUnmatchedDataOcc2D_->Fill(0.,0.) ;
00844 //   rctRegUnmatchedEmulOcc2D_->Fill(0.,0.) ;
00845 //   rctRegDeltaEtOcc2D_->Fill(0.,0.) ;
00846 // 
00847 //   rctBitDataOverFlow2D_->Fill(0.,0.) ;
00848 //   rctBitEmulOverFlow2D_->Fill(0.,0.) ;
00849 //   rctBitMatchedOverFlow2D_->Fill(0.,0.) ;
00850 //   rctBitUnmatchedDataOverFlow2D_->Fill(0.,0.) ;
00851 //   rctBitUnmatchedEmulOverFlow2D_->Fill(0.,0.) ;
00852 // 
00853 //   rctBitDataTauVeto2D_->Fill(0.,0.) ;
00854 //   rctBitEmulTauVeto2D_->Fill(0.,0.) ;
00855 //   rctBitMatchedTauVeto2D_->Fill(0.,0.) ;
00856 //   rctBitUnmatchedDataTauVeto2D_->Fill(0.,0.) ;
00857 //   rctBitUnmatchedEmulTauVeto2D_->Fill(0.,0.) ;
00858 // 
00859 //   rctBitDataMip2D_->Fill(0.,0.) ;
00860 //   rctBitEmulMip2D_->Fill(0.,0.) ;
00861 //   rctBitMatchedMip2D_->Fill(0.,0.) ;
00862 //   rctBitUnmatchedDataMip2D_->Fill(0.,0.) ;
00863 //   rctBitUnmatchedEmulMip2D_->Fill(0.,0.) ;
00864 // 
00865 //   rctBitDataQuiet2D_->Fill(0.,0.) ;
00866 //   rctBitEmulQuiet2D_->Fill(0.,0.) ;
00867 //   rctBitMatchedQuiet2D_->Fill(0.,0.) ;
00868 //   rctBitUnmatchedDataQuiet2D_->Fill(0.,0.) ;
00869 //   rctBitUnmatchedEmulQuiet2D_->Fill(0.,0.) ;
00870 // 
00871 //   rctBitDataHfPlusTau2D_->Fill(0.,0.) ;
00872 //   rctBitEmulHfPlusTau2D_->Fill(0.,0.) ;
00873 //   rctBitMatchedHfPlusTau2D_->Fill(0.,0.) ;
00874 //   rctBitUnmatchedDataHfPlusTau2D_->Fill(0.,0.) ;
00875 //   rctBitUnmatchedEmulHfPlusTau2D_->Fill(0.,0.) ;
00876 
00877   first = false ;
00878 }
00879 
00880 
00881   // StepII: fill variables
00882 
00883   for (L1CaloEmCollection::const_iterator iem = emEmul->begin();
00884        iem != emEmul->end();
00885        iem++)
00886   {
00887     if(iem->rank() >= 1)
00888     {
00889       if(iem->isolated())
00890       {
00891         rctIsoEmEmulOcc_->Fill(iem->regionId().ieta(), iem->regionId().iphi());
00892 
00893         // to  show bad channles in the 2D efficiency plots
00894         rctIsoEmIneffOcc_->Fill (iem->regionId().ieta(), iem->regionId().iphi(), 0.01);
00895         rctIsoEmEff1Occ_->Fill  (iem->regionId().ieta(), iem->regionId().iphi(), 0.01);
00896 
00897         int channel;
00898 
00899         channel=PHIBINS*iem->regionId().ieta()+iem->regionId().iphi();
00900         rctIsoEmEmulOcc1D_->Fill(channel);
00901         electronEmulRank[0][nelectrIsoEmul]=iem->rank();
00902         electronEmulEta[0][nelectrIsoEmul]=iem->regionId().ieta();
00903         electronEmulPhi[0][nelectrIsoEmul]=iem->regionId().iphi();
00904         nelectrIsoEmul++ ;
00905       }
00906 
00907       else
00908       {
00909         rctNisoEmEmulOcc_->Fill(iem->regionId().ieta(), iem->regionId().iphi());
00910 
00911         // to  show bad channles in the 2D efficiency plots
00912         rctNisoEmIneffOcc_->Fill (iem->regionId().ieta(), iem->regionId().iphi(), 0.01);
00913         rctNisoEmEff1Occ_->Fill  (iem->regionId().ieta(), iem->regionId().iphi(), 0.01);
00914 
00915         int channel;
00916 //
00917 
00918         channel=PHIBINS*iem->regionId().ieta()+iem->regionId().iphi();
00919         rctNisoEmEmulOcc1D_->Fill(channel);
00920         electronEmulRank[1][nelectrNisoEmul]=iem->rank();
00921         electronEmulEta[1][nelectrNisoEmul]=iem->regionId().ieta();
00922         electronEmulPhi[1][nelectrNisoEmul]=iem->regionId().iphi();
00923         nelectrNisoEmul++ ;
00924       }
00925     }
00926   }
00927 
00928   for (L1CaloEmCollection::const_iterator iem = emData->begin();
00929        iem != emData->end();
00930        iem++)
00931   {
00932     if(iem->rank() >= 1)
00933     {
00934       if (iem->isolated())
00935       {
00936         rctIsoEmDataOcc_->Fill(iem->regionId().ieta(), iem->regionId().iphi());
00937 
00938         // new stuff to avoid 0's in emulator 2D //
00939         // rctIsoEmEmulOcc_->Fill(iem->regionId().ieta(), iem->regionId().iphi(),0.0001);
00940         rctIsoEmOvereffOcc_->Fill (iem->regionId().ieta(),
00941                                    iem->regionId().iphi(), 0.01);
00942 
00943         int channel;
00944 
00945         channel=PHIBINS*iem->regionId().ieta()+iem->regionId().iphi();
00946         rctIsoEmDataOcc1D_->Fill(channel);
00947 
00948         // new stuff to avoid 0's
00949         // rctIsoEmEmulOcc1D_->Fill(channel,0.01);
00950 
00951         electronDataRank[0][nelectrIsoData]=iem->rank();
00952         electronDataEta[0][nelectrIsoData]=iem->regionId().ieta();
00953         electronDataPhi[0][nelectrIsoData]=iem->regionId().iphi();
00954         nelectrIsoData++ ;
00955       }
00956 
00957       else
00958       {
00959         rctNisoEmDataOcc_->Fill(iem->regionId().ieta(), iem->regionId().iphi());
00960 
00961         // new stuff to avoid 0's in emulator 2D //
00962         // rctNisoEmEmulOcc_->Fill(iem->regionId().ieta(), iem->regionId().iphi(),0.0001);
00963         rctNisoEmOvereffOcc_->Fill (iem->regionId().ieta(),
00964                                     iem->regionId().iphi(), 0.01);
00965 
00966         int channel;
00967 
00968         channel=PHIBINS*iem->regionId().ieta()+iem->regionId().iphi();
00969         rctNisoEmDataOcc1D_->Fill(channel);
00970 
00971         // new stuff to avoid 0's
00972         // rctNisoEmEmulOcc1D_->Fill(channel,0.01);
00973 
00974         electronDataRank[1][nelectrNisoData]=iem->rank();
00975         electronDataEta[1][nelectrNisoData]=iem->regionId().ieta();
00976         electronDataPhi[1][nelectrNisoData]=iem->regionId().iphi();
00977         nelectrNisoData++ ;
00978       }
00979     }
00980   }
00981 
00982     // fill region/bit arrays for emulator
00983   for(L1CaloRegionCollection::const_iterator ireg = rgnEmul->begin();
00984       ireg != rgnEmul->end();
00985       ireg++)
00986   {
00987 //     std::cout << "Emul: " << nRegionEmul << " " << ireg->gctEta() << " " << ireg->gctPhi() << std::endl;
00988     if(ireg->overFlow())  rctBitEmulOverFlow2D_ ->Fill(ireg->gctEta(), ireg->gctPhi());
00989     if(ireg->tauVeto())   rctBitEmulTauVeto2D_  ->Fill(ireg->gctEta(), ireg->gctPhi());
00990     if(ireg->mip())       rctBitEmulMip2D_      ->Fill(ireg->gctEta(), ireg->gctPhi());
00991     if(ireg->quiet())     rctBitEmulQuiet2D_    ->Fill(ireg->gctEta(), ireg->gctPhi());
00992     if(ireg->fineGrain()) rctBitEmulHfPlusTau2D_->Fill(ireg->gctEta(), ireg->gctPhi());
00993     if(ireg->et() > 0)
00994     {
00995       rctRegEmulOcc1D_->Fill(PHIBINS*ireg->gctEta() + ireg->gctPhi());
00996       rctRegEmulOcc2D_->Fill(ireg->gctEta(), ireg->gctPhi());
00997     }
00998 
00999     // to show bad channels in 2D efficiency plots:
01000     if(ireg->overFlow()) {
01001       rctBitUnmatchedEmulOverFlow2D_->Fill (ireg->gctEta(), ireg->gctPhi(), 0.01);
01002       rctBitMatchedOverFlow2D_->Fill       (ireg->gctEta(), ireg->gctPhi(), 0.01);
01003     }
01004 
01005     if(ireg->tauVeto()) {
01006       rctBitUnmatchedEmulTauVeto2D_->Fill (ireg->gctEta(), ireg->gctPhi(), 0.01);
01007       rctBitMatchedTauVeto2D_->Fill       (ireg->gctEta(), ireg->gctPhi(), 0.01);
01008     }
01009 
01010     if(ireg->mip()) {
01011       rctBitUnmatchedEmulMip2D_->Fill (ireg->gctEta(), ireg->gctPhi(), 0.01);
01012       rctBitMatchedMip2D_->Fill       (ireg->gctEta(), ireg->gctPhi(), 0.01);
01013     }
01014 
01015     if(ireg->quiet()) {
01016       rctBitUnmatchedEmulQuiet2D_->Fill (ireg->gctEta(), ireg->gctPhi(), 0.01);
01017       rctBitMatchedQuiet2D_->Fill       (ireg->gctEta(), ireg->gctPhi(), 0.01);
01018     }
01019 
01020     if(ireg->fineGrain()) {
01021       rctBitUnmatchedEmulHfPlusTau2D_->Fill (ireg->gctEta(), ireg->gctPhi(), 0.01);
01022       rctBitMatchedHfPlusTau2D_->Fill       (ireg->gctEta(), ireg->gctPhi(), 0.01);
01023     }
01024 
01025     if(ireg->et() > 0) {
01026       rctRegUnmatchedEmulOcc2D_->Fill (ireg->gctEta(), ireg->gctPhi(), 0.01);
01027       rctRegMatchedOcc2D_->Fill       (ireg->gctEta(), ireg->gctPhi(), 0.01);
01028     }
01029 
01030     nRegionEmul = PHIBINS * ireg->gctEta() + ireg->gctPhi();
01031 
01032     regionEmulRank     [nRegionEmul] = ireg->et();
01033     regionEmulEta      [nRegionEmul] = ireg->gctEta();
01034     regionEmulPhi      [nRegionEmul] = ireg->gctPhi();
01035     regionEmulOverFlow [nRegionEmul] = ireg->overFlow();
01036     regionEmulTauVeto  [nRegionEmul] = ireg->tauVeto();
01037     regionEmulMip      [nRegionEmul] = ireg->mip();
01038     regionEmulQuiet    [nRegionEmul] = ireg->quiet();
01039     regionEmulHfPlusTau[nRegionEmul] = ireg->fineGrain();
01040   }
01041       // fill region/bit arrays for hardware
01042   for(L1CaloRegionCollection::const_iterator ireg = rgnData->begin();
01043       ireg != rgnData->end();
01044       ireg++)
01045   {
01046 //     std::cout << "Data: " << nRegionData << " " << ireg->gctEta() << " " << ireg->gctPhi() << std::endl;
01047     if(ireg->overFlow())  rctBitDataOverFlow2D_ ->Fill(ireg->gctEta(), ireg->gctPhi());
01048     if(ireg->tauVeto())   rctBitDataTauVeto2D_  ->Fill(ireg->gctEta(), ireg->gctPhi());
01049     if(ireg->mip())       rctBitDataMip2D_      ->Fill(ireg->gctEta(), ireg->gctPhi());
01050     if(ireg->quiet())     rctBitDataQuiet2D_    ->Fill(ireg->gctEta(), ireg->gctPhi());
01051     if(ireg->fineGrain()) rctBitDataHfPlusTau2D_->Fill(ireg->gctEta(), ireg->gctPhi());
01052     if(ireg->et() > 0)
01053       {
01054       rctRegDataOcc1D_      ->Fill(PHIBINS*ireg->gctEta() + ireg->gctPhi());
01055       rctRegDataOcc2D_      ->Fill(ireg->gctEta(), ireg->gctPhi());
01056       }
01057     // to show bad channels in 2D inefficiency:
01058     // if(ireg->overFlow())  rctBitEmulOverFlow2D_ ->Fill(ireg->gctEta(), ireg->gctPhi(), 0.01);
01059     // if(ireg->tauVeto())   rctBitEmulTauVeto2D_  ->Fill(ireg->gctEta(), ireg->gctPhi(), 0.01);
01060     // if(ireg->mip())       rctBitEmulMip2D_      ->Fill(ireg->gctEta(), ireg->gctPhi(), 0.01);
01061     // if(ireg->quiet())     rctBitEmulQuiet2D_    ->Fill(ireg->gctEta(), ireg->gctPhi(), 0.01);
01062     // if(ireg->fineGrain()) rctBitEmulHfPlusTau2D_->Fill(ireg->gctEta(), ireg->gctPhi(), 0.01);
01063     // if(ireg->et() > 0)    rctRegEmulOcc2D_      ->Fill(ireg->gctEta(), ireg->gctPhi(), 0.01);
01064     if(ireg->overFlow())  rctBitUnmatchedDataOverFlow2D_ ->Fill(ireg->gctEta(), ireg->gctPhi(), 0.01);
01065     if(ireg->tauVeto())   rctBitUnmatchedDataTauVeto2D_  ->Fill(ireg->gctEta(), ireg->gctPhi(), 0.01);
01066     if(ireg->mip())       rctBitUnmatchedDataMip2D_      ->Fill(ireg->gctEta(), ireg->gctPhi(), 0.01);
01067     if(ireg->quiet())     rctBitUnmatchedDataQuiet2D_    ->Fill(ireg->gctEta(), ireg->gctPhi(), 0.01);
01068     if(ireg->fineGrain()) rctBitUnmatchedDataHfPlusTau2D_->Fill(ireg->gctEta(), ireg->gctPhi(), 0.01);
01069     if(ireg->et() > 0)    rctRegUnmatchedDataOcc2D_      ->Fill(ireg->gctEta(), ireg->gctPhi(), 0.01);
01070 
01071     nRegionData = PHIBINS * ireg->gctEta() + ireg->gctPhi();
01072 
01073     regionDataRank     [nRegionData] = ireg->et();
01074     regionDataEta      [nRegionData] = ireg->gctEta();
01075     regionDataPhi      [nRegionData] = ireg->gctPhi();
01076     regionDataOverFlow [nRegionData] = ireg->overFlow();
01077     regionDataTauVeto  [nRegionData] = ireg->tauVeto();
01078     regionDataMip      [nRegionData] = ireg->mip();
01079     regionDataQuiet    [nRegionData] = ireg->quiet();
01080     regionDataHfPlusTau[nRegionData] = ireg->fineGrain();
01081   }
01082 
01083  if(verbose_)
01084 {
01085   std::cout << "I found Data! Iso: " << nelectrIsoData << " Niso: " << nelectrNisoData <<  std::endl ;
01086   for(int i=0; i<nelectrNisoData; i++)
01087   std::cout << " Energy " << electronDataRank[1][i] << " eta " << electronDataEta[1][i] << " phi " << electronDataPhi[1][i] << std::endl ;
01088 
01089   std::cout << "I found Emul! Iso: " << nelectrIsoEmul << " Niso: " << nelectrNisoEmul <<  std::endl ;
01090   for(int i=0; i<nelectrNisoEmul; i++)
01091   std::cout << " Energy " << electronEmulRank[1][i] << " eta " << electronEmulEta[1][i] << " phi " << electronEmulPhi[1][i] << std::endl ;
01092 
01093   std::cout << "I found Data! Regions: " << nRegionData <<  std::endl ;
01094   for(int i=0; i<nRegionData; i++)
01095  if(regionDataRank[i] !=0 )  std::cout << " Energy " << regionDataRank[i] << " eta " << regionDataEta[i] << " phi " << regionDataPhi[i] << std::endl ;
01096 
01097   std::cout << "I found Emul! Regions: " << nRegionEmul <<  std::endl ;
01098   for(int i=0; i<nRegionEmul; i++)
01099  if(regionEmulRank[i] !=0 )  std::cout << " Energy " << regionEmulRank[i] << " eta " << regionEmulEta[i] << " phi " << regionEmulPhi[i] << std::endl ;
01100 }
01101 
01102   // StepIII: calculate and fill
01103 
01104   for(int k=0; k<2; k++)
01105   {
01106     int nelectrE, nelectrD;
01107 
01108     if(k==0)
01109     {
01110       nelectrE=nelectrIsoEmul;
01111       nelectrD=nelectrIsoData;
01112     }
01113 
01114     else
01115     {
01116       nelectrE=nelectrNisoEmul;
01117       nelectrD=nelectrNisoData;
01118     }
01119 
01120     for(int i = 0; i < nelectrE; i++)
01121     {
01122       Bool_t found = kFALSE;
01123 
01124       for(int j = 0; j < nelectrD; j++)
01125       {
01126         if(electronEmulEta[k][i]==electronDataEta[k][j] &&
01127            electronEmulPhi[k][i]==electronDataPhi[k][j])
01128         {
01129           if(k==0)
01130           {
01131             rctIsoEmEff1Occ_->Fill(electronEmulEta[k][i], electronEmulPhi[k][i], 0.980001);
01132             // Weight is for ROOT; when added to initial weight of 0.01, should just exceed 0.99
01133 
01134             int chnl;
01135 
01136             chnl=PHIBINS*electronEmulEta[k][i]+electronEmulPhi[k][i];
01137             rctIsoEmEff1Occ1D_->Fill(chnl);
01138             if(singlechannelhistos_)
01139             {
01140               int energy_difference;
01141 
01142               energy_difference=(electronEmulRank[k][i] - electronDataRank[k][j]);
01143               rctIsoEffChannel_[chnl]->Fill(energy_difference);
01144             }
01145 
01146             if(electronEmulRank[k][i]==electronDataRank[k][j])
01147             {
01148               rctIsoEmEff2Occ1D_->Fill(chnl);
01149               rctIsoEmEff2Occ_->Fill(electronEmulEta[k][i], electronEmulPhi[k][i]);
01150             }
01151           }
01152 
01153           else
01154           {
01155             rctNisoEmEff1Occ_->Fill(electronEmulEta[k][i], electronEmulPhi[k][i], 0.980001);
01156             // Weight is for ROOT; when added to initial weight of 0.01, should just exceed 0.99
01157 
01158             int chnl;
01159 
01160             chnl=PHIBINS*electronEmulEta[k][i]+electronEmulPhi[k][i];
01161             rctNisoEmEff1Occ1D_->Fill(chnl);
01162             if(singlechannelhistos_)
01163             {
01164               int energy_difference;
01165 
01166               energy_difference=(electronEmulRank[k][i] - electronDataRank[k][j]) ;
01167               rctNisoEffChannel_[chnl]->Fill(energy_difference) ;
01168             }
01169 
01170             if(electronEmulRank[k][i]==electronDataRank[k][j])
01171             {
01172               rctNisoEmEff2Occ1D_->Fill(chnl);
01173               rctNisoEmEff2Occ_->Fill(electronEmulEta[k][i], electronEmulPhi[k][i]);
01174             }
01175           }
01176 
01177           found = kTRUE;
01178         }
01179       }
01180 
01181       if(found == kFALSE)
01182       {
01183         if(k==0)
01184         {
01185           rctIsoEmIneffOcc_->Fill(electronEmulEta[k][i], electronEmulPhi[k][i],0.99);
01186 
01187           int chnl;
01188 
01189           chnl=PHIBINS*electronEmulEta[k][i]+electronEmulPhi[k][i];
01190           rctIsoEmIneffOcc1D_->Fill(chnl);
01191           if(singlechannelhistos_)
01192           {
01193             rctIsoIneffChannel_[chnl]->Fill(electronEmulRank[k][i]);
01194           }
01195         }
01196 
01197         else
01198         {
01199           rctNisoEmIneffOcc_->Fill(electronEmulEta[k][i], electronEmulPhi[k][i],0.99);
01200 
01201           int chnl;
01202 
01203           chnl=PHIBINS*electronEmulEta[k][i]+electronEmulPhi[k][i];
01204           rctNisoEmIneffOcc1D_->Fill(chnl);
01205           if(singlechannelhistos_)
01206           {
01207             rctNisoIneffChannel_[chnl]->Fill(electronEmulRank[k][i]);
01208           }
01209         }
01210       }
01211 
01212       DivideME1D(rctIsoEmEff1Occ1D_, rctIsoEmEmulOcc1D_, rctIsoEmEff1oneD_);
01213       DivideME2D(rctIsoEmEff1Occ_, rctIsoEmEmulOcc_, rctIsoEmEff1_) ;
01214       DivideME1D(rctIsoEmEff2Occ1D_, rctIsoEmEmulOcc1D_, rctIsoEmEff2oneD_);
01215       DivideME2D(rctIsoEmEff2Occ_, rctIsoEmEmulOcc_, rctIsoEmEff2_) ;
01216       DivideME1D(rctNisoEmEff1Occ1D_, rctNisoEmEmulOcc1D_, rctNisoEmEff1oneD_);
01217       DivideME2D(rctNisoEmEff1Occ_, rctNisoEmEmulOcc_, rctNisoEmEff1_);
01218       DivideME1D(rctNisoEmEff2Occ1D_, rctNisoEmEmulOcc1D_, rctNisoEmEff2oneD_);
01219       DivideME2D(rctNisoEmEff2Occ_, rctNisoEmEmulOcc_, rctNisoEmEff2_);
01220 
01221       DivideME1D(rctIsoEmIneffOcc1D_, rctIsoEmEmulOcc1D_, rctIsoEmIneff1D_);
01222       DivideME2D(rctIsoEmIneffOcc_, rctIsoEmEmulOcc_, rctIsoEmIneff_);
01223       DivideME1D(rctNisoEmIneffOcc1D_, rctNisoEmEmulOcc1D_, rctNisoEmIneff1D_);
01224       DivideME2D(rctNisoEmIneffOcc_, rctNisoEmEmulOcc_, rctNisoEmIneff_);
01225     }
01226 
01227     for(int i = 0; i < nelectrD; i++)
01228     {
01229       Bool_t found = kFALSE;
01230 
01231       for(int j = 0; j < nelectrE; j++)
01232       {
01233         if(electronEmulEta[k][j]==electronDataEta[k][i] &&
01234            electronEmulPhi[k][j]==electronDataPhi[k][i])
01235         {
01236           found = kTRUE;
01237         }
01238       }
01239 
01240       if(found == kFALSE)
01241       {
01242         if(k==0)
01243         {
01244           rctIsoEmOvereffOcc_->Fill(electronDataEta[k][i], electronDataPhi[k][i], 0.99);
01245 
01246           int chnl;
01247 
01248           chnl=PHIBINS*electronDataEta[k][i]+electronDataPhi[k][i];
01249           rctIsoEmOvereffOcc1D_->Fill(chnl);
01250 
01251           if(singlechannelhistos_)
01252           {
01253             rctIsoOvereffChannel_[chnl]->Fill(electronDataRank[k][i]);
01254           }
01255         }
01256 
01257         else
01258         {
01259           rctNisoEmOvereffOcc_->Fill(electronDataEta[k][i], electronDataPhi[k][i], 0.99);
01260 
01261           int chnl;
01262 
01263           chnl=PHIBINS*electronDataEta[k][i]+electronDataPhi[k][i];
01264           rctNisoEmOvereffOcc1D_->Fill(chnl) ;
01265 
01266           if(singlechannelhistos_)
01267           {
01268             rctNisoOvereffChannel_[chnl]->Fill(electronDataRank[k][i]);
01269           }
01270         }
01271       }
01272     }
01273 
01274     // we try new definition of overefficiency:
01275     DivideME1D(rctIsoEmOvereffOcc1D_, rctIsoEmDataOcc1D_, rctIsoEmOvereff1D_);
01276     DivideME2D(rctIsoEmOvereffOcc_, rctIsoEmDataOcc_, rctIsoEmOvereff_);
01277     DivideME1D(rctNisoEmOvereffOcc1D_, rctNisoEmDataOcc1D_, rctNisoEmOvereff1D_);
01278     DivideME2D(rctNisoEmOvereffOcc_, rctNisoEmDataOcc_, rctNisoEmOvereff_);
01279   }
01280 
01281 //std::cout << " I am here " << std::endl ;
01282 
01283     // calculate region/bit information
01284   for(unsigned int i = 0; i < PhiEtaMax; i++)
01285 {
01286       Bool_t regFound       = kFALSE;
01287       Bool_t overFlowFound  = kFALSE;
01288       Bool_t tauVetoFound   = kFALSE;
01289       Bool_t mipFound       = kFALSE;
01290       Bool_t quietFound     = kFALSE;
01291       Bool_t hfPlusTauFound = kFALSE;
01292 
01293 //       for(int j = 0; j < nRegionData; j++)
01294 //    {
01295 //         if(regionEmulEta[i] == regionDataEta[j] &&
01296 //            regionEmulPhi[i] == regionDataPhi[j])
01297 //         {
01298           if(regionDataRank[i] >= 1 && regionEmulRank[i] >= 1)
01299           {
01300             int chnl;
01301 
01302             chnl = PHIBINS*regionEmulEta[i] + regionEmulPhi[i];
01303             rctRegMatchedOcc1D_->Fill(chnl);
01304             rctRegMatchedOcc2D_->Fill(regionEmulEta[i], regionEmulPhi[i], 0.980001);
01305             // Weight is for ROOT; when added to initial weight of 0.01, should just exceed 0.99
01306 
01307             if(singlechannelhistos_) rctRegEffChannel_[chnl]->Fill(regionEmulRank[i] - regionDataRank[i]);
01308 
01309             if(regionEmulRank[i] == regionDataRank[i]) rctRegDeltaEtOcc2D_->Fill(regionEmulEta[i], regionEmulPhi[i], 0.980001);
01310 
01311             regFound = kTRUE;
01312           }
01313 
01314           if(regionEmulOverFlow[i] == true &&
01315              regionDataOverFlow[i] == true)
01316           {
01317             rctBitMatchedOverFlow2D_->Fill(regionEmulEta[i], regionEmulPhi[i], 0.980001);
01318             overFlowFound = kTRUE;
01319           }
01320 
01321           if(regionEmulTauVeto[i] == true &&
01322              regionDataTauVeto[i] == true)
01323           {
01324             rctBitMatchedTauVeto2D_->Fill(regionEmulEta[i], regionEmulPhi[i], 0.980001);
01325             tauVetoFound = kTRUE;
01326           }
01327 
01328           if (regionEmulMip[i] == true && regionDataMip[i] == true) {
01329             rctBitMatchedMip2D_->Fill (regionEmulEta[i], regionEmulPhi[i], 0.980001);
01330             mipFound = kTRUE;
01331           }
01332 
01333           if (regionEmulQuiet[i] == true && regionDataQuiet[i] == true) {
01334             rctBitMatchedQuiet2D_->Fill (regionEmulEta[i], regionEmulPhi[i], 0.980001);
01335             quietFound = kTRUE;
01336           }
01337 
01338           if (regionEmulHfPlusTau[i] == true && regionDataHfPlusTau[i] == true) {
01339             rctBitMatchedHfPlusTau2D_->Fill (regionEmulEta[i], regionEmulPhi[i], 0.980001);
01340             hfPlusTauFound = kTRUE;
01341           }
01342 
01343 
01344 //         }
01345 //       }
01346 
01347       DivideME1D(rctRegMatchedOcc1D_, rctRegEmulOcc1D_, rctRegEff1D_);
01348       DivideME2D(rctRegMatchedOcc2D_, rctRegEmulOcc2D_, rctRegEff2D_);
01349       DivideME2D(rctRegDeltaEtOcc2D_, rctRegEmulOcc2D_, rctRegSpEff2D_);
01350       DivideME2D(rctBitMatchedOverFlow2D_, rctBitEmulOverFlow2D_, rctBitOverFlowEff2D_);
01351       DivideME2D(rctBitMatchedTauVeto2D_, rctBitEmulTauVeto2D_, rctBitTauVetoEff2D_);
01352       DivideME2D (rctBitMatchedMip2D_, rctBitEmulMip2D_, rctBitMipEff2D_);
01353       DivideME2D (rctBitMatchedQuiet2D_, rctBitEmulQuiet2D_, rctBitQuietEff2D_);
01354       DivideME2D (rctBitMatchedHfPlusTau2D_, rctBitEmulHfPlusTau2D_, rctBitHfPlusTauEff2D_);
01355 
01356 
01357       if(regFound == kFALSE && regionEmulRank[i] >= 1 )
01358       {
01359         int chnl;
01360 
01361         chnl = PHIBINS*regionEmulEta[i] + regionEmulPhi[i];
01362         rctRegUnmatchedEmulOcc1D_->Fill(chnl);
01363         rctRegUnmatchedEmulOcc2D_->Fill(regionEmulEta[i], regionEmulPhi[i],0.99);
01364 
01365         if(singlechannelhistos_) rctRegIneffChannel_[chnl]->Fill(regionEmulRank[i]);
01366       }
01367 
01368       if(overFlowFound == kFALSE && regionEmulOverFlow[i] == true)
01369       {
01370         rctBitUnmatchedEmulOverFlow2D_->Fill(regionEmulEta[i], regionEmulPhi[i], 0.99);
01371       }
01372 
01373       if(tauVetoFound == kFALSE && regionEmulTauVeto[i] == true)
01374       {
01375         rctBitUnmatchedEmulTauVeto2D_->Fill(regionEmulEta[i], regionEmulPhi[i], 0.99);
01376       }
01377 
01378       if (mipFound == kFALSE && regionEmulMip[i] == true) {
01379         rctBitUnmatchedEmulMip2D_->Fill (regionEmulEta[i], regionEmulPhi[i], 0.99);
01380       }
01381 
01382       if (quietFound == kFALSE && regionEmulQuiet[i] == true) {
01383         rctBitUnmatchedEmulQuiet2D_->Fill (regionEmulEta[i], regionEmulPhi[i], 0.99);
01384       }
01385 
01386       if (hfPlusTauFound == kFALSE && regionEmulHfPlusTau[i] == true ) {
01387         rctBitUnmatchedEmulHfPlusTau2D_->Fill (regionEmulEta[i], regionEmulPhi[i], 0.99);
01388       }
01389 
01390       DivideME1D(rctRegUnmatchedEmulOcc1D_, rctRegEmulOcc1D_, rctRegIneff1D_);
01391       DivideME2D(rctRegUnmatchedEmulOcc2D_, rctRegEmulOcc2D_, rctRegIneff2D_);
01392       DivideME2D(rctBitUnmatchedEmulOverFlow2D_, rctBitEmulOverFlow2D_, rctBitOverFlowIneff2D_);
01393       DivideME2D(rctBitUnmatchedEmulTauVeto2D_, rctBitEmulTauVeto2D_, rctBitTauVetoIneff2D_);
01394       DivideME2D (rctBitUnmatchedEmulMip2D_, rctBitEmulMip2D_, rctBitMipIneff2D_);
01395       DivideME2D (rctBitUnmatchedEmulQuiet2D_, rctBitEmulQuiet2D_, rctBitQuietIneff2D_);
01396       DivideME2D (rctBitUnmatchedEmulHfPlusTau2D_, rctBitEmulHfPlusTau2D_, rctBitHfPlusTauIneff2D_);
01397 
01398 }
01399 
01400 //std::cout << " I am here 2 " << std::endl ;
01401 
01402   for(int i = 0; i < nRegionData; i++)
01403 {
01404       Bool_t regFound       = kFALSE;
01405       Bool_t overFlowFound  = kFALSE;
01406       Bool_t tauVetoFound   = kFALSE;
01407       Bool_t mipFound       = kFALSE;
01408       Bool_t quietFound     = kFALSE;
01409       Bool_t hfPlusTauFound = kFALSE;
01410 
01411 //       for(int j = 0; j < nRegionEmul; j++)
01412 //      {
01413 //         if(regionEmulEta[j] == regionDataEta[i] &&
01414 //            regionEmulPhi[j] == regionDataPhi[i])
01415 //         {
01416 
01417           if(regionEmulRank[i] >= 1 && regionDataRank[i] >= 1)
01418             regFound = kTRUE;
01419 
01420           if(regionDataOverFlow[i] == true &&
01421              regionEmulOverFlow[i] == true)
01422             overFlowFound = kTRUE;
01423 
01424           if(regionDataTauVeto[i] == true &&
01425              regionEmulTauVeto[i] == true)
01426             tauVetoFound = kTRUE;
01427 
01428           if (regionDataMip[i] == true && regionEmulMip[i] == true)
01429             mipFound = kTRUE;
01430 
01431           if (regionDataQuiet[i] == true && regionEmulQuiet[i] == true)
01432             quietFound = kTRUE;
01433 
01434           if (regionDataHfPlusTau[i] == true && regionEmulHfPlusTau[i] == true)
01435             hfPlusTauFound = kTRUE;
01436 //         }
01437 //       }
01438 
01439       if(regFound == kFALSE && regionDataRank[i] >= 1)
01440       {
01441         int chnl;
01442 
01443         chnl = PHIBINS*regionDataEta[i] + regionDataPhi[i];
01444         rctRegUnmatchedDataOcc1D_->Fill(chnl);
01445         rctRegUnmatchedDataOcc2D_->Fill(regionDataEta[i], regionDataPhi[i], 0.99);
01446 
01447         // we try a new definition of overefficiency:
01448         DivideME1D(rctRegUnmatchedDataOcc1D_, rctRegDataOcc1D_, rctRegOvereff1D_);
01449         DivideME2D(rctRegUnmatchedDataOcc2D_, rctRegDataOcc2D_, rctRegOvereff2D_);
01450         
01451         if(singlechannelhistos_) rctRegOvereffChannel_[chnl]->Fill(regionDataRank[i]);
01452       }
01453 
01454       if(overFlowFound == kFALSE && regionDataOverFlow[i] == true )
01455       {
01456         rctBitUnmatchedDataOverFlow2D_->Fill(regionDataEta[i], regionDataPhi[i], 0.99);
01457       }
01458 
01459       if(tauVetoFound == kFALSE && regionDataTauVeto[i] == true )
01460       {
01461         rctBitUnmatchedDataTauVeto2D_->Fill(regionDataEta[i], regionDataPhi[i], 0.99);
01462       }
01463 
01464       if (mipFound == kFALSE && regionDataMip[i] == true ) {
01465         rctBitUnmatchedDataMip2D_->Fill (regionDataEta[i], regionDataPhi[i], 0.99);
01466       }
01467 
01468       if (quietFound == kFALSE && regionDataQuiet[i] == true ) {
01469         rctBitUnmatchedDataQuiet2D_->Fill (regionDataEta[i], regionDataPhi[i], 0.99);
01470       }
01471 
01472       if (hfPlusTauFound == kFALSE && regionDataHfPlusTau[i] == true ) {
01473         rctBitUnmatchedDataHfPlusTau2D_->Fill (regionDataEta[i], regionDataPhi[i], 0.99);
01474       }
01475 
01476     // we try a new definition of overefficiency:
01477     DivideME2D(rctRegUnmatchedDataOcc2D_, rctRegDataOcc2D_, rctRegOvereff2D_);
01478     DivideME2D(rctBitUnmatchedDataOverFlow2D_, rctBitDataOverFlow2D_, rctBitOverFlowOvereff2D_);
01479     DivideME2D(rctBitUnmatchedDataTauVeto2D_, rctBitDataTauVeto2D_, rctBitTauVetoOvereff2D_);
01480     DivideME2D (rctBitUnmatchedDataMip2D_, rctBitDataMip2D_,
01481           rctBitMipOvereff2D_);
01482     DivideME2D (rctBitUnmatchedDataQuiet2D_, rctBitDataQuiet2D_,
01483           rctBitQuietOvereff2D_);
01484     DivideME2D (rctBitUnmatchedDataHfPlusTau2D_, rctBitDataHfPlusTau2D_,
01485           rctBitHfPlusTauOvereff2D_);
01486 }
01487 
01488 }
01489 
01490 void L1TdeRCT::DivideME2D(MonitorElement* numerator, MonitorElement* denominator, MonitorElement* result){
01491 
01492    TH2F* num = numerator->getTH2F();
01493    TH2F* den = denominator->getTH2F();
01494    TH2F* res = result->getTH2F();
01495 
01496    res->Divide(num,den,1,1,"");
01497 
01498 }
01499 
01500 void L1TdeRCT::DivideME1D(MonitorElement* numerator, MonitorElement* denominator, MonitorElement* result){
01501 
01502    TH1F* num = numerator->getTH1F();
01503    TH1F* den = denominator->getTH1F();
01504    TH1F* res = result->getTH1F();
01505 
01506    res->Divide(num,den,1,1,"");
01507 
01508 }

Generated on Tue Jun 9 17:33:11 2009 for CMSSW by  doxygen 1.5.4