Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:07:50

0001 /*
0002  * \file L1TdeRCT.cc
0003  *
0004  * version 0.0 A.Savin 2008/04/26
0005  * version 1.0 A.Savin 2008/05/05
0006  * this version contains single channel histos and 1D efficiencies
0007  */
0008 
0009 #include "DQM/L1TMonitor/interface/L1TdeRCT.h"
0010 
0011 #include "FWCore/Framework/interface/ESHandle.h"
0012 #include "DataFormats/Provenance/interface/EventAuxiliary.h"
0013 
0014 #include "TF2.h"
0015 
0016 #include <iostream>
0017 #include <bitset>
0018 
0019 #include "CondFormats/RunInfo/interface/RunInfo.h"
0020 #include "CondFormats/DataRecord/interface/RunSummaryRcd.h"
0021 
0022 using namespace edm;
0023 using namespace std;
0024 
0025 namespace {
0026   constexpr unsigned int PHIBINS = 18;
0027   constexpr float PHIMIN = -0.5;
0028   constexpr float PHIMAX = 17.5;
0029 
0030   constexpr unsigned int ETABINS = 22;
0031   constexpr float ETAMIN = -0.5;
0032   constexpr float ETAMAX = 21.5;
0033 
0034   constexpr unsigned int BITETABINS = 44;
0035   constexpr float BITETAMIN = 0;
0036   constexpr float BITETAMAX = 22;
0037 
0038   constexpr unsigned int BITPHIBINS = 72;
0039   constexpr float BITPHIMIN = 0;
0040   constexpr float BITPHIMAX = 18;
0041 
0042   constexpr unsigned int BITRPHIBINS = 90;
0043   constexpr float BITRPHIMIN = 0;
0044   constexpr float BITRPHIMAX = 18;
0045 
0046   constexpr unsigned int TPGPHIBINS = 72;
0047   constexpr float TPGPHIMIN = -0.5;
0048   constexpr float TPGPHIMAX = 71.5;
0049 
0050   constexpr unsigned int TPGETABINS = 64;
0051   constexpr float TPGETAMIN = -32.;
0052   constexpr float TPGETAMAX = 32.;
0053 
0054   constexpr unsigned int TPGRANK = 256;
0055   constexpr float TPGRANKMIN = -.5;
0056   constexpr float TPGRANKMAX = 255.5;
0057 
0058   constexpr unsigned int DEBINS = 127;
0059   constexpr float DEMIN = -63.5;
0060   constexpr float DEMAX = 63.5;
0061 
0062   constexpr unsigned int ELBINS = 64;
0063   constexpr float ELMIN = -.5;
0064   constexpr float ELMAX = 63.5;
0065 
0066   constexpr unsigned int PhiEtaMax = 396;
0067   constexpr unsigned int CHNLBINS = 396;
0068   constexpr float CHNLMIN = -0.5;
0069   constexpr float CHNLMAX = 395.5;
0070 }  // namespace
0071 
0072 const int L1TdeRCT::crateFED[108] = {
0073     613, 614, 603, 702, 718, 1118, 611, 612, 602, 700, 718, 1118, 627, 610, 601, 716, 722, 1122,
0074     625, 626, 609, 714, 722, 1122, 623, 624, 608, 712, 722, 1122, 621, 622, 607, 710, 720, 1120,
0075     619, 620, 606, 708, 720, 1120, 617, 618, 605, 706, 720, 1120, 615, 616, 604, 704, 718, 1118,
0076     631, 632, 648, 703, 719, 1118, 629, 630, 647, 701, 719, 1118, 645, 628, 646, 717, 723, 1122,
0077     643, 644, 654, 715, 723, 1122, 641, 642, 653, 713, 723, 1122, 639, 640, 652, 711, 721, 1120,
0078     637, 638, 651, 709, 721, 1120, 635, 636, 650, 707, 721, 1120, 633, 634, 649, 705, 719, 1118};
0079 
0080 L1TdeRCT::L1TdeRCT(const ParameterSet& ps)
0081     : rctSourceEmul_rgnEmul_(consumes<L1CaloRegionCollection>(ps.getParameter<InputTag>("rctSourceEmul"))),
0082       rctSourceEmul_emEmul_(consumes<L1CaloEmCollection>(ps.getParameter<InputTag>("rctSourceEmul"))),
0083       rctSourceData_rgnData_(consumes<L1CaloRegionCollection>(ps.getParameter<InputTag>("rctSourceData"))),
0084       rctSourceData_emData_(consumes<L1CaloEmCollection>(ps.getParameter<InputTag>("rctSourceData"))),
0085       ecalTPGData_(consumes<EcalTrigPrimDigiCollection>(ps.getParameter<InputTag>("ecalTPGData"))),
0086       hcalTPGData_(consumes<HcalTrigPrimDigiCollection>(ps.getParameter<InputTag>("hcalTPGData"))),
0087       gtDigisLabel_(consumes<L1GlobalTriggerReadoutRecord>(ps.getParameter<InputTag>("gtDigisLabel"))),
0088       runInfoToken_(esConsumes<edm::Transition::BeginRun>()),
0089       runInfolumiToken_(esConsumes<edm::Transition::BeginLuminosityBlock>()),
0090       gtEGAlgoName_(ps.getParameter<std::string>("gtEGAlgoName")),
0091       doubleThreshold_(ps.getParameter<int>("doubleThreshold")),
0092       filterTriggerType_(ps.getParameter<int>("filterTriggerType")),
0093       selectBX_(ps.getUntrackedParameter<int>("selectBX", 2)),
0094       dataInputTagName_(ps.getParameter<InputTag>("rctSourceData").label()) {
0095   singlechannelhistos_ = ps.getUntrackedParameter<bool>("singlechannelhistos", false);
0096 
0097   perLSsaving_ = (ps.getUntrackedParameter<bool>("perLSsaving", false));
0098 
0099   if (singlechannelhistos_)
0100     if (verbose_)
0101       std::cout << "L1TdeRCT: single channels histos ON" << std::endl;
0102 
0103   // verbosity switch
0104   verbose_ = ps.getUntrackedParameter<bool>("verbose", false);
0105 
0106   if (verbose_)
0107     std::cout << "L1TdeRCT: constructor...." << std::endl;
0108 
0109   histFolder_ = ps.getUntrackedParameter<std::string>("HistFolder", "L1TEMU/L1TdeRCT");
0110 }
0111 
0112 L1TdeRCT::~L1TdeRCT() {}
0113 
0114 void L1TdeRCT::analyze(const Event& e, const EventSetup& c) {
0115   nev_++;
0116   if (verbose_) {
0117     std::cout << "L1TdeRCT: analyze...." << std::endl;
0118   }
0119 
0120   // filter according trigger type
0121   //  enum ExperimentType {
0122   //        Undefined          =  0,
0123   //        PhysicsTrigger     =  1,
0124   //        CalibrationTrigger =  2,
0125   //        RandomTrigger      =  3,
0126   //        Reserved           =  4,
0127   //        TracedEvent        =  5,
0128   //        TestTrigger        =  6,
0129   //        ErrorTrigger       = 15
0130 
0131   // fill a histogram with the trigger type, for normalization fill also last bin
0132   // ErrorTrigger + 1
0133   double triggerType = static_cast<double>(e.experimentType()) + 0.001;
0134   double triggerTypeLast = static_cast<double>(edm::EventAuxiliary::ExperimentType::ErrorTrigger) + 0.001;
0135   triggerType_->Fill(triggerType);
0136   triggerType_->Fill(triggerTypeLast + 1);
0137 
0138   // filter only if trigger type is greater than 0, negative values disable filtering
0139   if (filterTriggerType_ >= 0) {
0140     // now filter, for real data only
0141     if (e.isRealData()) {
0142       if (!(e.experimentType() == filterTriggerType_)) {
0143         edm::LogInfo("L1TdeRCT") << "\n Event of TriggerType " << e.experimentType() << " rejected" << std::endl;
0144         return;
0145       }
0146     }
0147   }
0148 
0149   // for GT decision word
0150   edm::Handle<L1GlobalTriggerReadoutRecord> gtRecord;
0151 
0152   // get GT decision word
0153   e.getByToken(gtDigisLabel_, gtRecord);
0154   const DecisionWord dWord =
0155       gtRecord->decisionWord();  // this will get the decision word *before* masking disabled bits
0156   int effEGThresholdBitNumber = 999;
0157   if (gtEGAlgoName_ == "L1_SingleEG1") {
0158     effEGThresholdBitNumber = 46;
0159   }
0160   if (gtEGAlgoName_ == "L1_SingleEG5_0001") {
0161     effEGThresholdBitNumber = 47;
0162   }
0163   if (gtEGAlgoName_ == "L1_SingleEG8_0001") {
0164     effEGThresholdBitNumber = 48;
0165   }
0166   if (gtEGAlgoName_ == "L1_SingleEG10_0001") {
0167     effEGThresholdBitNumber = 49;
0168   }
0169   if (gtEGAlgoName_ == "L1_SingleEG12_0001") {
0170     effEGThresholdBitNumber = 50;
0171   }
0172   if (gtEGAlgoName_ == "L1_SingleEG15_0001") {
0173     effEGThresholdBitNumber = 51;
0174   }
0175   if (gtEGAlgoName_ == "L1_SingleEG20_0001") {
0176     effEGThresholdBitNumber = 52;
0177   }
0178 
0179   int algoBitNumber = 0;
0180   bool triggered = false;
0181   bool independent_triggered = false;
0182   DecisionWord::const_iterator algoItr;
0183   for (algoItr = dWord.begin(); algoItr != dWord.end(); algoItr++) {
0184     if (*algoItr) {
0185       triggerAlgoNumbers_->Fill(algoBitNumber);
0186       if (algoBitNumber == effEGThresholdBitNumber) {
0187         triggered = true;  // Fill triggered events (numerator) here!
0188       }
0189       if (algoBitNumber <= 45 || algoBitNumber >= 53) {
0190         independent_triggered = true;  // use the muon path only !
0191       }
0192     }
0193     algoBitNumber++;
0194   }
0195 
0196   if (triggered)
0197     trigCount++;
0198   else
0199     notrigCount++;
0200 
0201   // get TPGs
0202   edm::Handle<EcalTrigPrimDigiCollection> ecalTpData;
0203   edm::Handle<HcalTrigPrimDigiCollection> hcalTpData;
0204 
0205   // Get the RCT digis
0206   edm::Handle<L1CaloEmCollection> emData;
0207   edm::Handle<L1CaloRegionCollection> rgnData;
0208 
0209   // Get the RCT digis
0210   edm::Handle<L1CaloEmCollection> emEmul;
0211   edm::Handle<L1CaloRegionCollection> rgnEmul;
0212 
0213   bool doEcal = true;
0214   bool doHcal = true;
0215 
0216   // TPG, first try:
0217   e.getByToken(ecalTPGData_, ecalTpData);
0218   e.getByToken(hcalTPGData_, hcalTpData);
0219 
0220   if (!ecalTpData.isValid()) {
0221     edm::LogInfo("TPG DataNotFound") << "can't find EcalTrigPrimDigiCollection";
0222     if (verbose_)
0223       std::cout << "Can not find ecalTpData!" << std::endl;
0224 
0225     doEcal = false;
0226   }
0227 
0228   if (doEcal) {
0229     for (EcalTrigPrimDigiCollection::const_iterator iEcalTp = ecalTpData->begin(); iEcalTp != ecalTpData->end();
0230          iEcalTp++) {
0231       if (iEcalTp->compressedEt() > 0) {
0232         rctInputTPGEcalRank_->Fill(1. * (iEcalTp->compressedEt()));
0233 
0234         if (iEcalTp->id().ieta() > 0) {
0235           rctInputTPGEcalOccNoCut_->Fill(1. * (iEcalTp->id().ieta()) - 0.5, iEcalTp->id().iphi());
0236           if (iEcalTp->compressedEt() > 3)
0237             rctInputTPGEcalOcc_->Fill(1. * (iEcalTp->id().ieta()) - 0.5, iEcalTp->id().iphi());
0238         } else {
0239           rctInputTPGEcalOccNoCut_->Fill(1. * (iEcalTp->id().ieta()) + 0.5, iEcalTp->id().iphi());
0240           if (iEcalTp->compressedEt() > 3)
0241             rctInputTPGEcalOcc_->Fill(1. * (iEcalTp->id().ieta()) + 0.5, iEcalTp->id().iphi());
0242         }
0243 
0244         if (verbose_)
0245           std::cout << " ECAL data: Energy: " << iEcalTp->compressedEt() << " eta " << iEcalTp->id().ieta() << " phi "
0246                     << iEcalTp->id().iphi() << std::endl;
0247       }
0248     }
0249   }
0250 
0251   if (!hcalTpData.isValid()) {
0252     edm::LogInfo("TPG DataNotFound") << "can't find HcalTrigPrimDigiCollection";
0253     if (verbose_)
0254       std::cout << "Can not find hcalTpData!" << std::endl;
0255 
0256     doHcal = false;
0257   }
0258 
0259   if (doHcal) {
0260     for (HcalTrigPrimDigiCollection::const_iterator iHcalTp = hcalTpData->begin(); iHcalTp != hcalTpData->end();
0261          iHcalTp++) {
0262       int highSample = 0;
0263       int highEt = 0;
0264 
0265       for (int nSample = 0; nSample < 10; nSample++) {
0266         if (iHcalTp->sample(nSample).compressedEt() != 0) {
0267           if (verbose_)
0268             std::cout << "HCAL data: Et " << iHcalTp->sample(nSample).compressedEt() << "  fg "
0269                       << iHcalTp->sample(nSample).fineGrain() << "  ieta " << iHcalTp->id().ieta() << "  iphi "
0270                       << iHcalTp->id().iphi() << "  sample " << nSample << std::endl;
0271           if (iHcalTp->sample(nSample).compressedEt() > highEt) {
0272             highSample = nSample;
0273             highEt = iHcalTp->sample(nSample).compressedEt();
0274           }
0275         }
0276       }
0277 
0278       if (highEt != 0) {
0279         if (iHcalTp->id().ieta() > 0)
0280           rctInputTPGHcalOcc_->Fill(1. * (iHcalTp->id().ieta()) - 0.5, iHcalTp->id().iphi());
0281         else
0282           rctInputTPGHcalOcc_->Fill(1. * (iHcalTp->id().ieta()) + 0.5, iHcalTp->id().iphi());
0283         rctInputTPGHcalSample_->Fill(highSample, highEt);
0284         rctInputTPGHcalRank_->Fill(highEt);
0285       }
0286     }
0287   }
0288 
0289   e.getByToken(rctSourceData_rgnData_, rgnData);
0290   e.getByToken(rctSourceEmul_rgnEmul_, rgnEmul);
0291 
0292   if (!rgnData.isValid()) {
0293     edm::LogInfo("DataNotFound") << "can't find L1CaloRegionCollection";
0294     if (verbose_)
0295       std::cout << "Can not find rgnData!" << std::endl;
0296     return;
0297   }
0298 
0299   if (!rgnEmul.isValid()) {
0300     edm::LogInfo("DataNotFound") << "can't find L1CaloRegionCollection";
0301     if (verbose_)
0302       std::cout << "Can not find rgnEmul!" << std::endl;
0303     return;
0304   }
0305 
0306   e.getByToken(rctSourceData_emData_, emData);
0307   e.getByToken(rctSourceEmul_emEmul_, emEmul);
0308 
0309   if (!emData.isValid()) {
0310     edm::LogInfo("DataNotFound") << "can't find L1CaloEmCollection";
0311     if (verbose_)
0312       std::cout << "Can not find emData!" << std::endl;
0313     return;
0314   }
0315 
0316   if (!emEmul.isValid()) {
0317     edm::LogInfo("DataNotFound") << "can't find L1CaloEmCollection";
0318     if (verbose_)
0319       std::cout << "Can not find emEmul!" << std::endl;
0320     return;
0321   }
0322 
0323   // Isolated and non-isolated EM
0324 
0325   // StepI: Reset
0326 
0327   int nelectrIsoData = 0;
0328   int nelectrNisoData = 0;
0329   int nelectrIsoEmul = 0;
0330   int nelectrNisoEmul = 0;
0331 
0332   int electronDataRank[2][PhiEtaMax] = {{0}};
0333   int electronDataEta[2][PhiEtaMax] = {{0}};
0334   int electronDataPhi[2][PhiEtaMax] = {{0}};
0335   int electronEmulRank[2][PhiEtaMax] = {{0}};
0336   int electronEmulEta[2][PhiEtaMax] = {{0}};
0337   int electronEmulPhi[2][PhiEtaMax] = {{0}};
0338 
0339   // region/bit arrays
0340   int nRegionData = 0;
0341   int nRegionEmul = 0;
0342 
0343   int regionDataRank[PhiEtaMax] = {0};
0344   int regionDataEta[PhiEtaMax] = {0};
0345   int regionDataPhi[PhiEtaMax] = {0};
0346 
0347   bool regionDataOverFlow[PhiEtaMax] = {false};
0348   bool regionDataTauVeto[PhiEtaMax] = {false};
0349   bool regionDataMip[PhiEtaMax] = {false};
0350   bool regionDataQuiet[PhiEtaMax] = {false};
0351   bool regionDataHfPlusTau[PhiEtaMax] = {false};
0352 
0353   int regionEmulRank[PhiEtaMax] = {0};
0354   int regionEmulEta[PhiEtaMax] = {0};
0355   int regionEmulPhi[PhiEtaMax] = {0};
0356 
0357   bool regionEmulOverFlow[PhiEtaMax] = {false};
0358   bool regionEmulTauVeto[PhiEtaMax] = {false};
0359   bool regionEmulMip[PhiEtaMax] = {false};
0360   bool regionEmulQuiet[PhiEtaMax] = {false};
0361   bool regionEmulHfPlusTau[PhiEtaMax] = {false};
0362 
0363   // StepII: fill variables
0364 
0365   for (L1CaloEmCollection::const_iterator iem = emEmul->begin(); iem != emEmul->end(); iem++) {
0366     if (iem->rank() >= 1) {
0367       if (iem->isolated()) {
0368         rctIsoEmEmulOcc_->Fill(iem->regionId().ieta(), iem->regionId().iphi());
0369 
0370         // to  show bad channles in the 2D efficiency plots
0371         rctIsoEmIneffOcc_->Fill(iem->regionId().ieta(), iem->regionId().iphi(), 0.01);
0372         rctIsoEmEff1Occ_->Fill(iem->regionId().ieta(), iem->regionId().iphi(), 0.01);
0373 
0374         int channel;
0375 
0376         channel = PHIBINS * iem->regionId().ieta() + iem->regionId().iphi();
0377         rctIsoEmEmulOcc1D_->Fill(channel);
0378         electronEmulRank[0][nelectrIsoEmul] = iem->rank();
0379         electronEmulEta[0][nelectrIsoEmul] = iem->regionId().ieta();
0380         electronEmulPhi[0][nelectrIsoEmul] = iem->regionId().iphi();
0381         nelectrIsoEmul++;
0382       }
0383 
0384       else {
0385         rctNisoEmEmulOcc_->Fill(iem->regionId().ieta(), iem->regionId().iphi());
0386 
0387         // to  show bad channles in the 2D efficiency plots
0388         rctNisoEmIneffOcc_->Fill(iem->regionId().ieta(), iem->regionId().iphi(), 0.01);
0389         rctNisoEmEff1Occ_->Fill(iem->regionId().ieta(), iem->regionId().iphi(), 0.01);
0390 
0391         int channel;
0392         //
0393 
0394         channel = PHIBINS * iem->regionId().ieta() + iem->regionId().iphi();
0395         rctNisoEmEmulOcc1D_->Fill(channel);
0396         electronEmulRank[1][nelectrNisoEmul] = iem->rank();
0397         electronEmulEta[1][nelectrNisoEmul] = iem->regionId().ieta();
0398         electronEmulPhi[1][nelectrNisoEmul] = iem->regionId().iphi();
0399         nelectrNisoEmul++;
0400       }
0401     }
0402   }
0403 
0404   for (L1CaloEmCollection::const_iterator iem = emData->begin(); iem != emData->end(); iem++) {
0405     if (selectBX_ != -1 && selectBX_ != iem->bx())
0406       continue;
0407 
0408     if (iem->rank() >= 1) {
0409       if (iem->isolated()) {
0410         rctIsoEmDataOcc_->Fill(iem->regionId().ieta(), iem->regionId().iphi());
0411 
0412         // new stuff to avoid 0's in emulator 2D //
0413         // rctIsoEmEmulOcc_->Fill(iem->regionId().ieta(), iem->regionId().iphi(),0.01);
0414         rctIsoEmOvereffOcc_->Fill(iem->regionId().ieta(), iem->regionId().iphi(), 0.01);
0415 
0416         int channel;
0417 
0418         channel = PHIBINS * iem->regionId().ieta() + iem->regionId().iphi();
0419         rctIsoEmDataOcc1D_->Fill(channel);
0420 
0421         // new stuff to avoid 0's
0422         // rctIsoEmEmulOcc1D_->Fill(channel);
0423 
0424         electronDataRank[0][nelectrIsoData] = iem->rank();
0425         electronDataEta[0][nelectrIsoData] = iem->regionId().ieta();
0426         electronDataPhi[0][nelectrIsoData] = iem->regionId().iphi();
0427         nelectrIsoData++;
0428       }
0429 
0430       else {
0431         rctNisoEmDataOcc_->Fill(iem->regionId().ieta(), iem->regionId().iphi());
0432 
0433         // new stuff to avoid 0's in emulator 2D //
0434         // rctNisoEmEmulOcc_->Fill(iem->regionId().ieta(), iem->regionId().iphi(),0.01);
0435         rctNisoEmOvereffOcc_->Fill(iem->regionId().ieta(), iem->regionId().iphi(), 0.01);
0436 
0437         int channel;
0438 
0439         channel = PHIBINS * iem->regionId().ieta() + iem->regionId().iphi();
0440         rctNisoEmDataOcc1D_->Fill(channel);
0441 
0442         // new stuff to avoid 0's
0443         // rctNisoEmEmulOcc1D_->Fill(channel);
0444 
0445         electronDataRank[1][nelectrNisoData] = iem->rank();
0446         electronDataEta[1][nelectrNisoData] = iem->regionId().ieta();
0447         electronDataPhi[1][nelectrNisoData] = iem->regionId().iphi();
0448         nelectrNisoData++;
0449       }
0450     }
0451   }
0452 
0453   // fill region/bit arrays for emulator
0454   for (L1CaloRegionCollection::const_iterator ireg = rgnEmul->begin(); ireg != rgnEmul->end(); ireg++) {
0455     //     std::cout << "Emul: " << nRegionEmul << " " << ireg->gctEta() << " " << ireg->gctPhi() << std::endl;
0456     if (ireg->overFlow())
0457       rctBitEmulOverFlow2D_->Fill(ireg->gctEta(), ireg->gctPhi());
0458     if (ireg->tauVeto())
0459       rctBitEmulTauVeto2D_->Fill(ireg->gctEta(), ireg->gctPhi());
0460     if (ireg->mip())
0461       rctBitEmulMip2D_->Fill(ireg->gctEta(), ireg->gctPhi());
0462     if (ireg->quiet())
0463       rctBitEmulQuiet2D_->Fill(ireg->gctEta(), ireg->gctPhi());
0464     if (ireg->fineGrain())
0465       rctBitEmulHfPlusTau2D_->Fill(ireg->gctEta(), ireg->gctPhi());
0466     if (ireg->et() > 0) {
0467       rctRegEmulOcc1D_->Fill(PHIBINS * ireg->gctEta() + ireg->gctPhi());
0468       rctRegEmulOcc2D_->Fill(ireg->gctEta(), ireg->gctPhi());
0469     }
0470 
0471     // to show bad channels in 2D efficiency plots:
0472     if (ireg->overFlow()) {
0473       rctBitUnmatchedEmulOverFlow2D_->Fill(ireg->gctEta(), ireg->gctPhi(), 0.01);
0474       rctBitMatchedOverFlow2D_->Fill(ireg->gctEta(), ireg->gctPhi(), 0.01);
0475     }
0476 
0477     if (ireg->tauVeto()) {
0478       rctBitUnmatchedEmulTauVeto2D_->Fill(ireg->gctEta(), ireg->gctPhi(), 0.01);
0479       rctBitMatchedTauVeto2D_->Fill(ireg->gctEta(), ireg->gctPhi(), 0.01);
0480     }
0481 
0482     if (ireg->mip()) {
0483       rctBitUnmatchedEmulMip2D_->Fill(ireg->gctEta(), ireg->gctPhi(), 0.01);
0484       rctBitMatchedMip2D_->Fill(ireg->gctEta(), ireg->gctPhi(), 0.01);
0485     }
0486 
0487     if (ireg->quiet()) {
0488       rctBitUnmatchedEmulQuiet2D_->Fill(ireg->gctEta(), ireg->gctPhi(), 0.01);
0489       rctBitMatchedQuiet2D_->Fill(ireg->gctEta(), ireg->gctPhi(), 0.01);
0490     }
0491 
0492     if (ireg->fineGrain()) {
0493       rctBitUnmatchedEmulHfPlusTau2D_->Fill(ireg->gctEta(), ireg->gctPhi(), 0.01);
0494       rctBitMatchedHfPlusTau2D_->Fill(ireg->gctEta(), ireg->gctPhi(), 0.01);
0495     }
0496 
0497     if (ireg->et() > 0) {
0498       rctRegUnmatchedEmulOcc2D_->Fill(ireg->gctEta(), ireg->gctPhi(), 0.01);
0499       rctRegMatchedOcc2D_->Fill(ireg->gctEta(), ireg->gctPhi(), 0.01);
0500       /*      rctRegDeltaEtOcc2D_->Fill       (ireg->gctEta(), ireg->gctPhi(), 0.01); */
0501     }
0502 
0503     nRegionEmul = PHIBINS * ireg->gctEta() + ireg->gctPhi();
0504 
0505     regionEmulRank[nRegionEmul] = ireg->et();
0506     regionEmulEta[nRegionEmul] = ireg->gctEta();
0507     regionEmulPhi[nRegionEmul] = ireg->gctPhi();
0508     regionEmulOverFlow[nRegionEmul] = ireg->overFlow();
0509     regionEmulTauVeto[nRegionEmul] = ireg->tauVeto();
0510     regionEmulMip[nRegionEmul] = ireg->mip();
0511     regionEmulQuiet[nRegionEmul] = ireg->quiet();
0512     regionEmulHfPlusTau[nRegionEmul] = ireg->fineGrain();
0513   }
0514   // fill region/bit arrays for hardware
0515   for (L1CaloRegionCollection::const_iterator ireg = rgnData->begin(); ireg != rgnData->end(); ireg++) {
0516     if (selectBX_ != -1 && selectBX_ != ireg->bx())
0517       continue;
0518 
0519     //     std::cout << "Data: " << nRegionData << " " << ireg->gctEta() << " " << ireg->gctPhi() << std::endl;
0520     if (ireg->overFlow())
0521       rctBitDataOverFlow2D_->Fill(ireg->gctEta(), ireg->gctPhi());
0522     if (ireg->tauVeto())
0523       rctBitDataTauVeto2D_->Fill(ireg->gctEta(), ireg->gctPhi());
0524     if (ireg->mip())
0525       rctBitDataMip2D_->Fill(ireg->gctEta(), ireg->gctPhi());
0526     if (ireg->quiet())
0527       rctBitDataQuiet2D_->Fill(ireg->gctEta(), ireg->gctPhi());
0528     if (ireg->fineGrain())
0529       rctBitDataHfPlusTau2D_->Fill(ireg->gctEta(), ireg->gctPhi());
0530     if (ireg->et() > 0) {
0531       rctRegDataOcc1D_->Fill(PHIBINS * ireg->gctEta() + ireg->gctPhi());
0532       rctRegDataOcc2D_->Fill(ireg->gctEta(), ireg->gctPhi());
0533     }
0534     // to show bad channels in 2D inefficiency:
0535     // if(ireg->overFlow())  rctBitEmulOverFlow2D_ ->Fill(ireg->gctEta(), ireg->gctPhi(), 0.01);
0536     // if(ireg->tauVeto())   rctBitEmulTauVeto2D_  ->Fill(ireg->gctEta(), ireg->gctPhi(), 0.01);
0537     // if(ireg->mip())       rctBitEmulMip2D_      ->Fill(ireg->gctEta(), ireg->gctPhi(), 0.01);
0538     // if(ireg->quiet())     rctBitEmulQuiet2D_    ->Fill(ireg->gctEta(), ireg->gctPhi(), 0.01);
0539     // if(ireg->fineGrain()) rctBitEmulHfPlusTau2D_->Fill(ireg->gctEta(), ireg->gctPhi(), 0.01);
0540     // if(ireg->et() > 0)    rctRegEmulOcc2D_      ->Fill(ireg->gctEta(), ireg->gctPhi(), 0.01);
0541     if (ireg->overFlow())
0542       rctBitUnmatchedDataOverFlow2D_->Fill(ireg->gctEta(), ireg->gctPhi(), 0.01);
0543     if (ireg->tauVeto())
0544       rctBitUnmatchedDataTauVeto2D_->Fill(ireg->gctEta(), ireg->gctPhi(), 0.01);
0545     if (ireg->mip())
0546       rctBitUnmatchedDataMip2D_->Fill(ireg->gctEta(), ireg->gctPhi(), 0.01);
0547     if (ireg->quiet())
0548       rctBitUnmatchedDataQuiet2D_->Fill(ireg->gctEta(), ireg->gctPhi(), 0.01);
0549     if (ireg->fineGrain())
0550       rctBitUnmatchedDataHfPlusTau2D_->Fill(ireg->gctEta(), ireg->gctPhi(), 0.01);
0551     if (ireg->et() > 0)
0552       rctRegUnmatchedDataOcc2D_->Fill(ireg->gctEta(), ireg->gctPhi(), 0.01);
0553 
0554     nRegionData = PHIBINS * ireg->gctEta() + ireg->gctPhi();
0555 
0556     regionDataRank[nRegionData] = ireg->et();
0557     regionDataEta[nRegionData] = ireg->gctEta();
0558     regionDataPhi[nRegionData] = ireg->gctPhi();
0559     regionDataOverFlow[nRegionData] = ireg->overFlow();
0560     regionDataTauVeto[nRegionData] = ireg->tauVeto();
0561     regionDataMip[nRegionData] = ireg->mip();
0562     regionDataQuiet[nRegionData] = ireg->quiet();
0563     regionDataHfPlusTau[nRegionData] = ireg->fineGrain();
0564   }
0565 
0566   if (verbose_) {
0567     std::cout << "I found Data! Iso: " << nelectrIsoData << " Niso: " << nelectrNisoData << std::endl;
0568     for (int i = 0; i < nelectrIsoData; i++)
0569       std::cout << " Iso Energy " << electronDataRank[0][i] << " eta " << electronDataEta[0][i] << " phi "
0570                 << electronDataPhi[0][i] << std::endl;
0571     for (int i = 0; i < nelectrNisoData; i++)
0572       std::cout << " Niso Energy " << electronDataRank[1][i] << " eta " << electronDataEta[1][i] << " phi "
0573                 << electronDataPhi[1][i] << std::endl;
0574 
0575     std::cout << "I found Emul! Iso: " << nelectrIsoEmul << " Niso: " << nelectrNisoEmul << std::endl;
0576     for (int i = 0; i < nelectrIsoEmul; i++)
0577       std::cout << " Iso Energy " << electronEmulRank[0][i] << " eta " << electronEmulEta[0][i] << " phi "
0578                 << electronEmulPhi[0][i] << std::endl;
0579     for (int i = 0; i < nelectrNisoEmul; i++)
0580       std::cout << " Niso Energy " << electronEmulRank[1][i] << " eta " << electronEmulEta[1][i] << " phi "
0581                 << electronEmulPhi[1][i] << std::endl;
0582 
0583     std::cout << "I found Data! Regions: " << PhiEtaMax << std::endl;
0584     for (int i = 0; i < (int)PhiEtaMax; i++)
0585       if (regionDataRank[i] != 0)
0586         std::cout << " Energy " << regionDataRank[i] << " eta " << regionDataEta[i] << " phi " << regionDataPhi[i]
0587                   << std::endl;
0588 
0589     std::cout << "I found Emul! Regions: " << PhiEtaMax << std::endl;
0590     for (int i = 0; i < (int)PhiEtaMax; i++)
0591       if (regionEmulRank[i] != 0)
0592         std::cout << " Energy " << regionEmulRank[i] << " eta " << regionEmulEta[i] << " phi " << regionEmulPhi[i]
0593                   << std::endl;
0594   }
0595 
0596   // StepIII: calculate and fill
0597 
0598   for (int k = 0; k < 2; k++) {
0599     int nelectrE, nelectrD;
0600 
0601     if (k == 0) {
0602       nelectrE = nelectrIsoEmul;
0603       nelectrD = nelectrIsoData;
0604     }
0605 
0606     else {
0607       nelectrE = nelectrNisoEmul;
0608       nelectrD = nelectrNisoData;
0609     }
0610 
0611     for (int i = 0; i < nelectrE; i++) {
0612       //bool triggered = l1SingleEG2; //false; //HACK until true trigger implimented
0613       double trigThresh = doubleThreshold_;  //ditto
0614       if (singlechannelhistos_) {
0615         int chnl = PHIBINS * electronEmulEta[k][i] + electronEmulPhi[k][i];
0616         if (k == 1 && independent_triggered) {  //non-iso
0617           //std::cout << "eta " << electronEmulEta[k][i] << " phi " << electronEmulPhi[k][i] << " with rank " <<  electronEmulRank[k][i] << std::endl;
0618           trigEffOcc_[chnl]->Fill(electronEmulRank[k][i]);
0619           //        }
0620           if (triggered)
0621             trigEffTriggOcc_[chnl]->Fill(electronEmulRank[k][i]);
0622         }
0623       }
0624       //find number of objects with rank above 2x trigger threshold
0625       //and number after requiring a trigger too
0626       if (electronEmulRank[k][i] >= trigThresh) {
0627         if (k == 1 && independent_triggered) {  //non-iso
0628           trigEffThreshOcc_->Fill(electronEmulEta[k][i], electronEmulPhi[k][i]);
0629           trigEffTriggThreshOcc_->Fill(electronEmulEta[k][i], electronEmulPhi[k][i], 0.01);
0630           //        }
0631           if (triggered)
0632             trigEffTriggThreshOcc_->Fill(electronEmulEta[k][i], electronEmulPhi[k][i], 0.98001);
0633         }
0634       }
0635 
0636       Bool_t found = kFALSE;
0637 
0638       for (int j = 0; j < nelectrD; j++) {
0639         if (electronEmulEta[k][i] == electronDataEta[k][j] && electronEmulPhi[k][i] == electronDataPhi[k][j]) {
0640           if (k == 0) {
0641             rctIsoEmEff1Occ_->Fill(electronEmulEta[k][i], electronEmulPhi[k][i], 0.98001);
0642             // Weight is for ROOT; when added to initial weight of 0.01, should just exceed 0.99
0643 
0644             int chnl;
0645 
0646             chnl = PHIBINS * electronEmulEta[k][i] + electronEmulPhi[k][i];
0647             rctIsoEmEff1Occ1D_->Fill(chnl);
0648             if (singlechannelhistos_) {
0649               int energy_difference;
0650 
0651               energy_difference = (electronEmulRank[k][i] - electronDataRank[k][j]);
0652               rctIsoEffChannel_[chnl]->Fill(energy_difference);
0653             }
0654 
0655             if (electronEmulRank[k][i] == electronDataRank[k][j]) {
0656               rctIsoEmEff2Occ1D_->Fill(chnl);
0657               rctIsoEmEff2Occ_->Fill(electronEmulEta[k][i], electronEmulPhi[k][i], 0.98012);
0658               // Weight is for ROOT; should just exceed 0.99
0659               // NOTE: Weight is different for eff 2 because this isn't filled initially
0660               // for current definition of Eff2 and Ineff2 we need to add additional
0661               // factor 0.99 since we divide over eff1 which is 0.99001 e.g. we use 0.99001**2 !
0662               rctIsoEmIneff2Occ_->Fill(electronEmulEta[k][i], electronEmulPhi[k][i], 0.0099);
0663             } else {
0664               rctIsoEmIneff2Occ1D_->Fill(chnl);
0665               rctIsoEmIneff2Occ_->Fill(electronEmulEta[k][i], electronEmulPhi[k][i], 0.9801);
0666               //Check for the bit that is different and store it
0667               bitset<8> bitDifference(electronEmulRank[k][i] ^ electronDataRank[k][j]);
0668               for (size_t n = 0; n < bitDifference.size(); n++) {
0669                 if (n < 4) {
0670                   rctIsoEmBitDiff_->Fill(electronEmulEta[k][i], electronEmulPhi[k][i] + n * 0.25, bitDifference[n]);
0671                 }
0672                 if (n >= 4) {
0673                   rctIsoEmBitDiff_->Fill(
0674                       electronEmulEta[k][i] + 0.5, electronEmulPhi[k][i] + (n - 4) * 0.25, bitDifference[n]);
0675                 }
0676               }
0677             }
0678           }
0679 
0680           else {
0681             rctNisoEmEff1Occ_->Fill(electronEmulEta[k][i], electronEmulPhi[k][i], 0.98001);
0682             // Weight is for ROOT; when added to initial weight of 0.01, should just exceed 0.99
0683 
0684             int chnl;
0685 
0686             chnl = PHIBINS * electronEmulEta[k][i] + electronEmulPhi[k][i];
0687             rctNisoEmEff1Occ1D_->Fill(chnl);
0688             if (singlechannelhistos_) {
0689               int energy_difference;
0690 
0691               energy_difference = (electronEmulRank[k][i] - electronDataRank[k][j]);
0692               rctNisoEffChannel_[chnl]->Fill(energy_difference);
0693             }
0694 
0695             if (electronEmulRank[k][i] == electronDataRank[k][j]) {
0696               rctNisoEmEff2Occ1D_->Fill(chnl);
0697               rctNisoEmEff2Occ_->Fill(electronEmulEta[k][i], electronEmulPhi[k][i], 0.98012);
0698               // Weight is for ROOT; should just exceed 0.99
0699               // NOTE: Weight is different for eff 2 because this isn't filled initially
0700               // see comments fo Iso
0701               rctNisoEmIneff2Occ_->Fill(electronEmulEta[k][i], electronEmulPhi[k][i], 0.0099);
0702             } else {
0703               rctNisoEmIneff2Occ1D_->Fill(chnl);
0704               rctNisoEmIneff2Occ_->Fill(electronEmulEta[k][i], electronEmulPhi[k][i], 0.9801);
0705               //Check for the bit that is different and store it
0706               bitset<8> bitDifference(electronEmulRank[k][i] ^ electronDataRank[k][j]);
0707               for (size_t n = 0; n < bitDifference.size(); n++) {
0708                 if (n < 4) {
0709                   rctNIsoEmBitDiff_->Fill(electronEmulEta[k][i], electronEmulPhi[k][i] + n * 0.25, bitDifference[n]);
0710                 }
0711                 if (n >= 4) {
0712                   rctNIsoEmBitDiff_->Fill(
0713                       electronEmulEta[k][i] + 0.5, electronEmulPhi[k][i] + (n - 4) * 0.25, bitDifference[n]);
0714                 }
0715               }
0716             }
0717           }
0718 
0719           found = kTRUE;
0720         }
0721       }
0722 
0723       if (found == kFALSE) {
0724         if (k == 0) {
0725           rctIsoEmIneffOcc_->Fill(electronEmulEta[k][i], electronEmulPhi[k][i], 0.98);
0726           // Weight is for ROOT; when added to initial weight of 0.01, should equal 0.99
0727 
0728           int chnl;
0729 
0730           //Store the bit map for the emulator
0731           bitset<8> bit(electronEmulRank[k][i]);
0732           for (size_t n = 0; n < bit.size(); n++) {
0733             if (n < 4) {
0734               rctIsoEmBitOff_->Fill(electronEmulEta[k][i], electronEmulPhi[k][i] + n * 0.25, bit[n]);
0735             }
0736             if (n >= 4) {
0737               rctIsoEmBitOff_->Fill(electronEmulEta[k][i] + 0.5, electronEmulPhi[k][i] + (n - 4) * 0.25, bit[n]);
0738             }
0739           }
0740 
0741           chnl = PHIBINS * electronEmulEta[k][i] + electronEmulPhi[k][i];
0742           rctIsoEmIneffOcc1D_->Fill(chnl);
0743           if (singlechannelhistos_) {
0744             rctIsoIneffChannel_[chnl]->Fill(electronEmulRank[k][i]);
0745           }
0746         }
0747 
0748         else {
0749           rctNisoEmIneffOcc_->Fill(electronEmulEta[k][i], electronEmulPhi[k][i], 0.98);
0750           // Weight is for ROOT; when added to initial weight of 0.01, should equal 0.99
0751 
0752           int chnl;
0753 
0754           chnl = PHIBINS * electronEmulEta[k][i] + electronEmulPhi[k][i];
0755           rctNisoEmIneffOcc1D_->Fill(chnl);
0756 
0757           //Store the bit map for the emulator
0758           bitset<8> bit(electronEmulRank[k][i]);
0759           for (size_t n = 0; n < bit.size(); n++) {
0760             if (n < 4) {
0761               rctNIsoEmBitOff_->Fill(electronEmulEta[k][i], electronEmulPhi[k][i] + n * 0.25, bit[n]);
0762             }
0763             if (n >= 4) {
0764               rctNIsoEmBitOff_->Fill(electronEmulEta[k][i] + 0.5, electronEmulPhi[k][i] + (n - 4) * 0.25, bit[n]);
0765             }
0766           }
0767 
0768           if (singlechannelhistos_) {
0769             rctNisoIneffChannel_[chnl]->Fill(electronEmulRank[k][i]);
0770           }
0771         }
0772       }
0773     }
0774 
0775     DivideME1D(rctIsoEmEff1Occ1D_, rctIsoEmEmulOcc1D_, rctIsoEmEff1oneD_);
0776     DivideME2D(rctIsoEmEff1Occ_, rctIsoEmEmulOcc_, rctIsoEmEff1_);
0777     //    DivideME1D(rctIsoEmEff2Occ1D_, rctIsoEmEmulOcc1D_, rctIsoEmEff2oneD_);
0778     //    DivideME2D(rctIsoEmEff2Occ_, rctIsoEmEmulOcc_, rctIsoEmEff2_) ;
0779     DivideME1D(rctIsoEmEff2Occ1D_, rctIsoEmEff1Occ1D_, rctIsoEmEff2oneD_);
0780     DivideME2D(rctIsoEmEff2Occ_, rctIsoEmEff1Occ_, rctIsoEmEff2_);
0781     //    DivideME1D(rctIsoEmIneff2Occ1D_, rctIsoEmEmulOcc1D_, rctIsoEmIneff2oneD_);
0782     //    DivideME2D(rctIsoEmIneff2Occ_, rctIsoEmEmulOcc_, rctIsoEmIneff2_) ;
0783     DivideME1D(rctIsoEmIneff2Occ1D_, rctIsoEmEff1Occ1D_, rctIsoEmIneff2oneD_);
0784     DivideME2D(rctIsoEmIneff2Occ_, rctIsoEmEff1Occ_, rctIsoEmIneff2_);
0785 
0786     DivideME1D(rctNisoEmEff1Occ1D_, rctNisoEmEmulOcc1D_, rctNisoEmEff1oneD_);
0787     DivideME2D(rctNisoEmEff1Occ_, rctNisoEmEmulOcc_, rctNisoEmEff1_);
0788     //    DivideME1D(rctNisoEmEff2Occ1D_, rctNisoEmEmulOcc1D_, rctNisoEmEff2oneD_);
0789     //    DivideME2D(rctNisoEmEff2Occ_, rctNisoEmEmulOcc_, rctNisoEmEff2_);
0790     DivideME1D(rctNisoEmEff2Occ1D_, rctNisoEmEff1Occ1D_, rctNisoEmEff2oneD_);
0791     DivideME2D(rctNisoEmEff2Occ_, rctNisoEmEff1Occ_, rctNisoEmEff2_);
0792     //    DivideME1D(rctNisoEmIneff2Occ1D_, rctNisoEmEmulOcc1D_, rctNisoEmIneff2oneD_);
0793     //    DivideME2D(rctNisoEmIneff2Occ_, rctNisoEmEmulOcc_, rctNisoEmIneff2_);
0794     DivideME1D(rctNisoEmIneff2Occ1D_, rctNisoEmEff1Occ1D_, rctNisoEmIneff2oneD_);
0795     DivideME2D(rctNisoEmIneff2Occ_, rctNisoEmEff1Occ_, rctNisoEmIneff2_);
0796 
0797     DivideME1D(rctIsoEmIneffOcc1D_, rctIsoEmEmulOcc1D_, rctIsoEmIneff1D_);
0798     DivideME2D(rctIsoEmIneffOcc_, rctIsoEmEmulOcc_, rctIsoEmIneff_);
0799     DivideME1D(rctNisoEmIneffOcc1D_, rctNisoEmEmulOcc1D_, rctNisoEmIneff1D_);
0800     DivideME2D(rctNisoEmIneffOcc_, rctNisoEmEmulOcc_, rctNisoEmIneff_);
0801 
0802     DivideME2D(trigEffTriggThreshOcc_, trigEffThreshOcc_, trigEffThresh_);
0803     if (singlechannelhistos_) {
0804       for (int i = 0; i < nelectrE; i++) {
0805         int chnl = PHIBINS * electronEmulEta[k][i] + electronEmulPhi[k][i];
0806         DivideME1D(trigEffTriggOcc_[chnl], trigEffOcc_[chnl], trigEff_[chnl]);
0807       }
0808     }
0809 
0810     for (int i = 0; i < nelectrD; i++) {
0811       Bool_t found = kFALSE;
0812 
0813       for (int j = 0; j < nelectrE; j++) {
0814         if (electronEmulEta[k][j] == electronDataEta[k][i] && electronEmulPhi[k][j] == electronDataPhi[k][i]) {
0815           found = kTRUE;
0816         }
0817       }
0818 
0819       if (found == kFALSE) {
0820         if (k == 0) {
0821           rctIsoEmOvereffOcc_->Fill(electronDataEta[k][i], electronDataPhi[k][i], 0.98);
0822           // Weight is for ROOT; when added to initial weight of 0.01, should equal 0.99
0823 
0824           int chnl;
0825 
0826           //Store the bit map for the emulator
0827           bitset<8> bit(electronDataRank[k][i]);
0828           for (size_t n = 0; n < bit.size(); n++) {
0829             if (n < 4) {
0830               rctIsoEmBitOn_->Fill(electronDataEta[k][i], electronDataPhi[k][i] + n * 0.25, bit[n]);
0831             }
0832             if (n >= 4) {
0833               rctIsoEmBitOn_->Fill(electronDataEta[k][i] + 0.5, electronDataPhi[k][i] + (n - 4) * 0.25, bit[n]);
0834             }
0835           }
0836 
0837           chnl = PHIBINS * electronDataEta[k][i] + electronDataPhi[k][i];
0838           rctIsoEmOvereffOcc1D_->Fill(chnl);
0839 
0840           if (singlechannelhistos_) {
0841             rctIsoOvereffChannel_[chnl]->Fill(electronDataRank[k][i]);
0842           }
0843         }
0844 
0845         else {
0846           rctNisoEmOvereffOcc_->Fill(electronDataEta[k][i], electronDataPhi[k][i], 0.98);
0847           // Weight is for ROOT; when added to initial weight of 0.01, should equal 0.99
0848 
0849           int chnl;
0850 
0851           //Store the bit map for the emulator
0852           bitset<8> bit(electronDataRank[k][i]);
0853           for (size_t n = 0; n < bit.size(); n++) {
0854             if (n < 4) {
0855               rctNIsoEmBitOn_->Fill(electronDataEta[k][i], electronDataPhi[k][i] + n * 0.25, bit[n]);
0856             }
0857             if (n >= 4) {
0858               rctNIsoEmBitOn_->Fill(electronDataEta[k][i] + 0.5, electronDataPhi[k][i] + (n - 4) * 0.25, bit[n]);
0859             }
0860           }
0861 
0862           chnl = PHIBINS * electronDataEta[k][i] + electronDataPhi[k][i];
0863           rctNisoEmOvereffOcc1D_->Fill(chnl);
0864 
0865           if (singlechannelhistos_) {
0866             rctNisoOvereffChannel_[chnl]->Fill(electronDataRank[k][i]);
0867           }
0868         }
0869       }
0870     }
0871   }
0872 
0873   // we try new definition of overefficiency:
0874   DivideME1D(rctIsoEmOvereffOcc1D_, rctIsoEmDataOcc1D_, rctIsoEmOvereff1D_);
0875   DivideME2D(rctIsoEmOvereffOcc_, rctIsoEmDataOcc_, rctIsoEmOvereff_);
0876   DivideME1D(rctNisoEmOvereffOcc1D_, rctNisoEmDataOcc1D_, rctNisoEmOvereff1D_);
0877   DivideME2D(rctNisoEmOvereffOcc_, rctNisoEmDataOcc_, rctNisoEmOvereff_);
0878 
0879   // calculate region/bit information
0880   for (unsigned int i = 0; i < (int)PhiEtaMax; i++) {
0881     Bool_t regFound = kFALSE;
0882     Bool_t overFlowFound = kFALSE;
0883     Bool_t tauVetoFound = kFALSE;
0884     Bool_t mipFound = kFALSE;
0885     Bool_t quietFound = kFALSE;
0886     Bool_t hfPlusTauFound = kFALSE;
0887 
0888     //       for(int j = 0; j < nRegionData; j++)
0889     //    {
0890     //         if(regionEmulEta[i] == regionDataEta[j] &&
0891     //            regionEmulPhi[i] == regionDataPhi[j])
0892     //         {
0893     if (regionDataRank[i] >= 1 && regionEmulRank[i] >= 1) {
0894       int chnl;
0895 
0896       chnl = PHIBINS * regionEmulEta[i] + regionEmulPhi[i];
0897       rctRegMatchedOcc1D_->Fill(chnl);
0898       rctRegMatchedOcc2D_->Fill(regionEmulEta[i], regionEmulPhi[i], 0.98001);
0899       // Weight is for ROOT; when added to initial weight of 0.01, should just exceed 0.99
0900 
0901       if (singlechannelhistos_)
0902         rctRegEffChannel_[chnl]->Fill(regionEmulRank[i] - regionDataRank[i]);
0903 
0904       // see comments for Iso Eff2
0905 
0906       if (regionEmulRank[i] == regionDataRank[i]) {
0907         rctRegSpEffOcc1D_->Fill(chnl);
0908         //             rctRegSpEffOcc2D_->Fill(regionEmulEta[i], regionEmulPhi[i], 0.99001);
0909         rctRegSpEffOcc2D_->Fill(regionEmulEta[i], regionEmulPhi[i], 0.98012);
0910         rctRegSpIneffOcc2D_->Fill(regionEmulEta[i], regionEmulPhi[i], 0.0099);
0911       } else {
0912         rctRegSpIneffOcc1D_->Fill(chnl);
0913         rctRegSpIneffOcc2D_->Fill(regionEmulEta[i], regionEmulPhi[i], 0.9801);
0914 
0915         bitset<10> bitDifference(regionEmulRank[i] ^ regionDataRank[i]);
0916         for (size_t n = 0; n < bitDifference.size(); n++) {
0917           if (n < 5) {
0918             rctRegBitDiff_->Fill(regionEmulEta[i], regionEmulPhi[i] + n * 0.2, bitDifference[n]);
0919           }
0920           if (n >= 5) {
0921             rctRegBitDiff_->Fill(regionEmulEta[i] + 0.5, regionEmulPhi[i] + (n - 5) * 0.2, bitDifference[n]);
0922           }
0923         }
0924       }
0925       // Weight is for ROOT; should just exceed 0.99
0926       // NOTE: Weight is different for eff 2 because this isn't filled initially
0927 
0928       regFound = kTRUE;
0929     }
0930 
0931     if (regionEmulOverFlow[i] == true && regionDataOverFlow[i] == true) {
0932       rctBitMatchedOverFlow2D_->Fill(regionEmulEta[i], regionEmulPhi[i], 0.98001);
0933       overFlowFound = kTRUE;
0934     }
0935 
0936     if (regionEmulTauVeto[i] == true && regionDataTauVeto[i] == true) {
0937       rctBitMatchedTauVeto2D_->Fill(regionEmulEta[i], regionEmulPhi[i], 0.98001);
0938       tauVetoFound = kTRUE;
0939     }
0940 
0941     if (regionEmulMip[i] == true && regionDataMip[i] == true) {
0942       rctBitMatchedMip2D_->Fill(regionEmulEta[i], regionEmulPhi[i], 0.98001);
0943       mipFound = kTRUE;
0944     }
0945 
0946     if (regionEmulQuiet[i] == true && regionDataQuiet[i] == true) {
0947       rctBitMatchedQuiet2D_->Fill(regionEmulEta[i], regionEmulPhi[i], 0.98001);
0948       quietFound = kTRUE;
0949     }
0950 
0951     if (regionEmulHfPlusTau[i] == true && regionDataHfPlusTau[i] == true) {
0952       rctBitMatchedHfPlusTau2D_->Fill(regionEmulEta[i], regionEmulPhi[i], 0.98001);
0953       hfPlusTauFound = kTRUE;
0954     }
0955 
0956     //         }
0957     //       }
0958 
0959     if (regFound == kFALSE && regionEmulRank[i] >= 1) {
0960       int chnl;
0961 
0962       bitset<10> bit(regionEmulRank[i]);
0963       for (size_t n = 0; n < bit.size(); n++) {
0964         if (n < 5) {
0965           rctRegBitOff_->Fill(regionEmulEta[i], regionEmulPhi[i] + n * 0.2, bit[n]);
0966         }
0967         if (n >= 5) {
0968           rctRegBitOff_->Fill(regionEmulEta[i] + 0.5, regionEmulPhi[i] + (n - 5) * 0.2, bit[n]);
0969         }
0970       }
0971 
0972       chnl = PHIBINS * regionEmulEta[i] + regionEmulPhi[i];
0973       rctRegUnmatchedEmulOcc1D_->Fill(chnl);
0974       rctRegUnmatchedEmulOcc2D_->Fill(regionEmulEta[i], regionEmulPhi[i], 0.98);
0975       // Weight is for ROOT; when added to initial weight of 0.01, should equal 0.99
0976 
0977       if (singlechannelhistos_)
0978         rctRegIneffChannel_[chnl]->Fill(regionEmulRank[i]);
0979     }
0980 
0981     if (overFlowFound == kFALSE && regionEmulOverFlow[i] == true) {
0982       rctBitUnmatchedEmulOverFlow2D_->Fill(regionEmulEta[i], regionEmulPhi[i], 0.98);
0983     }
0984 
0985     if (tauVetoFound == kFALSE && regionEmulTauVeto[i] == true) {
0986       rctBitUnmatchedEmulTauVeto2D_->Fill(regionEmulEta[i], regionEmulPhi[i], 0.98);
0987     }
0988 
0989     if (mipFound == kFALSE && regionEmulMip[i] == true) {
0990       rctBitUnmatchedEmulMip2D_->Fill(regionEmulEta[i], regionEmulPhi[i], 0.98);
0991     }
0992 
0993     if (quietFound == kFALSE && regionEmulQuiet[i] == true) {
0994       rctBitUnmatchedEmulQuiet2D_->Fill(regionEmulEta[i], regionEmulPhi[i], 0.98);
0995     }
0996 
0997     if (hfPlusTauFound == kFALSE && regionEmulHfPlusTau[i] == true) {
0998       rctBitUnmatchedEmulHfPlusTau2D_->Fill(regionEmulEta[i], regionEmulPhi[i], 0.98);
0999     }
1000   }
1001 
1002   DivideME1D(rctRegMatchedOcc1D_, rctRegEmulOcc1D_, rctRegEff1D_);
1003   DivideME2D(rctRegMatchedOcc2D_, rctRegEmulOcc2D_, rctRegEff2D_);
1004   //      DivideME1D(rctRegSpEffOcc1D_, rctRegEmulOcc1D_, rctRegSpEff1D_);
1005   //      DivideME2D(rctRegSpEffOcc2D_, rctRegEmulOcc2D_, rctRegSpEff2D_);
1006   DivideME1D(rctRegSpEffOcc1D_, rctRegMatchedOcc1D_, rctRegSpEff1D_);
1007   DivideME2D(rctRegSpEffOcc2D_, rctRegMatchedOcc2D_, rctRegSpEff2D_);
1008   //      DivideME1D(rctRegSpIneffOcc1D_, rctRegEmulOcc1D_, rctRegSpIneff1D_);
1009   //      DivideME2D(rctRegSpIneffOcc2D_, rctRegEmulOcc2D_, rctRegSpIneff2D_);
1010   DivideME1D(rctRegSpIneffOcc1D_, rctRegMatchedOcc1D_, rctRegSpIneff1D_);
1011   DivideME2D(rctRegSpIneffOcc2D_, rctRegMatchedOcc2D_, rctRegSpIneff2D_);
1012   DivideME2D(rctBitMatchedOverFlow2D_, rctBitEmulOverFlow2D_, rctBitOverFlowEff2D_);
1013   DivideME2D(rctBitMatchedTauVeto2D_, rctBitEmulTauVeto2D_, rctBitTauVetoEff2D_);
1014   DivideME2D(rctBitMatchedMip2D_, rctBitEmulMip2D_, rctBitMipEff2D_);
1015   // QUIETBIT: To add quiet bit information, uncomment following line:
1016   // DivideME2D (rctBitMatchedQuiet2D_, rctBitEmulQuiet2D_, rctBitQuietEff2D_);
1017   DivideME2D(rctBitMatchedHfPlusTau2D_, rctBitEmulHfPlusTau2D_, rctBitHfPlusTauEff2D_);
1018 
1019   DivideME1D(rctRegUnmatchedEmulOcc1D_, rctRegEmulOcc1D_, rctRegIneff1D_);
1020   DivideME2D(rctRegUnmatchedEmulOcc2D_, rctRegEmulOcc2D_, rctRegIneff2D_);
1021   DivideME2D(rctBitUnmatchedEmulOverFlow2D_, rctBitEmulOverFlow2D_, rctBitOverFlowIneff2D_);
1022   DivideME2D(rctBitUnmatchedEmulTauVeto2D_, rctBitEmulTauVeto2D_, rctBitTauVetoIneff2D_);
1023   DivideME2D(rctBitUnmatchedEmulMip2D_, rctBitEmulMip2D_, rctBitMipIneff2D_);
1024   // QUIETBIT: To add quiet bit information, uncomment the following line:
1025   // DivideME2D (rctBitUnmatchedEmulQuiet2D_, rctBitEmulQuiet2D_, rctBitQuietIneff2D_);
1026   DivideME2D(rctBitUnmatchedEmulHfPlusTau2D_, rctBitEmulHfPlusTau2D_, rctBitHfPlusTauIneff2D_);
1027 
1028   // for(int i = 0; i < nRegionData; i++)
1029   for (int i = 0; i < (int)PhiEtaMax; i++) {
1030     Bool_t regFound = kFALSE;
1031     Bool_t overFlowFound = kFALSE;
1032     Bool_t tauVetoFound = kFALSE;
1033     Bool_t mipFound = kFALSE;
1034     Bool_t quietFound = kFALSE;
1035     Bool_t hfPlusTauFound = kFALSE;
1036 
1037     //       for(int j = 0; j < nRegionEmul; j++)
1038     //      {
1039     //         if(regionEmulEta[j] == regionDataEta[i] &&
1040     //            regionEmulPhi[j] == regionDataPhi[i])
1041     //         {
1042 
1043     if (regionEmulRank[i] >= 1 && regionDataRank[i] >= 1)
1044       regFound = kTRUE;
1045 
1046     if (regionDataOverFlow[i] == true && regionEmulOverFlow[i] == true)
1047       overFlowFound = kTRUE;
1048 
1049     if (regionDataTauVeto[i] == true && regionEmulTauVeto[i] == true)
1050       tauVetoFound = kTRUE;
1051 
1052     if (regionDataMip[i] == true && regionEmulMip[i] == true)
1053       mipFound = kTRUE;
1054 
1055     if (regionDataQuiet[i] == true && regionEmulQuiet[i] == true)
1056       quietFound = kTRUE;
1057 
1058     if (regionDataHfPlusTau[i] == true && regionEmulHfPlusTau[i] == true)
1059       hfPlusTauFound = kTRUE;
1060     //         }
1061     //       }
1062 
1063     if (regFound == kFALSE && regionDataRank[i] >= 1) {
1064       int chnl;
1065 
1066       bitset<10> bit(regionDataRank[i]);
1067       for (size_t n = 0; n < bit.size(); n++) {
1068         if (n < 5) {
1069           rctRegBitOn_->Fill(regionDataEta[i], regionDataPhi[i] + n * 0.2, bit[n]);
1070         }
1071         if (n >= 5) {
1072           rctRegBitOn_->Fill(regionDataEta[i] + 0.5, regionDataPhi[i] + (n - 5) * 0.2, bit[n]);
1073         }
1074       }
1075 
1076       chnl = PHIBINS * regionDataEta[i] + regionDataPhi[i];
1077       rctRegUnmatchedDataOcc1D_->Fill(chnl);
1078       rctRegUnmatchedDataOcc2D_->Fill(regionDataEta[i], regionDataPhi[i], 0.98);
1079       // Weight is for ROOT; when added to initial weight of 0.01, should equal 0.99
1080 
1081       // we try a new definition of overefficiency:
1082       // DivideME1D(rctRegUnmatchedDataOcc1D_, rctRegDataOcc1D_, rctRegOvereff1D_);
1083       // DivideME2D(rctRegUnmatchedDataOcc2D_, rctRegDataOcc2D_, rctRegOvereff2D_);
1084 
1085       if (singlechannelhistos_)
1086         rctRegOvereffChannel_[chnl]->Fill(regionDataRank[i]);
1087     }
1088 
1089     if (overFlowFound == kFALSE && regionDataOverFlow[i] == true) {
1090       rctBitUnmatchedDataOverFlow2D_->Fill(regionDataEta[i], regionDataPhi[i], 0.98);
1091     }
1092 
1093     if (tauVetoFound == kFALSE && regionDataTauVeto[i] == true) {
1094       rctBitUnmatchedDataTauVeto2D_->Fill(regionDataEta[i], regionDataPhi[i], 0.98);
1095     }
1096 
1097     if (mipFound == kFALSE && regionDataMip[i] == true) {
1098       rctBitUnmatchedDataMip2D_->Fill(regionDataEta[i], regionDataPhi[i], 0.98);
1099     }
1100 
1101     if (quietFound == kFALSE && regionDataQuiet[i] == true) {
1102       rctBitUnmatchedDataQuiet2D_->Fill(regionDataEta[i], regionDataPhi[i], 0.98);
1103     }
1104 
1105     if (hfPlusTauFound == kFALSE && regionDataHfPlusTau[i] == true) {
1106       rctBitUnmatchedDataHfPlusTau2D_->Fill(regionDataEta[i], regionDataPhi[i], 0.98);
1107     }
1108   }
1109 
1110   // we try a new definition of overefficiency:
1111   DivideME1D(rctRegUnmatchedDataOcc1D_, rctRegDataOcc1D_, rctRegOvereff1D_);
1112   DivideME2D(rctRegUnmatchedDataOcc2D_, rctRegDataOcc2D_, rctRegOvereff2D_);
1113   DivideME2D(rctBitUnmatchedDataOverFlow2D_, rctBitDataOverFlow2D_, rctBitOverFlowOvereff2D_);
1114   DivideME2D(rctBitUnmatchedDataTauVeto2D_, rctBitDataTauVeto2D_, rctBitTauVetoOvereff2D_);
1115   DivideME2D(rctBitUnmatchedDataMip2D_, rctBitDataMip2D_, rctBitMipOvereff2D_);
1116   // QUIETBIT: To add quiet bit information, uncomment following 2 lines:
1117   // DivideME2D (rctBitUnmatchedDataQuiet2D_, rctBitDataQuiet2D_,
1118   // rctBitQuietOvereff2D_);
1119   DivideME2D(rctBitUnmatchedDataHfPlusTau2D_, rctBitDataHfPlusTau2D_, rctBitHfPlusTauOvereff2D_);
1120 }
1121 
1122 void L1TdeRCT::DivideME2D(MonitorElement* numerator, MonitorElement* denominator, MonitorElement* result) {
1123   TH2F* num = numerator->getTH2F();
1124   TH2F* den = denominator->getTH2F();
1125   TH2F* res = result->getTH2F();
1126 
1127   res->Divide(num, den, 1, 1, "");
1128 }
1129 
1130 void L1TdeRCT::DivideME1D(MonitorElement* numerator, MonitorElement* denominator, MonitorElement* result) {
1131   TH1F* num = numerator->getTH1F();
1132   TH1F* den = denominator->getTH1F();
1133   TH1F* res = result->getTH1F();
1134 
1135   res->Divide(num, den, 1, 1, "");
1136 }
1137 
1138 void L1TdeRCT::bookHistograms(DQMStore::IBooker& ibooker, const edm::Run& run, const edm::EventSetup& es) {
1139   // get hold of back-end interface
1140   nev_ = 0;
1141   //DQMStore *dbe = 0;
1142   //dbe = Service < DQMStore > ().operator->();
1143 
1144   //if (dbe) {
1145   //  dbe->setCurrentFolder(histFolder_);
1146   //  dbe->rmdir(histFolder_);
1147   //}
1148 
1149   //if (dbe) {
1150 
1151   ibooker.setCurrentFolder(histFolder_);
1152 
1153   triggerType_ = ibooker.book1D("TriggerType", "TriggerType", 17, -0.5, 16.5);
1154 
1155   triggerAlgoNumbers_ = ibooker.book1D("gtTriggerAlgoNumbers", "gtTriggerAlgoNumbers", 128, -0.5, 127.5);
1156 
1157   rctInputTPGEcalOcc_ = ibooker.book2D(
1158       "rctInputTPGEcalOcc", "rctInputTPGEcalOcc", TPGETABINS, TPGETAMIN, TPGETAMAX, TPGPHIBINS, TPGPHIMIN, TPGPHIMAX);
1159 
1160   rctInputTPGEcalOccNoCut_ = ibooker.book2D("rctInputTPGEcalOccNoCut",
1161                                             "rctInputTPGEcalOccNoCut",
1162                                             TPGETABINS,
1163                                             TPGETAMIN,
1164                                             TPGETAMAX,
1165                                             TPGPHIBINS,
1166                                             TPGPHIMIN,
1167                                             TPGPHIMAX);
1168 
1169   rctInputTPGEcalRank_ = ibooker.book1D("rctInputTPGEcalRank", "rctInputTPGEcalRank", TPGRANK, TPGRANKMIN, TPGRANKMAX);
1170 
1171   rctInputTPGHcalOcc_ = ibooker.book2D(
1172       "rctInputTPGHcalOcc", "rctInputTPGHcalOcc", TPGETABINS, TPGETAMIN, TPGETAMAX, TPGPHIBINS, TPGPHIMIN, TPGPHIMAX);
1173 
1174   rctInputTPGHcalSample_ = ibooker.book1D("rctInputTPGHcalSample", "rctInputTPGHcalSample", 10, -0.5, 9.5);
1175 
1176   rctInputTPGHcalRank_ = ibooker.book1D("rctInputTPGHcalRank", "rctInputTPGHcalRank", TPGRANK, TPGRANKMIN, TPGRANKMAX);
1177 
1178   ibooker.setCurrentFolder(histFolder_ + "/EffCurves/NisoEm/");
1179 
1180   trigEffThresh_ = ibooker.book2D("trigEffThresh",
1181                                   "Rank occupancy >= 2x trig thresh (source: " + dataInputTagName_ + ")",
1182                                   ETABINS,
1183                                   ETAMIN,
1184                                   ETAMAX,
1185                                   PHIBINS,
1186                                   PHIMIN,
1187                                   PHIMAX);
1188 
1189   ibooker.setCurrentFolder(histFolder_ + "/EffCurves/NisoEm/ServiceData");
1190 
1191   trigEffThreshOcc_ = ibooker.book2D("trigEffThreshOcc",
1192                                      "Rank occupancy >= 2x trig thresh (source: " + dataInputTagName_ + ")",
1193                                      ETABINS,
1194                                      ETAMIN,
1195                                      ETAMAX,
1196                                      PHIBINS,
1197                                      PHIMIN,
1198                                      PHIMAX);
1199   trigEffTriggThreshOcc_ =
1200       ibooker.book2D("trigEffTriggThreshOcc",
1201                      "Rank occupancy >= 2x trig thresh, triggered (source: " + dataInputTagName_ + ")",
1202                      ETABINS,
1203                      ETAMIN,
1204                      ETAMAX,
1205                      PHIBINS,
1206                      PHIMIN,
1207                      PHIMAX);
1208 
1209   ibooker.setCurrentFolder(histFolder_ + "/IsoEm");
1210 
1211   rctIsoEmEff1_ = ibooker.book2D("rctIsoEmEff1",
1212                                  "rctIsoEmEff1 (source: " + dataInputTagName_ + ")",
1213                                  ETABINS,
1214                                  ETAMIN,
1215                                  ETAMAX,
1216                                  PHIBINS,
1217                                  PHIMIN,
1218                                  PHIMAX);
1219 
1220   rctIsoEmEff1oneD_ = ibooker.book1D("rctIsoEmEff1oneD", "rctIsoEmEff1oneD", CHNLBINS, CHNLMIN, CHNLMAX);
1221 
1222   rctIsoEmEff2_ = ibooker.book2D("rctIsoEmEff2",
1223                                  "rctIsoEmEff2, energy matching required (source: " + dataInputTagName_ + ")",
1224                                  ETABINS,
1225                                  ETAMIN,
1226                                  ETAMAX,
1227                                  PHIBINS,
1228                                  PHIMIN,
1229                                  PHIMAX);
1230 
1231   rctIsoEmEff2oneD_ =
1232       ibooker.book1D("rctIsoEmEff2oneD", "rctIsoEmEff2oneD, energy matching required", CHNLBINS, CHNLMIN, CHNLMAX);
1233 
1234   rctIsoEmIneff2_ = ibooker.book2D("rctIsoEmIneff2",
1235                                    "rctIsoEmIneff2, energy matching required (source: " + dataInputTagName_ + ")",
1236                                    ETABINS,
1237                                    ETAMIN,
1238                                    ETAMAX,
1239                                    PHIBINS,
1240                                    PHIMIN,
1241                                    PHIMAX);
1242 
1243   rctIsoEmIneff2oneD_ =
1244       ibooker.book1D("rctIsoEmIneff2oneD", "rctIsoEmIneff2oneD, energy matching required", CHNLBINS, CHNLMIN, CHNLMAX);
1245 
1246   rctIsoEmIneff_ = ibooker.book2D("rctIsoEmIneff",
1247                                   "rctIsoEmIneff (source: " + dataInputTagName_ + ")",
1248                                   ETABINS,
1249                                   ETAMIN,
1250                                   ETAMAX,
1251                                   PHIBINS,
1252                                   PHIMIN,
1253                                   PHIMAX);
1254 
1255   rctIsoEmIneff1D_ = ibooker.book1D("rctIsoEmIneff1D", "rctIsoEmIneff1D", CHNLBINS, CHNLMIN, CHNLMAX);
1256 
1257   rctIsoEmOvereff_ = ibooker.book2D("rctIsoEmOvereff",
1258                                     "rctIsoEmOvereff (source: " + dataInputTagName_ + ")",
1259                                     ETABINS,
1260                                     ETAMIN,
1261                                     ETAMAX,
1262                                     PHIBINS,
1263                                     PHIMIN,
1264                                     PHIMAX);
1265 
1266   rctIsoEmOvereff1D_ = ibooker.book1D("rctIsoEmOvereff1D", "rctIsoEmOvereff1D", CHNLBINS, CHNLMIN, CHNLMAX);
1267 
1268   ibooker.setCurrentFolder(histFolder_ + "/IsoEm/ServiceData");
1269 
1270   rctIsoEmDataOcc_ = ibooker.book2D("rctIsoEmDataOcc",
1271                                     "rctIsoEmDataOcc (source: " + dataInputTagName_ + ")",
1272                                     ETABINS,
1273                                     ETAMIN,
1274                                     ETAMAX,
1275                                     PHIBINS,
1276                                     PHIMIN,
1277                                     PHIMAX);
1278 
1279   rctIsoEmDataOcc1D_ = ibooker.book1D("rctIsoEmDataOcc1D", "rctIsoEmDataOcc1D", CHNLBINS, CHNLMIN, CHNLMAX);
1280 
1281   rctIsoEmEmulOcc_ = ibooker.book2D("rctIsoEmEmulOcc",
1282                                     "rctIsoEmEmulOcc (source: " + dataInputTagName_ + ")",
1283                                     ETABINS,
1284                                     ETAMIN,
1285                                     ETAMAX,
1286                                     PHIBINS,
1287                                     PHIMIN,
1288                                     PHIMAX);
1289 
1290   rctIsoEmEmulOcc1D_ = ibooker.book1D("rctIsoEmEmulOcc1D", "rctIsoEmEmulOcc1D", CHNLBINS, CHNLMIN, CHNLMAX);
1291 
1292   rctIsoEmEff1Occ_ = ibooker.book2D("rctIsoEmEff1Occ",
1293                                     "rctIsoEmEff1Occ (source: " + dataInputTagName_ + ")",
1294                                     ETABINS,
1295                                     ETAMIN,
1296                                     ETAMAX,
1297                                     PHIBINS,
1298                                     PHIMIN,
1299                                     PHIMAX);
1300 
1301   rctIsoEmEff1Occ1D_ = ibooker.book1D("rctIsoEmEff1Occ1D", "rctIsoEmEff1Occ1D", CHNLBINS, CHNLMIN, CHNLMAX);
1302 
1303   rctIsoEmEff2Occ_ = ibooker.book2D("rctIsoEmEff2Occ",
1304                                     "rctIsoEmEff2Occ (source: " + dataInputTagName_ + ")",
1305                                     ETABINS,
1306                                     ETAMIN,
1307                                     ETAMAX,
1308                                     PHIBINS,
1309                                     PHIMIN,
1310                                     PHIMAX);
1311 
1312   rctIsoEmEff2Occ1D_ = ibooker.book1D("rctIsoEmEff2Occ1D", "rctIsoEmEff2Occ1D", CHNLBINS, CHNLMIN, CHNLMAX);
1313 
1314   rctIsoEmIneff2Occ_ = ibooker.book2D("rctIsoEmIneff2Occ",
1315                                       "rctIsoEmIneff2Occ (source: " + dataInputTagName_ + ")",
1316                                       ETABINS,
1317                                       ETAMIN,
1318                                       ETAMAX,
1319                                       PHIBINS,
1320                                       PHIMIN,
1321                                       PHIMAX);
1322 
1323   rctIsoEmIneff2Occ1D_ = ibooker.book1D("rctIsoEmIneff2Occ1D", "rctIsoEmIneff2Occ1D", CHNLBINS, CHNLMIN, CHNLMAX);
1324 
1325   rctIsoEmIneffOcc_ = ibooker.book2D("rctIsoEmIneffOcc",
1326                                      "rctIsoEmIneffOcc (source: " + dataInputTagName_ + ")",
1327                                      ETABINS,
1328                                      ETAMIN,
1329                                      ETAMAX,
1330                                      PHIBINS,
1331                                      PHIMIN,
1332                                      PHIMAX);
1333 
1334   rctIsoEmIneffOcc1D_ = ibooker.book1D("rctIsoEmIneffOcc1D", "rctIsoEmIneffOcc1D", CHNLBINS, CHNLMIN, CHNLMAX);
1335 
1336   rctIsoEmOvereffOcc_ = ibooker.book2D("rctIsoEmOvereffOcc",
1337                                        "rctIsoEmOvereffOcc (source: " + dataInputTagName_ + ")",
1338                                        ETABINS,
1339                                        ETAMIN,
1340                                        ETAMAX,
1341                                        PHIBINS,
1342                                        PHIMIN,
1343                                        PHIMAX);
1344 
1345   rctIsoEmOvereffOcc1D_ = ibooker.book1D("rctIsoEmOvereffOcc1D", "rctIsoEmOvereffOcc1D", CHNLBINS, CHNLMIN, CHNLMAX);
1346 
1347   ibooker.setCurrentFolder(histFolder_ + "/NisoEm");
1348   rctNisoEmEff1_ = ibooker.book2D("rctNisoEmEff1",
1349                                   "rctNisoEmEff1 (source: " + dataInputTagName_ + ")",
1350                                   ETABINS,
1351                                   ETAMIN,
1352                                   ETAMAX,
1353                                   PHIBINS,
1354                                   PHIMIN,
1355                                   PHIMAX);
1356 
1357   rctNisoEmEff1oneD_ = ibooker.book1D("rctNisoEmEff1oneD", "rctNisoEmEff1oneD", CHNLBINS, CHNLMIN, CHNLMAX);
1358 
1359   rctNisoEmEff2_ = ibooker.book2D("rctNisoEmEff2",
1360                                   "rctNisoEmEff2, energy matching required (source: " + dataInputTagName_ + ")",
1361                                   ETABINS,
1362                                   ETAMIN,
1363                                   ETAMAX,
1364                                   PHIBINS,
1365                                   PHIMIN,
1366                                   PHIMAX);
1367 
1368   rctNisoEmEff2oneD_ =
1369       ibooker.book1D("rctNisoEmEff2oneD", "rctNisoEmEff2oneD, energy matching required", CHNLBINS, CHNLMIN, CHNLMAX);
1370 
1371   rctNisoEmIneff2_ = ibooker.book2D("rctNisoEmIneff2",
1372                                     "rctNisoEmIneff2, energy matching required (source: " + dataInputTagName_ + ")",
1373                                     ETABINS,
1374                                     ETAMIN,
1375                                     ETAMAX,
1376                                     PHIBINS,
1377                                     PHIMIN,
1378                                     PHIMAX);
1379 
1380   rctNisoEmIneff2oneD_ = ibooker.book1D(
1381       "rctNisoEmIneff2oneD", "rctNisoEmIneff2oneD, energy matching required", CHNLBINS, CHNLMIN, CHNLMAX);
1382 
1383   rctNisoEmIneff_ = ibooker.book2D("rctNisoEmIneff",
1384                                    "rctNisoEmIneff (source: " + dataInputTagName_ + ")",
1385                                    ETABINS,
1386                                    ETAMIN,
1387                                    ETAMAX,
1388                                    PHIBINS,
1389                                    PHIMIN,
1390                                    PHIMAX);
1391 
1392   rctNisoEmIneff1D_ = ibooker.book1D("rctNisoEmIneff1D", "rctNisoEmIneff1D", CHNLBINS, CHNLMIN, CHNLMAX);
1393 
1394   rctNisoEmOvereff_ = ibooker.book2D("rctNisoEmOvereff",
1395                                      "rctNisoEmOvereff (source: " + dataInputTagName_ + ")",
1396                                      ETABINS,
1397                                      ETAMIN,
1398                                      ETAMAX,
1399                                      PHIBINS,
1400                                      PHIMIN,
1401                                      PHIMAX);
1402 
1403   rctNisoEmOvereff1D_ = ibooker.book1D("rctNisoEmOvereff1D", "rctNisoEmOvereff1D", CHNLBINS, CHNLMIN, CHNLMAX);
1404 
1405   ibooker.setCurrentFolder(histFolder_ + "/NisoEm/ServiceData");
1406 
1407   rctNisoEmDataOcc_ = ibooker.book2D("rctNisoEmDataOcc",
1408                                      "rctNisoEmDataOcc (source: " + dataInputTagName_ + ")",
1409                                      ETABINS,
1410                                      ETAMIN,
1411                                      ETAMAX,
1412                                      PHIBINS,
1413                                      PHIMIN,
1414                                      PHIMAX);
1415 
1416   rctNisoEmDataOcc1D_ = ibooker.book1D("rctNisoEmDataOcc1D", "rctNisoEmDataOcc1D", CHNLBINS, CHNLMIN, CHNLMAX);
1417 
1418   rctNisoEmEmulOcc_ = ibooker.book2D("rctNisoEmEmulOcc",
1419                                      "rctNisoEmEmulOcc (source: " + dataInputTagName_ + ")",
1420                                      ETABINS,
1421                                      ETAMIN,
1422                                      ETAMAX,
1423                                      PHIBINS,
1424                                      PHIMIN,
1425                                      PHIMAX);
1426 
1427   rctNisoEmEmulOcc1D_ = ibooker.book1D("rctNisoEmEmulOcc1D", "rctNisoEmEmulOcc1D", CHNLBINS, CHNLMIN, CHNLMAX);
1428 
1429   rctNisoEmEff1Occ_ = ibooker.book2D("rctNisoEmEff1Occ",
1430                                      "rctNisoEmEff1Occ (source: " + dataInputTagName_ + ")",
1431                                      ETABINS,
1432                                      ETAMIN,
1433                                      ETAMAX,
1434                                      PHIBINS,
1435                                      PHIMIN,
1436                                      PHIMAX);
1437 
1438   rctNisoEmEff1Occ1D_ = ibooker.book1D("rctNisoEmEff1Occ1D", "rctNisoEmEff1Occ1D", CHNLBINS, CHNLMIN, CHNLMAX);
1439 
1440   rctNisoEmEff2Occ_ = ibooker.book2D("rctNisoEmEff2Occ",
1441                                      "rctNisoEmEff2Occ (source: " + dataInputTagName_ + ")",
1442                                      ETABINS,
1443                                      ETAMIN,
1444                                      ETAMAX,
1445                                      PHIBINS,
1446                                      PHIMIN,
1447                                      PHIMAX);
1448 
1449   rctNisoEmEff2Occ1D_ = ibooker.book1D("rctNisoEmEff2Occ1D", "rctNisoEmEff2Occ1D", CHNLBINS, CHNLMIN, CHNLMAX);
1450 
1451   rctNisoEmIneff2Occ_ = ibooker.book2D("rctNisoEmIneff2Occ",
1452                                        "rctNisoEmIneff2Occ (source: " + dataInputTagName_ + ")",
1453                                        ETABINS,
1454                                        ETAMIN,
1455                                        ETAMAX,
1456                                        PHIBINS,
1457                                        PHIMIN,
1458                                        PHIMAX);
1459 
1460   rctNisoEmIneff2Occ1D_ = ibooker.book1D("rctNisoEmIneff2Occ1D", "rctNisoEmIneff2Occ1D", CHNLBINS, CHNLMIN, CHNLMAX);
1461 
1462   rctNisoEmIneffOcc_ = ibooker.book2D("rctNisoEmIneffOcc",
1463                                       "rctNisoEmIneffOcc (source: " + dataInputTagName_ + ")",
1464                                       ETABINS,
1465                                       ETAMIN,
1466                                       ETAMAX,
1467                                       PHIBINS,
1468                                       PHIMIN,
1469                                       PHIMAX);
1470 
1471   rctNisoEmIneffOcc1D_ = ibooker.book1D("rctNisoEmIneffOcc1D", "rctNisoEmIneffOcc1D", CHNLBINS, CHNLMIN, CHNLMAX);
1472 
1473   rctNisoEmOvereffOcc_ = ibooker.book2D("rctNisoEmOvereffOcc",
1474                                         "rctNisoEmOvereffOcc (source: " + dataInputTagName_ + ")",
1475                                         ETABINS,
1476                                         ETAMIN,
1477                                         ETAMAX,
1478                                         PHIBINS,
1479                                         PHIMIN,
1480                                         PHIMAX);
1481 
1482   rctNisoEmOvereffOcc1D_ = ibooker.book1D("rctNisoEmOvereffOcc1D", "rctNisoEmOvereffOcc1D", CHNLBINS, CHNLMIN, CHNLMAX);
1483 
1484   // region information
1485   ibooker.setCurrentFolder(histFolder_ + "/RegionData");
1486 
1487   rctRegEff1D_ = ibooker.book1D("rctRegEff1D", "1D region efficiency", CHNLBINS, CHNLMIN, CHNLMAX);
1488 
1489   rctRegIneff1D_ = ibooker.book1D("rctRegIneff1D", "1D region inefficiency", CHNLBINS, CHNLMIN, CHNLMAX);
1490 
1491   rctRegOvereff1D_ = ibooker.book1D("rctRegOvereff1D", "1D region overefficiency", CHNLBINS, CHNLMIN, CHNLMAX);
1492 
1493   rctRegSpEff1D_ =
1494       ibooker.book1D("rctRegSpEff1D", "1D region efficiency, energy matching required", CHNLBINS, CHNLMIN, CHNLMAX);
1495 
1496   rctRegSpIneff1D_ =
1497       ibooker.book1D("rctRegSpIneff1D", "1D region inefficiency, energy matching required", CHNLBINS, CHNLMIN, CHNLMAX);
1498 
1499   rctRegEff2D_ = ibooker.book2D("rctRegEff2D",
1500                                 "2D region efficiency (source: " + dataInputTagName_ + ")",
1501                                 ETABINS,
1502                                 ETAMIN,
1503                                 ETAMAX,
1504                                 PHIBINS,
1505                                 PHIMIN,
1506                                 PHIMAX);
1507 
1508   rctRegIneff2D_ = ibooker.book2D("rctRegIneff2D",
1509                                   "2D region inefficiency (source: " + dataInputTagName_ + ")",
1510                                   ETABINS,
1511                                   ETAMIN,
1512                                   ETAMAX,
1513                                   PHIBINS,
1514                                   PHIMIN,
1515                                   PHIMAX);
1516 
1517   rctRegOvereff2D_ = ibooker.book2D("rctRegOvereff2D",
1518                                     "2D region overefficiency (source: " + dataInputTagName_ + ")",
1519                                     ETABINS,
1520                                     ETAMIN,
1521                                     ETAMAX,
1522                                     PHIBINS,
1523                                     PHIMIN,
1524                                     PHIMAX);
1525 
1526   rctRegSpEff2D_ = ibooker.book2D("rctRegSpEff2D",
1527                                   "2D region efficiency, energy matching required (source: " + dataInputTagName_ + ")",
1528                                   ETABINS,
1529                                   ETAMIN,
1530                                   ETAMAX,
1531                                   PHIBINS,
1532                                   PHIMIN,
1533                                   PHIMAX);
1534 
1535   rctRegSpIneff2D_ =
1536       ibooker.book2D("rctRegSpIneff2D",
1537                      "2D region inefficiency, energy matching required (source: " + dataInputTagName_ + ")",
1538                      ETABINS,
1539                      ETAMIN,
1540                      ETAMAX,
1541                      PHIBINS,
1542                      PHIMIN,
1543                      PHIMAX);
1544 
1545   ibooker.setCurrentFolder(histFolder_ + "/RegionData/ServiceData");
1546 
1547   rctRegDataOcc1D_ = ibooker.book1D("rctRegDataOcc1D", "1D region occupancy from data", CHNLBINS, CHNLMIN, CHNLMAX);
1548 
1549   rctRegEmulOcc1D_ = ibooker.book1D("rctRegEmulOcc1D", "1D region occupancy from emulator", CHNLBINS, CHNLMIN, CHNLMAX);
1550 
1551   rctRegMatchedOcc1D_ =
1552       ibooker.book1D("rctRegMatchedOcc1D", "1D region occupancy for matched hits", CHNLBINS, CHNLMIN, CHNLMAX);
1553 
1554   rctRegUnmatchedDataOcc1D_ = ibooker.book1D(
1555       "rctRegUnmatchedDataOcc1D", "1D region occupancy for unmatched hardware hits", CHNLBINS, CHNLMIN, CHNLMAX);
1556 
1557   rctRegUnmatchedEmulOcc1D_ = ibooker.book1D(
1558       "rctRegUnmatchedEmulOcc1D", "1D region occupancy for unmatched emulator hits", CHNLBINS, CHNLMIN, CHNLMAX);
1559 
1560   rctRegSpEffOcc1D_ = ibooker.book1D(
1561       "rctRegSpEffOcc1D", "1D region occupancy for \\Delta E_{T} efficiency", CHNLBINS, CHNLMIN, CHNLMAX);
1562 
1563   rctRegSpIneffOcc1D_ = ibooker.book1D(
1564       "rctRegSpIneffOcc1D", "1D region occupancy for \\Delta E_{T} efficiency ", CHNLBINS, CHNLMIN, CHNLMAX);
1565 
1566   rctRegDataOcc2D_ = ibooker.book2D("rctRegDataOcc2D",
1567                                     "2D region occupancy from hardware (source: " + dataInputTagName_ + ")",
1568                                     ETABINS,
1569                                     ETAMIN,
1570                                     ETAMAX,
1571                                     PHIBINS,
1572                                     PHIMIN,
1573                                     PHIMAX);
1574 
1575   rctRegEmulOcc2D_ = ibooker.book2D(
1576       "rctRegEmulOcc2D", "2D region occupancy from emulator", ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
1577 
1578   rctRegMatchedOcc2D_ = ibooker.book2D(
1579       "rctRegMatchedOcc2D", "2D region occupancy for matched hits", ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
1580 
1581   rctRegUnmatchedDataOcc2D_ = ibooker.book2D("rctRegUnmatchedDataOcc2D",
1582                                              "2D region occupancy for unmatched hardware hits",
1583                                              ETABINS,
1584                                              ETAMIN,
1585                                              ETAMAX,
1586                                              PHIBINS,
1587                                              PHIMIN,
1588                                              PHIMAX);
1589 
1590   rctRegUnmatchedEmulOcc2D_ = ibooker.book2D("rctRegUnmatchedEmulOcc2D",
1591                                              "2D region occupancy for unmatched emulator hits",
1592                                              ETABINS,
1593                                              ETAMIN,
1594                                              ETAMAX,
1595                                              PHIBINS,
1596                                              PHIMIN,
1597                                              PHIMAX);
1598 
1599   //    rctRegDeltaEt2D_ =
1600   //      dbe->book2D("rctRegDeltaEt2D", " \\Delta E_{T}  for each channel",
1601   //      CHNLBINS, CHNLMIN, CHNLMAX, 100, -50., 50.);
1602 
1603   rctRegSpEffOcc2D_ = ibooker.book2D("rctRegSpEffOcc2D",
1604                                      "2D region occupancy for \\Delta E_{T} efficiency",
1605                                      ETABINS,
1606                                      ETAMIN,
1607                                      ETAMAX,
1608                                      PHIBINS,
1609                                      PHIMIN,
1610                                      PHIMAX);
1611 
1612   rctRegSpIneffOcc2D_ = ibooker.book2D("rctRegSpIneffOcc2D",
1613                                        "2D region occupancy for \\Delta E_{T} inefficiency",
1614                                        ETABINS,
1615                                        ETAMIN,
1616                                        ETAMAX,
1617                                        PHIBINS,
1618                                        PHIMIN,
1619                                        PHIMAX);
1620 
1621   // bit information
1622   ibooker.setCurrentFolder(histFolder_ + "/BitData");
1623 
1624   rctBitOverFlowEff2D_ = ibooker.book2D("rctBitOverFlowEff2D",
1625                                         "2D overflow bit efficiency (source: " + dataInputTagName_ + ")",
1626                                         ETABINS,
1627                                         ETAMIN,
1628                                         ETAMAX,
1629                                         PHIBINS,
1630                                         PHIMIN,
1631                                         PHIMAX);
1632 
1633   rctBitOverFlowIneff2D_ = ibooker.book2D("rctBitOverFlowIneff2D",
1634                                           "2D overflow bit inefficiency (source: " + dataInputTagName_ + ")",
1635                                           ETABINS,
1636                                           ETAMIN,
1637                                           ETAMAX,
1638                                           PHIBINS,
1639                                           PHIMIN,
1640                                           PHIMAX);
1641 
1642   rctBitOverFlowOvereff2D_ = ibooker.book2D("rctBitOverFlowOvereff2D",
1643                                             "2D overflow bit overefficiency (source: " + dataInputTagName_ + ")",
1644                                             ETABINS,
1645                                             ETAMIN,
1646                                             ETAMAX,
1647                                             PHIBINS,
1648                                             PHIMIN,
1649                                             PHIMAX);
1650 
1651   rctBitTauVetoEff2D_ = ibooker.book2D("rctBitTauVetoEff2D",
1652                                        "2D tau veto bit efficiency (source: " + dataInputTagName_ + ")",
1653                                        ETABINS,
1654                                        ETAMIN,
1655                                        ETAMAX,
1656                                        PHIBINS,
1657                                        PHIMIN,
1658                                        PHIMAX);
1659 
1660   rctBitTauVetoIneff2D_ = ibooker.book2D("rctBitTauVetoIneff2D",
1661                                          "2D tau veto bit inefficiency (source: " + dataInputTagName_ + ")",
1662                                          ETABINS,
1663                                          ETAMIN,
1664                                          ETAMAX,
1665                                          PHIBINS,
1666                                          PHIMIN,
1667                                          PHIMAX);
1668 
1669   rctBitTauVetoOvereff2D_ = ibooker.book2D("rctBitTauVetoOvereff2D",
1670                                            "2D tau veto bit overefficiency (source: " + dataInputTagName_ + ")",
1671                                            ETABINS,
1672                                            ETAMIN,
1673                                            ETAMAX,
1674                                            PHIBINS,
1675                                            PHIMIN,
1676                                            PHIMAX);
1677 
1678   rctBitMipEff2D_ =
1679       ibooker.book2D("rctBitMipEff2D", "2D mip bit efficiency", ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
1680 
1681   rctBitMipIneff2D_ =
1682       ibooker.book2D("rctBitMipIneff2D", "2D mip bit inefficiency", ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
1683 
1684   rctBitMipOvereff2D_ = ibooker.book2D(
1685       "rctBitMipOvereff2D", "2D mip bit overefficiency", ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
1686 
1687   // QUIETBIT: To add quiet bit information, uncomment following 11 lines:
1688   // rctBitQuietEff2D_ =
1689   // dbe->book2D("rctBitQuietEff2D", "2D quiet bit efficiency",
1690   // ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
1691 
1692   // rctBitQuietIneff2D_ =
1693   // dbe->book2D("rctBitQuietIneff2D", "2D quiet bit inefficiency",
1694   // ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
1695 
1696   // rctBitQuietOvereff2D_ =
1697   // dbe->book2D("rctBitQuietOvereff2D", "2D quiet bit overefficiency",
1698   // ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
1699 
1700   rctBitHfPlusTauEff2D_ = ibooker.book2D("rctBitHfPlusTauEff2D",
1701                                          "2D HfPlusTau bit efficiency (source: " + dataInputTagName_ + ")",
1702                                          ETABINS,
1703                                          ETAMIN,
1704                                          ETAMAX,
1705                                          PHIBINS,
1706                                          PHIMIN,
1707                                          PHIMAX);
1708 
1709   rctBitHfPlusTauIneff2D_ = ibooker.book2D("rctBitHfPlusTauIneff2D",
1710                                            "2D HfPlusTau bit inefficiency (source: " + dataInputTagName_ + ")",
1711                                            ETABINS,
1712                                            ETAMIN,
1713                                            ETAMAX,
1714                                            PHIBINS,
1715                                            PHIMIN,
1716                                            PHIMAX);
1717 
1718   rctBitHfPlusTauOvereff2D_ = ibooker.book2D("rctBitHfPlusTauOvereff2D",
1719                                              "2D HfPlusTau bit overefficiency (source: " + dataInputTagName_ + ")",
1720                                              ETABINS,
1721                                              ETAMIN,
1722                                              ETAMAX,
1723                                              PHIBINS,
1724                                              PHIMIN,
1725                                              PHIMAX);
1726 
1727   ibooker.setCurrentFolder(histFolder_ + "/BitData/ServiceData");
1728 
1729   rctBitEmulOverFlow2D_ = ibooker.book2D(
1730       "rctBitEmulOverFlow2D", "2D overflow bit from emulator", ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
1731 
1732   rctBitDataOverFlow2D_ = ibooker.book2D("rctBitDataOverFlow2D",
1733                                          "2D overflow bit from hardware (source: " + dataInputTagName_ + ")",
1734                                          ETABINS,
1735                                          ETAMIN,
1736                                          ETAMAX,
1737                                          PHIBINS,
1738                                          PHIMIN,
1739                                          PHIMAX);
1740 
1741   rctBitMatchedOverFlow2D_ = ibooker.book2D(
1742       "rctBitMatchedOverFlow2D", "2D overflow bit for matched hits", ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
1743 
1744   rctBitUnmatchedEmulOverFlow2D_ = ibooker.book2D("rctBitUnmatchedEmulOverFlow2D",
1745                                                   "2D overflow bit for unmatched emulator hits",
1746                                                   ETABINS,
1747                                                   ETAMIN,
1748                                                   ETAMAX,
1749                                                   PHIBINS,
1750                                                   PHIMIN,
1751                                                   PHIMAX);
1752 
1753   rctBitUnmatchedDataOverFlow2D_ = ibooker.book2D("rctBitUnmatchedDataOverFlow2D",
1754                                                   "2D overflow bit for unmatched hardware hits",
1755                                                   ETABINS,
1756                                                   ETAMIN,
1757                                                   ETAMAX,
1758                                                   PHIBINS,
1759                                                   PHIMIN,
1760                                                   PHIMAX);
1761 
1762   rctBitEmulTauVeto2D_ = ibooker.book2D(
1763       "rctBitEmulTauVeto2D", "2D tau veto bit from emulator", ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
1764 
1765   rctBitDataTauVeto2D_ = ibooker.book2D("rctBitDataTauVeto2D",
1766                                         "2D tau veto bit from hardware (source: " + dataInputTagName_ + ")",
1767                                         ETABINS,
1768                                         ETAMIN,
1769                                         ETAMAX,
1770                                         PHIBINS,
1771                                         PHIMIN,
1772                                         PHIMAX);
1773 
1774   rctBitMatchedTauVeto2D_ = ibooker.book2D(
1775       "rctBitMatchedTauVeto2D", "2D tau veto bit for matched hits", ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
1776 
1777   rctBitUnmatchedEmulTauVeto2D_ = ibooker.book2D("rctBitUnmatchedEmulTauVeto2D",
1778                                                  "2D tau veto bit for unmatched emulator hits",
1779                                                  ETABINS,
1780                                                  ETAMIN,
1781                                                  ETAMAX,
1782                                                  PHIBINS,
1783                                                  PHIMIN,
1784                                                  PHIMAX);
1785 
1786   rctBitUnmatchedDataTauVeto2D_ = ibooker.book2D("rctBitUnmatchedDataTauVeto2D",
1787                                                  "2D tau veto bit for unmatched hardware hits",
1788                                                  ETABINS,
1789                                                  ETAMIN,
1790                                                  ETAMAX,
1791                                                  PHIBINS,
1792                                                  PHIMIN,
1793                                                  PHIMAX);
1794 
1795   rctBitEmulMip2D_ =
1796       ibooker.book2D("rctBitEmulMip2D", "2D mip bit from emulator", ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
1797 
1798   rctBitDataMip2D_ =
1799       ibooker.book2D("rctBitDataMip2D", "2D mip bit from hardware", ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
1800 
1801   rctBitMatchedMip2D_ = ibooker.book2D(
1802       "rctBitMatchedMip2D", "2D mip bit for matched hits", ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
1803 
1804   rctBitUnmatchedEmulMip2D_ = ibooker.book2D("rctBitUnmatchedEmulMip2D",
1805                                              "2D mip bit for unmatched emulator hits",
1806                                              ETABINS,
1807                                              ETAMIN,
1808                                              ETAMAX,
1809                                              PHIBINS,
1810                                              PHIMIN,
1811                                              PHIMAX);
1812 
1813   rctBitUnmatchedDataMip2D_ = ibooker.book2D("rctBitUnmatchedDataMip2D",
1814                                              "2D mip bit for unmatched hardware hits",
1815                                              ETABINS,
1816                                              ETAMIN,
1817                                              ETAMAX,
1818                                              PHIBINS,
1819                                              PHIMIN,
1820                                              PHIMAX);
1821 
1822   rctBitEmulQuiet2D_ = ibooker.book2D(
1823       "rctBitEmulQuiet2D", "2D quiet bit from emulator", ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
1824 
1825   rctBitDataQuiet2D_ = ibooker.book2D(
1826       "rctBitDataQuiet2D", "2D quiet bit from hardware", ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
1827 
1828   rctBitMatchedQuiet2D_ = ibooker.book2D(
1829       "rctBitMatchedQuiet2D", "2D quiet bit for matched hits", ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
1830 
1831   rctBitUnmatchedEmulQuiet2D_ = ibooker.book2D("rctBitUnmatchedEmulQuiet2D",
1832                                                "2D quiet bit for unmatched emulator hits",
1833                                                ETABINS,
1834                                                ETAMIN,
1835                                                ETAMAX,
1836                                                PHIBINS,
1837                                                PHIMIN,
1838                                                PHIMAX);
1839 
1840   rctBitUnmatchedDataQuiet2D_ = ibooker.book2D("rctBitUnmatchedDataQuiet2D",
1841                                                "2D quiet bit for unmatched hardware hits",
1842                                                ETABINS,
1843                                                ETAMIN,
1844                                                ETAMAX,
1845                                                PHIBINS,
1846                                                PHIMIN,
1847                                                PHIMAX);
1848 
1849   rctBitEmulHfPlusTau2D_ = ibooker.book2D(
1850       "rctBitEmulHfPlusTau2D", "2D HfPlusTau bit from emulator", ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
1851 
1852   rctBitDataHfPlusTau2D_ = ibooker.book2D("rctBitDataHfPlusTau2D",
1853                                           "2D HfPlusTau bit from hardware (source: " + dataInputTagName_ + ")",
1854                                           ETABINS,
1855                                           ETAMIN,
1856                                           ETAMAX,
1857                                           PHIBINS,
1858                                           PHIMIN,
1859                                           PHIMAX);
1860 
1861   rctBitMatchedHfPlusTau2D_ = ibooker.book2D(
1862       "rctBitMatchedHfPlusTau2D", "2D HfPlusTau bit for matched hits", ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
1863 
1864   rctBitUnmatchedEmulHfPlusTau2D_ = ibooker.book2D("rctBitUnmatchedEmulHfPlusTau2D",
1865                                                    "2D HfPlusTau bit for unmatched emulator hits",
1866                                                    ETABINS,
1867                                                    ETAMIN,
1868                                                    ETAMAX,
1869                                                    PHIBINS,
1870                                                    PHIMIN,
1871                                                    PHIMAX);
1872 
1873   rctBitUnmatchedDataHfPlusTau2D_ = ibooker.book2D("rctBitUnmatchedDataHfPlusTau2D",
1874                                                    "2D HfPlusTau bit for unmatched hardware hits",
1875                                                    ETABINS,
1876                                                    ETAMIN,
1877                                                    ETAMAX,
1878                                                    PHIBINS,
1879                                                    PHIMIN,
1880                                                    PHIMAX);
1881 
1882   ibooker.setCurrentFolder(histFolder_ + "/BitMon");
1883   rctRegBitOn_ = ibooker.book2D("rctRegBitOn",
1884                                 "Monitoring for Bits Stuck On",
1885                                 BITETABINS,
1886                                 BITETAMIN,
1887                                 BITETAMAX,
1888                                 BITRPHIBINS,
1889                                 BITRPHIMIN,
1890                                 BITRPHIMAX);
1891 
1892   rctRegBitOff_ = ibooker.book2D("rctRegBitOff",
1893                                  "Monitoring for Bits Stuck Off",
1894                                  BITETABINS,
1895                                  BITETAMIN,
1896                                  BITETAMAX,
1897                                  BITRPHIBINS,
1898                                  BITRPHIMIN,
1899                                  BITRPHIMAX);
1900 
1901   rctRegBitDiff_ = ibooker.book2D("rctRegBitDiff",
1902                                   "Monitoring for Bits Difference",
1903                                   BITETABINS,
1904                                   BITETAMIN,
1905                                   BITETAMAX,
1906                                   BITRPHIBINS,
1907                                   BITRPHIMIN,
1908                                   BITRPHIMAX);
1909 
1910   rctIsoEmBitOn_ = ibooker.book2D("rctIsoEmBitOn",
1911                                   "Monitoring for Bits Stuck On",
1912                                   BITETABINS,
1913                                   BITETAMIN,
1914                                   BITETAMAX,
1915                                   BITPHIBINS,
1916                                   BITPHIMIN,
1917                                   BITPHIMAX);
1918 
1919   rctIsoEmBitOff_ = ibooker.book2D("rctIsoEmBitOff",
1920                                    "Monitoring for Bits Stuck Off",
1921                                    BITETABINS,
1922                                    BITETAMIN,
1923                                    BITETAMAX,
1924                                    BITPHIBINS,
1925                                    BITPHIMIN,
1926                                    BITPHIMAX);
1927 
1928   rctIsoEmBitDiff_ = ibooker.book2D("rctIsoEmBitDiff",
1929                                     "Monitoring for Bits Difference",
1930                                     BITETABINS,
1931                                     BITETAMIN,
1932                                     BITETAMAX,
1933                                     BITPHIBINS,
1934                                     BITPHIMIN,
1935                                     BITPHIMAX);
1936 
1937   rctNIsoEmBitOn_ = ibooker.book2D("rctNIsoEmBitOn",
1938                                    "Monitoring for Bits Stuck On",
1939                                    BITETABINS,
1940                                    BITETAMIN,
1941                                    BITETAMAX,
1942                                    BITPHIBINS,
1943                                    BITPHIMIN,
1944                                    BITPHIMAX);
1945 
1946   rctNIsoEmBitOff_ = ibooker.book2D("rctNIsoEmBitOff",
1947                                     "Monitoring for Bits Stuck Off",
1948                                     BITETABINS,
1949                                     BITETAMIN,
1950                                     BITETAMAX,
1951                                     BITPHIBINS,
1952                                     BITPHIMIN,
1953                                     BITPHIMAX);
1954 
1955   rctNIsoEmBitDiff_ = ibooker.book2D("rctNIsoEmBitDiff",
1956                                      "Monitoring for Bits Difference",
1957                                      BITETABINS,
1958                                      BITETAMIN,
1959                                      BITETAMAX,
1960                                      BITPHIBINS,
1961                                      BITPHIMIN,
1962                                      BITPHIMAX);
1963 
1964   ibooker.setCurrentFolder(histFolder_ + "/DBData");
1965   fedVectorMonitorRUN_ = ibooker.book2D("rctFedVectorMonitorRUN", "FED Vector Monitor Per Run", 108, 0, 108, 2, 0, 2);
1966   if (!perLSsaving_)
1967     fedVectorMonitorLS_ = ibooker.book2D("rctFedVectorMonitorLS", "FED Vector Monitor Per LS", 108, 0, 108, 2, 0, 2);
1968 
1969   std::map<unsigned int, unsigned int> repeats;
1970   for (unsigned int i = 0; i < 108; ++i) {
1971     repeats[crateFED[i]] = 0;
1972   }
1973   for (unsigned int i = 0; i < 108; ++i) {
1974     char fed[10];
1975     if (0 == repeats[crateFED[i]]++) {
1976       sprintf(fed, "%d", crateFED[i]);
1977     } else {
1978       sprintf(fed, "%d_%d", crateFED[i], repeats[crateFED[i]]);
1979     }
1980     fedVectorMonitorRUN_->setBinLabel(i + 1, fed);
1981     if (!perLSsaving_)
1982       fedVectorMonitorLS_->setBinLabel(i + 1, fed);
1983   }
1984   fedVectorMonitorRUN_->getTH2F()->GetYaxis()->SetBinLabel(1, "OUT");
1985   fedVectorMonitorRUN_->getTH2F()->GetYaxis()->SetBinLabel(2, "IN");
1986   if (!perLSsaving_) {
1987     fedVectorMonitorLS_->getTH2F()->GetYaxis()->SetBinLabel(1, "OUT");
1988     fedVectorMonitorLS_->getTH2F()->GetYaxis()->SetBinLabel(2, "IN");
1989   }
1990 
1991   // for single channels
1992 
1993   if (singlechannelhistos_) {
1994     for (int m = 0; m < 12; m++) {
1995       if (m == 0)
1996         ibooker.setCurrentFolder(histFolder_ + "/IsoEm/ServiceData/Eff1SnglChnls");
1997       if (m == 1)
1998         ibooker.setCurrentFolder(histFolder_ + "/NisoEm/ServiceData/Eff1SnglChnls");
1999       if (m == 2)
2000         ibooker.setCurrentFolder(histFolder_ + "/RegionData/ServiceData/EffSnglChnls");
2001       if (m == 3)
2002         ibooker.setCurrentFolder(histFolder_ + "/IsoEm/ServiceData/IneffSnglChnls");
2003       if (m == 4)
2004         ibooker.setCurrentFolder(histFolder_ + "/NisoEm/ServiceData/IneffSnglChnls");
2005       if (m == 5)
2006         ibooker.setCurrentFolder(histFolder_ + "/RegionData/ServiceData/IneffSnglChnls");
2007       if (m == 6)
2008         ibooker.setCurrentFolder(histFolder_ + "/IsoEm/ServiceData/OvereffSnglChnls");
2009       if (m == 7)
2010         ibooker.setCurrentFolder(histFolder_ + "/NisoEm/ServiceData/OvereffSnglChnls");
2011       if (m == 8)
2012         ibooker.setCurrentFolder(histFolder_ + "/RegionData/ServiceData/OvereffSnglChnls");
2013       if (m == 9)
2014         ibooker.setCurrentFolder(histFolder_ + "/EffCurves/NisoEm/ServiceData/SingleChannels");
2015       if (m == 10)
2016         ibooker.setCurrentFolder(histFolder_ + "/EffCurves/NisoEm/ServiceData/SingleChannels");
2017       if (m == 11)
2018         ibooker.setCurrentFolder(histFolder_ + "/EffCurves/NisoEm/ServiceData/SingleChannels");
2019 
2020       for (int i = 0; i < ETAMAX; i++) {
2021         for (int j = 0; j < PHIMAX; j++) {
2022           char name[80], channel[80] = {""};
2023 
2024           if (m == 0)
2025             strcpy(name, "(Eemul-Edata)Chnl");
2026           if (m == 1)
2027             strcpy(name, "(Eemul-Edata)Chnl");
2028           if (m == 2)
2029             strcpy(name, "(Eemul-Edata)Chnl");
2030           if (m == 3)
2031             strcpy(name, "EemulChnl");
2032           if (m == 4)
2033             strcpy(name, "EemulChnl");
2034           if (m == 5)
2035             strcpy(name, "EemulChnl");
2036           if (m == 6)
2037             strcpy(name, "EdataChnl");
2038           if (m == 7)
2039             strcpy(name, "EdataChnl");
2040           if (m == 8)
2041             strcpy(name, "EdataChnl");
2042           if (m == 9)
2043             strcpy(name, "EemulChnlEff");
2044           if (m == 10)
2045             strcpy(name, "EemulChnlTrig");
2046           if (m == 11)
2047             strcpy(name, "EemulChnl");
2048 
2049           if (i < 10 && j < 10)
2050             sprintf(channel, "_0%d0%d", i, j);
2051           else if (i < 10)
2052             sprintf(channel, "_0%d%d", i, j);
2053           else if (j < 10)
2054             sprintf(channel, "_%d0%d", i, j);
2055           else
2056             sprintf(channel, "_%d%d", i, j);
2057           strcat(name, channel);
2058 
2059           int chnl = PHIBINS * i + j;
2060 
2061           if (m == 0)
2062             rctIsoEffChannel_[chnl] = ibooker.book1D(name, name, DEBINS, DEMIN, DEMAX);
2063           if (m == 1)
2064             rctNisoEffChannel_[chnl] = ibooker.book1D(name, name, DEBINS, DEMIN, DEMAX);
2065           if (m == 2)
2066             rctRegEffChannel_[chnl] = ibooker.book1D(name, name, DEBINS, DEMIN, DEMAX);
2067           if (m == 3)
2068             rctIsoIneffChannel_[chnl] = ibooker.book1D(name, name, DEBINS, DEMIN, DEMAX);
2069           if (m == 4)
2070             rctNisoIneffChannel_[chnl] = ibooker.book1D(name, name, DEBINS, DEMIN, DEMAX);
2071           if (m == 5)
2072             rctRegIneffChannel_[chnl] = ibooker.book1D(name, name, DEBINS, DEMIN, DEMAX);
2073           if (m == 6)
2074             rctIsoOvereffChannel_[chnl] = ibooker.book1D(name, name, DEBINS, DEMIN, DEMAX);
2075           if (m == 7)
2076             rctNisoOvereffChannel_[chnl] = ibooker.book1D(name, name, DEBINS, DEMIN, DEMAX);
2077           if (m == 8)
2078             rctRegOvereffChannel_[chnl] = ibooker.book1D(name, name, DEBINS, DEMIN, DEMAX);
2079           if (m == 9)
2080             trigEff_[chnl] = ibooker.book1D(name, name, ELBINS, ELMIN, ELMAX);
2081           if (m == 10)
2082             trigEffOcc_[chnl] = ibooker.book1D(name, name, ELBINS, ELMIN, ELMAX);
2083           if (m == 11)
2084             trigEffTriggOcc_[chnl] = ibooker.book1D(name, name, ELBINS, ELMIN, ELMAX);
2085         }
2086       }
2087     }
2088   }
2089 
2090   //end of single channels
2091 
2092   notrigCount = 0;
2093   trigCount = 0;
2094 
2095   readFEDVector(fedVectorMonitorRUN_, es, false);
2096 }
2097 
2098 std::shared_ptr<l1tderct::Empty> L1TdeRCT::globalBeginLuminosityBlock(const edm::LuminosityBlock& ls,
2099                                                                       const edm::EventSetup& es) const {
2100   if (!perLSsaving_)
2101     readFEDVector(fedVectorMonitorLS_, es);
2102   return std::shared_ptr<l1tderct::Empty>();
2103 }
2104 
2105 void L1TdeRCT::readFEDVector(MonitorElement* histogram, const edm::EventSetup& es, const bool isLumitransition) const {
2106   // adding fed mask into channel mask
2107   //edm::ESHandle<RunInfo> sum;
2108   //es.get<RunInfoRcd>().get(sum);
2109   const auto& sum = isLumitransition ? es.getHandle(runInfolumiToken_) : es.getHandle(runInfoToken_);
2110   const RunInfo* summary = sum.product();
2111 
2112   std::vector<int> caloFeds;  // pare down the feds to the intresting ones
2113 
2114   const std::vector<int> Feds = summary->m_fed_in;
2115   for (std::vector<int>::const_iterator cf = Feds.begin(); cf != Feds.end(); ++cf) {
2116     int fedNum = *cf;
2117     if ((fedNum > 600 && fedNum < 724) || fedNum == 1118 || fedNum == 1120 || fedNum == 1122)
2118       caloFeds.push_back(fedNum);
2119   }
2120 
2121   for (unsigned int i = 0; i < 108; ++i) {
2122     std::vector<int>::iterator fv = std::find(caloFeds.begin(), caloFeds.end(), crateFED[i]);
2123     if (fv != caloFeds.end()) {
2124       histogram->setBinContent(i + 1, 2, 1);
2125       histogram->setBinContent(i + 1, 1, 0);
2126     } else {
2127       histogram->setBinContent(i + 1, 2, 0);
2128       histogram->setBinContent(i + 1, 1, 1);
2129     }
2130   }
2131 }