Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:10:41

0001 #include "DQM/L1TMonitor/interface/L1THIonImp.h"
0002 
0003 using namespace edm;
0004 
0005 const unsigned int JETETABINS = 22;
0006 const float JETETAMIN = -0.5;
0007 const float JETETAMAX = 21.5;
0008 
0009 const unsigned int EMETABINS = 22;
0010 const float EMETAMIN = -0.5;
0011 const float EMETAMAX = 21.5;
0012 
0013 const unsigned int METPHIBINS = 72;
0014 const float METPHIMIN = -0.5;
0015 const float METPHIMAX = 71.5;
0016 
0017 const unsigned int PHIBINS = 18;
0018 const float PHIMIN = -0.5;
0019 const float PHIMAX = 17.5;
0020 
0021 const unsigned int OFBINS = 2;
0022 const float OFMIN = -0.5;
0023 const float OFMAX = 1.5;
0024 
0025 const unsigned int BXBINS = 5;
0026 const float BXMIN = -2.5;
0027 const float BXMAX = 2.5;
0028 
0029 // Bins for 3, 5, 6, 7, 10 and 12 bits
0030 const unsigned int R3BINS = 8;
0031 const float R3MIN = -0.5;
0032 const float R3MAX = 7.5;
0033 const unsigned int R6BINS = 64;
0034 const float R6MIN = -0.5;
0035 const float R6MAX = 63.5;
0036 const unsigned int R12BINS = 4096;
0037 const float R12MIN = -0.5;
0038 const float R12MAX = 4095.5;
0039 
0040 L1THIonImp::L1THIonImp(const edm::ParameterSet& ps)
0041     :  // data
0042       gctCenJetsDataSource_(ps.getParameter<edm::InputTag>("gctCentralJetsDataSource")),
0043       gctForJetsDataSource_(ps.getParameter<edm::InputTag>("gctForwardJetsDataSource")),
0044       gctTauJetsDataSource_(ps.getParameter<edm::InputTag>("gctTauJetsDataSource")),
0045       gctEnergySumsDataSource_(ps.getParameter<edm::InputTag>("gctEnergySumsDataSource")),
0046       gctIsoEmDataSource_(ps.getParameter<edm::InputTag>("gctIsoEmDataSource")),
0047       gctNonIsoEmDataSource_(ps.getParameter<edm::InputTag>("gctNonIsoEmDataSource")),
0048       // RCT
0049       rctSource_L1CRCollection_(consumes<L1CaloRegionCollection>(ps.getParameter<InputTag>("rctSource"))),
0050       //  emul
0051       gctCenJetsEmulSource_(ps.getParameter<edm::InputTag>("gctCentralJetsEmulSource")),
0052       gctForJetsEmulSource_(ps.getParameter<edm::InputTag>("gctForwardJetsEmulSource")),
0053       gctTauJetsEmulSource_(ps.getParameter<edm::InputTag>("gctTauJetsEmulSource")),
0054       gctEnergySumsEmulSource_(ps.getParameter<edm::InputTag>("gctEnergySumsEmulSource")),
0055       gctIsoEmEmulSource_(ps.getParameter<edm::InputTag>("gctIsoEmEmulSource")),
0056       gctNonIsoEmEmulSource_(ps.getParameter<edm::InputTag>("gctNonIsoEmEmulSource")) {
0057   //set Token(-s)
0058   gctIsoEmSourceDataToken_ = consumes<L1GctEmCandCollection>(ps.getParameter<edm::InputTag>("gctIsoEmDataSource"));
0059   gctNonIsoEmSourceDataToken_ =
0060       consumes<L1GctEmCandCollection>(ps.getParameter<edm::InputTag>("gctNonIsoEmDataSource"));
0061   gctCenJetsSourceDataToken_ =
0062       consumes<L1GctJetCandCollection>(ps.getParameter<edm::InputTag>("gctCentralJetsDataSource"));
0063   gctForJetsSourceDataToken_ =
0064       consumes<L1GctJetCandCollection>(ps.getParameter<edm::InputTag>("gctForwardJetsDataSource"));
0065   gctTauJetsSourceDataToken_ = consumes<L1GctJetCandCollection>(ps.getParameter<edm::InputTag>("gctTauJetsDataSource"));
0066   gctEnergySumsSourceDataToken_ =
0067       consumes<L1GctHFRingEtSumsCollection>(ps.getParameter<edm::InputTag>("gctEnergySumsDataSource"));
0068   l1HFCountsDataToken_ =
0069       consumes<L1GctHFBitCountsCollection>(ps.getParameter<edm::InputTag>("gctEnergySumsDataSource"));
0070   l1EtMissDataToken_ = consumes<L1GctEtMissCollection>(ps.getParameter<edm::InputTag>("gctEnergySumsDataSource"));
0071   l1HtMissDataToken_ = consumes<L1GctHtMissCollection>(ps.getParameter<edm::InputTag>("gctEnergySumsDataSource"));
0072   l1EtHadDataToken_ = consumes<L1GctEtHadCollection>(ps.getParameter<edm::InputTag>("gctEnergySumsDataSource"));
0073   l1EtTotalDataToken_ = consumes<L1GctEtTotalCollection>(ps.getParameter<edm::InputTag>("gctEnergySumsDataSource"));
0074 
0075   gctIsoEmSourceEmulToken_ = consumes<L1GctEmCandCollection>(ps.getParameter<edm::InputTag>("gctIsoEmEmulSource"));
0076   gctNonIsoEmSourceEmulToken_ =
0077       consumes<L1GctEmCandCollection>(ps.getParameter<edm::InputTag>("gctNonIsoEmEmulSource"));
0078   gctCenJetsSourceEmulToken_ =
0079       consumes<L1GctJetCandCollection>(ps.getParameter<edm::InputTag>("gctCentralJetsEmulSource"));
0080   gctForJetsSourceEmulToken_ =
0081       consumes<L1GctJetCandCollection>(ps.getParameter<edm::InputTag>("gctForwardJetsEmulSource"));
0082   gctTauJetsSourceEmulToken_ = consumes<L1GctJetCandCollection>(ps.getParameter<edm::InputTag>("gctTauJetsEmulSource"));
0083   gctEnergySumsSourceEmulToken_ =
0084       consumes<L1GctHFRingEtSumsCollection>(ps.getParameter<edm::InputTag>("gctEnergySumsEmulSource"));
0085   l1HFCountsEmulToken_ =
0086       consumes<L1GctHFBitCountsCollection>(ps.getParameter<edm::InputTag>("gctEnergySumsEmulSource"));
0087   l1EtMissEmulToken_ = consumes<L1GctEtMissCollection>(ps.getParameter<edm::InputTag>("gctEnergySumsEmulSource"));
0088   l1HtMissEmulToken_ = consumes<L1GctHtMissCollection>(ps.getParameter<edm::InputTag>("gctEnergySumsEmulSource"));
0089   l1EtHadEmulToken_ = consumes<L1GctEtHadCollection>(ps.getParameter<edm::InputTag>("gctEnergySumsEmulSource"));
0090   l1EtTotalEmulToken_ = consumes<L1GctEtTotalCollection>(ps.getParameter<edm::InputTag>("gctEnergySumsEmulSource"));
0091 }
0092 
0093 L1THIonImp::~L1THIonImp() {}
0094 
0095 void L1THIonImp::bookHistograms(DQMStore::IBooker& ibooker, edm::Run const&, edm::EventSetup const&) {
0096   ibooker.setCurrentFolder("L1T/L1THIon");
0097 
0098   l1GctCenJetsEtEtaPhi_ =
0099       ibooker.book2D("CenJetsEtEtaPhi", "CENTRAL JET E_{T}", JETETABINS, JETETAMIN, JETETAMAX, PHIBINS, PHIMIN, PHIMAX);
0100   l1GctForJetsEtEtaPhi_ =
0101       ibooker.book2D("ForJetsEtEtaPhi", "FORWARD JET E_{T}", JETETABINS, JETETAMIN, JETETAMAX, PHIBINS, PHIMIN, PHIMAX);
0102   l1GctTauJetsEtEtaPhi_ = ibooker.book2D(
0103       "SingleTrackTriggerEtEtaPhi", "TAU JET E_{T}", EMETABINS, EMETAMIN, EMETAMAX, PHIBINS, PHIMIN, PHIMAX);
0104   l1GctIsoEmRankEtaPhi_ =
0105       ibooker.book2D("IsoEmRankEtaPhi", "ISO EM E_{T}", EMETABINS, EMETAMIN, EMETAMAX, PHIBINS, PHIMIN, PHIMAX);
0106   l1GctNonIsoEmRankEtaPhi_ =
0107       ibooker.book2D("NonIsoEmRankEtaPhi", "NON-ISO EM E_{T}", EMETABINS, EMETAMIN, EMETAMAX, PHIBINS, PHIMIN, PHIMAX);
0108 
0109   l1GctCenJetsOccEtaPhi_ = ibooker.book2D(
0110       "CenJetsOccEtaPhi", "CENTRAL JET OCCUPANCY", JETETABINS, JETETAMIN, JETETAMAX, PHIBINS, PHIMIN, PHIMAX);
0111   l1GctForJetsOccEtaPhi_ = ibooker.book2D(
0112       "ForJetsOccEtaPhi", "FORWARD JET OCCUPANCY", JETETABINS, JETETAMIN, JETETAMAX, PHIBINS, PHIMIN, PHIMAX);
0113   l1GctTauJetsOccEtaPhi_ = ibooker.book2D(
0114       "SingleTrackTriggerOccEtaPhi", "TAU JET OCCUPANCY", EMETABINS, EMETAMIN, EMETAMAX, PHIBINS, PHIMIN, PHIMAX);
0115   l1GctIsoEmOccEtaPhi_ =
0116       ibooker.book2D("IsoEmOccEtaPhi", "ISO EM OCCUPANCY", EMETABINS, EMETAMIN, EMETAMAX, PHIBINS, PHIMIN, PHIMAX);
0117   l1GctNonIsoEmOccEtaPhi_ = ibooker.book2D(
0118       "NonIsoEmOccEtaPhi", "NON-ISO EM OCCUPANCY", EMETABINS, EMETAMIN, EMETAMAX, PHIBINS, PHIMIN, PHIMAX);
0119 
0120   l1GctHFRing1TowerCountPosEtaNegEta_ = ibooker.book2D(
0121       "HFRing1TowerCountCorr", "HF RING1 TOWER COUNT CORRELATION +/-  #eta", R3BINS, R3MIN, R3MAX, R3BINS, R3MIN, R3MAX);
0122   l1GctHFRing2TowerCountPosEtaNegEta_ = ibooker.book2D(
0123       "HFRing2TowerCountCorr", "HF RING2 TOWER COUNT CORRELATION +/-  #eta", R3BINS, R3MIN, R3MAX, R3BINS, R3MIN, R3MAX);
0124 
0125   l1GctHFRing1TowerCountPosEta_ =
0126       ibooker.book1D("HFRing1TowerCountPosEta", "HF RING1 TOWER COUNT  #eta  +", R3BINS, R3MIN, R3MAX);
0127   l1GctHFRing1TowerCountNegEta_ =
0128       ibooker.book1D("HFRing1TowerCountNegEta", "HF RING1 TOWER COUNT  #eta  -", R3BINS, R3MIN, R3MAX);
0129   l1GctHFRing2TowerCountPosEta_ =
0130       ibooker.book1D("HFRing2TowerCountPosEta", "HF RING2 TOWER COUNT  #eta  +", R3BINS, R3MIN, R3MAX);
0131   l1GctHFRing2TowerCountNegEta_ =
0132       ibooker.book1D("HFRing2TowerCountNegEta", "HF RING2 TOWER COUNT  #eta  -", R3BINS, R3MIN, R3MAX);
0133 
0134   l1GctHFRingTowerCountOccBx_ =
0135       ibooker.book2D("HFRingTowerCountOccBx", "HF RING TOWER COUNT PER BX", BXBINS, BXMIN, BXMAX, R3BINS, R3MIN, R3MAX);
0136 
0137   l1GctHFRing1PosEtaNegEta_ = ibooker.book2D("centrality and centrality ext Corr",
0138                                              "centrality and centrality ext E_{T} CORRELATION",
0139                                              R3BINS,
0140                                              R3MIN,
0141                                              R3MAX,
0142                                              R3BINS,
0143                                              R3MIN,
0144                                              R3MAX);
0145   l1GctHFRing1ETSumPosEta_ = ibooker.book1D("centrality", "centrality E_{T}", 8, -0.5, 7.5);
0146   l1GctHFRing1ETSumNegEta_ = ibooker.book1D("centrality ext", "centrality ext E_{T}", 8, -0.5, 7.5);
0147   l1GctHFRingETSum_ = ibooker.book1D("centrality+centralityExt Et", "centrality+centralityExt E_{T}", 8, -0.5, 7.5);
0148   l1GctHFRingETDiff_ = ibooker.book1D("centrality-centralityExt Et", "centrality-centralityExt E_{T}", 8, -0.5, 7.5);
0149 
0150   l1GctHFRingETSumOccBx_ =
0151       ibooker.book2D("centrality OccBx", "centrality PER BX", BXBINS, BXMIN, BXMAX, R3BINS, R3MIN, R3MAX);
0152   l1GctHFRingRatioPosEta_ =
0153       ibooker.book1D("centrality centralityExt ratio", "centrality centralityExt ratio", 9, -0.5, 8.5);
0154 
0155   l1GctMinBiasBitHFEt_ = ibooker.book1D("HI Minimum Bias bits HF Et", "HI Minimum Bias bits HF Et", 6, -0.5, 5.5);
0156 
0157   l1GctCenJetsRank_ = ibooker.book1D("CenJetsRank", "CENTRAL JET E_{T}", R6BINS, R6MIN, R6MAX);
0158   l1GctForJetsRank_ = ibooker.book1D("ForJetsRank", "FORWARD JET E_{T}", R6BINS, R6MIN, R6MAX);
0159   l1GctTauJetsRank_ = ibooker.book1D("SingleTrackTriggerRank", "Single Track Trigger E_{T}", R6BINS, R6MIN, R6MAX);
0160   l1GctIsoEmRank_ = ibooker.book1D("IsoEmRank", "ISO EM E_{T}", R6BINS, R6MIN, R6MAX);
0161   l1GctNonIsoEmRank_ = ibooker.book1D("NonIsoEmRank", "NON-ISO EM E_{T}", R6BINS, R6MIN, R6MAX);
0162 
0163   l1GctAllJetsOccRankBx_ =
0164       ibooker.book2D("AllJetsOccRankBx", "ALL JETS E_{T} PER BX", BXBINS, BXMIN, BXMAX, R6BINS, R6MIN, R6MAX);
0165   l1GctAllEmOccRankBx_ =
0166       ibooker.book2D("AllEmOccRankBx", "ALL EM E_{T} PER BX", BXBINS, BXMIN, BXMAX, R6BINS, R6MIN, R6MAX);
0167 
0168   l1GctEtMiss_ = ibooker.book1D("EtMiss", "MET", R12BINS, R12MIN, R12MAX);
0169   l1GctEtMissPhi_ = ibooker.book1D("EtMissPhi", "MET  #phi", METPHIBINS, METPHIMIN, METPHIMAX);
0170   l1GctEtMissOf_ = ibooker.book1D("EtMissOf", "MET OVERFLOW", OFBINS, OFMIN, OFMAX);
0171   l1GctEtMissOccBx_ = ibooker.book2D("EtMissOccBx", "MET PER BX", BXBINS, BXMIN, BXMAX, R12BINS, R12MIN, R12MAX);
0172 
0173   l1GctEtTotal_ = ibooker.book1D("EtTotal", "SUM E_{T}", R12BINS, R12MIN, R12MAX);
0174   l1GctEtTotalOf_ = ibooker.book1D("EtTotalOf", "SUM E_{T} OVERFLOW", OFBINS, OFMIN, OFMAX);
0175   l1GctEtTotalOccBx_ =
0176       ibooker.book2D("EtTotalOccBx", "SUM E_{T} PER BX", BXBINS, BXMIN, BXMAX, R12BINS, R12MIN, R12MAX);
0177 
0178   l1GctEtHad_ = ibooker.book1D("EtHad", "H_{T}", R12BINS, R12MIN, R12MAX);
0179   l1GctEtHadOf_ = ibooker.book1D("EtHadOf", "H_{T} OVERFLOW", OFBINS, OFMIN, OFMAX);
0180   l1GctEtHadOccBx_ = ibooker.book2D("EtHadOccBx", "H_{T} PER BX", BXBINS, BXMIN, BXMAX, R12BINS, R12MIN, R12MAX);
0181 
0182   l1GctEtTotalEtHadCorr_ =
0183       ibooker.book2D("EtTotalEtHadCorr", "Sum E_{T} H_{T} CORRELATION", R6BINS, R12MIN, R12MAX, R6BINS, R12MIN, R12MAX);
0184 
0185   HFPosEnergy_ = ibooker.book1D("HF+ Energy Sum", "HF+ Energy Sum", R12BINS, R12MIN, R12MAX);
0186   HFNegEnergy_ = ibooker.book1D("HF- Energy Sum", "HF- Energy Sum", R12BINS, R12MIN, R12MAX);
0187   HFEnergy_ = ibooker.book1D("HF Energy Sum", "HF Energy Sum", R12BINS, R12MIN, R12MAX);
0188 
0189   ibooker.setCurrentFolder("L1TEMU/L1TEMUHIon");
0190 
0191   const std::string clabel[8] = {"cenJet", "forJet", "single track", "isoEm", "nonIsoEm", "EtSum", "MET", "HTT"};
0192   const std::string olabel[3] = {"rank", "eta", "phi"};
0193 
0194   unsigned int Bin[3][8] = {{64, 64, 64, 64, 64, 128, 128, 128},
0195                             {EMETABINS, EMETABINS, EMETABINS, EMETABINS, EMETABINS, EMETABINS, EMETABINS, EMETABINS},
0196                             {PHIBINS, PHIBINS, PHIBINS, PHIBINS, PHIBINS, PHIBINS, METPHIBINS, PHIBINS}};
0197   float Min[3][8] = {{-0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5},
0198                      {-0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5},
0199                      {-0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5}};
0200   float Max[3][8] = {{63.5, 63.5, 63.5, 63.5, 63.5, 1023.5, 1023.5, 1023.5},
0201                      {21.5, 21.5, 21.5, 21.5, 21.5, 21.5, 21.5, 21.5},
0202                      {17.5, 17.5, 17.5, 17.5, 17.5, 17.5, 71.5, 17.5}};
0203 
0204   for (int i = 0; i < 3; i++) {
0205     for (int j = 0; j < 8; j++) {
0206       DECorr_[i][j] = ibooker.book2D(clabel[j] + olabel[i] + " data vs emul",
0207                                      clabel[j] + olabel[i] + " data vs emul",
0208                                      Bin[i][j],
0209                                      Min[i][j],
0210                                      Max[i][j],
0211                                      Bin[i][j],
0212                                      Min[i][j],
0213                                      Max[i][j]);
0214     }
0215   }
0216 
0217   centralityCorr_ = ibooker.book2D("centrality data vs emul", "centrality data vs emul", 8, -0.5, 7.5, 8, -0.5, 7.5);
0218   centralityExtCorr_ =
0219       ibooker.book2D("centrality ext data vs emul", "centrality ext data vs emul", 8, -0.5, 7.5, 8, -0.5, 7.5);
0220   MinBiasCorr_ = ibooker.book2D(
0221       "Minimum Bias Trigger Data vs Emul", "Minimum Bias Trigger Data vs Emul", 6, -0.5, 5.5, 6, -0.5, 5.5);
0222 }
0223 
0224 void L1THIonImp::analyze(const edm::Event& e, const edm::EventSetup& c) {
0225   edm::Handle<L1GctEmCandCollection> l1IsoEm;
0226   edm::Handle<L1GctEmCandCollection> l1NonIsoEm;
0227   edm::Handle<L1GctJetCandCollection> l1CenJets;
0228   edm::Handle<L1GctJetCandCollection> l1ForJets;
0229   edm::Handle<L1GctJetCandCollection> l1TauJets;
0230   edm::Handle<L1GctHFRingEtSumsCollection> l1HFSums;
0231   edm::Handle<L1GctHFBitCountsCollection> l1HFCounts;
0232   edm::Handle<L1GctEtMissCollection> l1EtMiss;
0233   edm::Handle<L1GctHtMissCollection> l1HtMiss;
0234   edm::Handle<L1GctEtHadCollection> l1EtHad;
0235   edm::Handle<L1GctEtTotalCollection> l1EtTotal;
0236 
0237   edm::Handle<L1GctEmCandCollection> l1IsoEmEmul;
0238   edm::Handle<L1GctEmCandCollection> l1NonIsoEmEmul;
0239   edm::Handle<L1GctJetCandCollection> l1CenJetsEmul;
0240   edm::Handle<L1GctJetCandCollection> l1ForJetsEmul;
0241   edm::Handle<L1GctJetCandCollection> l1TauJetsEmul;
0242   edm::Handle<L1GctHFRingEtSumsCollection> l1HFSumsEmul;
0243   edm::Handle<L1GctHFBitCountsCollection> l1HFCountsEmul;
0244   edm::Handle<L1GctEtMissCollection> l1EtMissEmul;
0245   edm::Handle<L1GctHtMissCollection> l1HtMissEmul;
0246   edm::Handle<L1GctEtHadCollection> l1EtHadEmul;
0247   edm::Handle<L1GctEtTotalCollection> l1EtTotalEmul;
0248 
0249   edm::Handle<L1CaloRegionCollection> rgn;
0250   e.getByToken(rctSource_L1CRCollection_, rgn);
0251 
0252   e.getByToken(gctIsoEmSourceDataToken_, l1IsoEm);
0253   e.getByToken(gctNonIsoEmSourceDataToken_, l1NonIsoEm);
0254   e.getByToken(gctCenJetsSourceDataToken_, l1CenJets);
0255   e.getByToken(gctForJetsSourceDataToken_, l1ForJets);
0256   e.getByToken(gctTauJetsSourceDataToken_, l1TauJets);
0257   e.getByToken(gctEnergySumsSourceDataToken_, l1HFSums);
0258   e.getByToken(l1HFCountsDataToken_, l1HFCounts);
0259   e.getByToken(l1EtMissDataToken_, l1EtMiss);
0260   e.getByToken(l1HtMissDataToken_, l1HtMiss);
0261   e.getByToken(l1EtHadDataToken_, l1EtHad);
0262   e.getByToken(l1EtTotalDataToken_, l1EtTotal);
0263 
0264   e.getByToken(gctIsoEmSourceEmulToken_, l1IsoEmEmul);
0265   e.getByToken(gctNonIsoEmSourceEmulToken_, l1NonIsoEmEmul);
0266   e.getByToken(gctCenJetsSourceEmulToken_, l1CenJetsEmul);
0267   e.getByToken(gctForJetsSourceEmulToken_, l1ForJetsEmul);
0268   e.getByToken(gctTauJetsSourceEmulToken_, l1TauJetsEmul);
0269   e.getByToken(gctEnergySumsSourceEmulToken_, l1HFSumsEmul);
0270   e.getByToken(l1HFCountsEmulToken_, l1HFCountsEmul);
0271   e.getByToken(l1EtMissEmulToken_, l1EtMissEmul);
0272   e.getByToken(l1HtMissEmulToken_, l1HtMissEmul);
0273   e.getByToken(l1EtHadEmulToken_, l1EtHadEmul);
0274   e.getByToken(l1EtTotalEmulToken_, l1EtTotalEmul);
0275 
0276   // Fill histograms
0277 
0278   // Central jets
0279 
0280   for (L1GctJetCandCollection::const_iterator cj = l1CenJets->begin(); cj != l1CenJets->end(); cj++) {
0281     // only plot central BX
0282     if (cj->bx() == 0) {
0283       l1GctCenJetsRank_->Fill(cj->rank());
0284       // only plot eta and phi maps for non-zero candidates
0285       if (cj->rank()) {
0286         l1GctCenJetsEtEtaPhi_->Fill(cj->regionId().ieta(), cj->regionId().iphi(), cj->rank());
0287         l1GctCenJetsOccEtaPhi_->Fill(cj->regionId().ieta(), cj->regionId().iphi());
0288       }
0289     }
0290     if (cj->rank())
0291       l1GctAllJetsOccRankBx_->Fill(cj->bx(), cj->rank());  // for all BX
0292     for (L1GctJetCandCollection::const_iterator j = l1CenJetsEmul->begin(); j != l1CenJetsEmul->end(); j++) {
0293       if (cj->bx() == 0 && j->bx() == 0 &&
0294           std::distance(l1CenJets->begin(), cj) == std::distance(l1CenJetsEmul->begin(), j)) {
0295         //std::cout<<std::to_string(j)<<std::endl;
0296         DECorr_[0][0]->Fill(cj->rank(), j->rank());
0297         DECorr_[1][0]->Fill(cj->regionId().ieta(), j->regionId().ieta());
0298         DECorr_[2][0]->Fill(cj->regionId().iphi(), j->regionId().iphi());
0299       }
0300     }
0301   }
0302   for (L1GctJetCandCollection::const_iterator j = l1CenJetsEmul->begin(); j != l1CenJetsEmul->end(); j++) {
0303   }
0304 
0305   // Forward jets
0306   for (L1GctJetCandCollection::const_iterator fj = l1ForJets->begin(); fj != l1ForJets->end(); fj++) {
0307     // only plot central BX
0308     if (fj->bx() == 0) {
0309       l1GctForJetsRank_->Fill(fj->rank());
0310       // only plot eta and phi maps for non-zero candidates
0311       if (fj->rank()) {
0312         l1GctForJetsEtEtaPhi_->Fill(fj->regionId().ieta(), fj->regionId().iphi(), fj->rank());
0313         l1GctForJetsOccEtaPhi_->Fill(fj->regionId().ieta(), fj->regionId().iphi());
0314       }
0315     }
0316     if (fj->rank())
0317       l1GctAllJetsOccRankBx_->Fill(fj->bx(), fj->rank());  // for all BX
0318     for (L1GctJetCandCollection::const_iterator j = l1ForJetsEmul->begin(); j != l1ForJetsEmul->end(); j++) {
0319       if (fj->bx() == 0 && j->bx() == 0 &&
0320           std::distance(l1ForJets->begin(), fj) == std::distance(l1ForJetsEmul->begin(), j)) {
0321         DECorr_[0][1]->Fill(fj->rank(), j->rank());
0322         DECorr_[1][1]->Fill(fj->regionId().ieta(), j->regionId().ieta());
0323         DECorr_[2][1]->Fill(fj->regionId().iphi(), j->regionId().iphi());
0324       }
0325     }
0326   }
0327 
0328   for (L1GctJetCandCollection::const_iterator tj = l1TauJets->begin(); tj != l1TauJets->end(); tj++) {
0329     // only plot central BX
0330     if (tj->bx() == 0) {
0331       l1GctTauJetsRank_->Fill(tj->rank());
0332       // only plot eta and phi maps for non-zero candidates
0333       if (tj->rank()) {
0334         l1GctTauJetsEtEtaPhi_->Fill(tj->regionId().ieta(), tj->regionId().iphi(), tj->rank());
0335         l1GctTauJetsOccEtaPhi_->Fill(tj->regionId().ieta(), tj->regionId().iphi());
0336       }
0337     }
0338     if (tj->rank())
0339       l1GctAllJetsOccRankBx_->Fill(tj->bx(), tj->rank());  // for all BX
0340     for (L1GctJetCandCollection::const_iterator j = l1TauJetsEmul->begin(); j != l1TauJetsEmul->end(); j++) {
0341       if (tj->bx() == 0 && j->bx() == 0 &&
0342           std::distance(l1TauJets->begin(), tj) == std::distance(l1TauJetsEmul->begin(), j)) {
0343         DECorr_[0][2]->Fill(tj->rank(), j->rank());
0344         DECorr_[1][2]->Fill(tj->regionId().ieta(), j->regionId().ieta());
0345         DECorr_[2][2]->Fill(tj->regionId().iphi(), j->regionId().iphi());
0346       }
0347     }
0348   }
0349 
0350   for (L1GctEtMissCollection::const_iterator met = l1EtMiss->begin(); met != l1EtMiss->end(); met++) {
0351     // only plot central BX
0352     if (met->bx() == 0) {
0353       if (met->overFlow() == 0 && met->et() > 0) {
0354         //Avoid problems with met=0 candidates affecting MET_PHI plots
0355         l1GctEtMiss_->Fill(met->et());
0356         l1GctEtMissPhi_->Fill(met->phi());
0357       }
0358       l1GctEtMissOf_->Fill(met->overFlow());
0359     }
0360     if (met->overFlow() == 0 && met->et() > 0)
0361       l1GctEtMissOccBx_->Fill(met->bx(), met->et());  // for all BX
0362     for (L1GctEtMissCollection::const_iterator j = l1EtMissEmul->begin(); j != l1EtMissEmul->end(); j++) {
0363       if (met->bx() == 0 && j->bx() == 0) {
0364         DECorr_[0][6]->Fill(met->et(), j->et());
0365         DECorr_[2][6]->Fill(met->phi(), j->phi());
0366       }
0367     }
0368   }
0369 
0370   for (L1GctEtHadCollection::const_iterator ht = l1EtHad->begin(); ht != l1EtHad->end(); ht++) {
0371     // only plot central BX
0372     if (ht->bx() == 0) {
0373       l1GctEtHad_->Fill(ht->et());
0374       l1GctEtHadOf_->Fill(ht->overFlow());
0375     }
0376     l1GctEtHadOccBx_->Fill(ht->bx(), ht->et());  // for all BX
0377     for (L1GctEtHadCollection::const_iterator j = l1EtHadEmul->begin(); j != l1EtHadEmul->end(); j++) {
0378       if (ht->bx() == 0 && j->bx() == 0) {
0379         DECorr_[0][7]->Fill(ht->et(), j->et());
0380         //DECorr_[2][7]->Fill(ht->ieta(),j->ieta());
0381         //DECorr_[3][7]->Fill(ht->iphi(),j->iphi());
0382       }
0383     }
0384   }
0385 
0386   for (L1GctEtTotalCollection::const_iterator et = l1EtTotal->begin(); et != l1EtTotal->end(); et++) {
0387     // only plot central BX
0388     if (et->bx() == 0) {
0389       l1GctEtTotal_->Fill(et->et());
0390       l1GctEtTotalOf_->Fill(et->overFlow());
0391     }
0392     l1GctEtTotalOccBx_->Fill(et->bx(), et->et());  // for all BX
0393     for (L1GctEtTotalCollection::const_iterator j = l1EtTotalEmul->begin(); j != l1EtTotalEmul->end(); j++) {
0394       if (et->bx() == 0 && j->bx() == 0) {
0395         DECorr_[0][5]->Fill(et->et(), j->et());
0396         //DECorr_[2][5]->Fill(et->eta(),j->eta());
0397         //DECorr_[3][5]->Fill(et->iphi(),j->iphi());
0398       }
0399     }
0400   }
0401 
0402   for (L1GctEmCandCollection::const_iterator ie = l1IsoEm->begin(); ie != l1IsoEm->end(); ie++) {
0403     // only plot central BX
0404     if (ie->bx() == 0) {
0405       l1GctIsoEmRank_->Fill(ie->rank());
0406       // only plot eta and phi maps for non-zero candidates
0407       if (ie->rank()) {
0408         l1GctIsoEmRankEtaPhi_->Fill(ie->regionId().ieta(), ie->regionId().iphi(), ie->rank());
0409         l1GctIsoEmOccEtaPhi_->Fill(ie->regionId().ieta(), ie->regionId().iphi());
0410       }
0411     }
0412     if (ie->rank())
0413       l1GctAllEmOccRankBx_->Fill(ie->bx(), ie->rank());  // for all BX
0414     for (L1GctEmCandCollection::const_iterator j = l1IsoEmEmul->begin(); j != l1IsoEmEmul->end(); j++) {
0415       if (ie->bx() == 0 && j->bx() == 0 &&
0416           std::distance(l1IsoEm->begin(), ie) == std::distance(l1IsoEmEmul->begin(), j)) {
0417         DECorr_[0][3]->Fill(ie->rank(), j->rank());
0418         DECorr_[1][3]->Fill(ie->regionId().ieta(), j->regionId().ieta());
0419         DECorr_[2][3]->Fill(ie->regionId().iphi(), j->regionId().iphi());
0420       }
0421     }
0422   }
0423 
0424   for (L1GctEmCandCollection::const_iterator ne = l1NonIsoEm->begin(); ne != l1NonIsoEm->end(); ne++) {
0425     // only plot central BX
0426     if (ne->bx() == 0) {
0427       l1GctNonIsoEmRank_->Fill(ne->rank());
0428       // only plot eta and phi maps for non-zero candidates
0429       if (ne->rank()) {
0430         l1GctNonIsoEmRankEtaPhi_->Fill(ne->regionId().ieta(), ne->regionId().iphi(), ne->rank());
0431         l1GctNonIsoEmOccEtaPhi_->Fill(ne->regionId().ieta(), ne->regionId().iphi());
0432       }
0433     }
0434     if (ne->rank())
0435       l1GctAllEmOccRankBx_->Fill(ne->bx(), ne->rank());  // for all BX
0436     for (L1GctEmCandCollection::const_iterator j = l1NonIsoEmEmul->begin(); j != l1NonIsoEmEmul->end(); j++) {
0437       if (ne->bx() == 0 && j->bx() == 0 &&
0438           std::distance(l1NonIsoEm->begin(), ne) == std::distance(l1NonIsoEmEmul->begin(), j)) {
0439         DECorr_[0][4]->Fill(ne->rank(), j->rank());
0440         DECorr_[1][4]->Fill(ne->regionId().ieta(), j->regionId().ieta());
0441         DECorr_[2][4]->Fill(ne->regionId().iphi(), j->regionId().iphi());
0442       }
0443     }
0444   }
0445 
0446   for (L1GctHFBitCountsCollection::const_iterator hfc = l1HFCounts->begin(); hfc != l1HFCounts->end(); hfc++) {
0447     // only plot central BX
0448     if (hfc->bx() == 0) {
0449       // Individual ring counts
0450       l1GctHFRing1TowerCountPosEta_->Fill(hfc->bitCount(0));
0451       l1GctHFRing1TowerCountNegEta_->Fill(hfc->bitCount(1));
0452       l1GctHFRing2TowerCountPosEta_->Fill(hfc->bitCount(2));
0453       l1GctHFRing2TowerCountNegEta_->Fill(hfc->bitCount(3));
0454       // Correlate positive and negative eta
0455       l1GctHFRing1TowerCountPosEtaNegEta_->Fill(hfc->bitCount(0), hfc->bitCount(1));
0456       l1GctHFRing2TowerCountPosEtaNegEta_->Fill(hfc->bitCount(2), hfc->bitCount(3));
0457     }
0458     // Occupancy vs BX
0459     for (unsigned i = 0; i < 4; i++) {
0460       l1GctHFRingTowerCountOccBx_->Fill(hfc->bx(), hfc->bitCount(i));
0461     }
0462   }
0463 
0464   for (L1GctHFRingEtSumsCollection::const_iterator hfs = l1HFSums->begin(); hfs != l1HFSums->end(); hfs++) {
0465     if (hfs->bx() == 0) {
0466       l1GctHFRing1ETSumPosEta_->Fill(hfs->etSum(0));
0467       l1GctHFRing1ETSumNegEta_->Fill(hfs->etSum(1));
0468       l1GctHFRingETSum_->Fill(hfs->etSum(0) + hfs->etSum(1));
0469       l1GctHFRingETDiff_->Fill(abs(hfs->etSum(0) - hfs->etSum(1)));
0470       if (hfs->etSum(1) != 0)
0471         l1GctHFRingRatioPosEta_->Fill((hfs->etSum(0)) / (hfs->etSum(1)));
0472       l1GctHFRing1PosEtaNegEta_->Fill(hfs->etSum(0), hfs->etSum(1));
0473       std::vector<int> bit = SortMinBiasBit(hfs->etSum(2), hfs->etSum(3));
0474       for (std::vector<int>::const_iterator it = bit.begin(); it != bit.end(); it++) {
0475         l1GctMinBiasBitHFEt_->Fill(it - bit.begin(), *it);
0476       }
0477     }
0478     for (unsigned i = 0; i < 4; i++) {
0479       l1GctHFRingETSumOccBx_->Fill(hfs->bx(), hfs->etSum(i));
0480     }
0481     for (L1GctHFRingEtSumsCollection::const_iterator j = l1HFSumsEmul->begin(); j != l1HFSumsEmul->end(); j++) {
0482       if (hfs->bx() == 0 && j->bx() == 0 &&
0483           std::distance(l1HFSums->begin(), hfs) == std::distance(l1HFSumsEmul->begin(), j)) {
0484         centralityCorr_->Fill(hfs->etSum(0), j->etSum(0));
0485         centralityExtCorr_->Fill(hfs->etSum(1), j->etSum(1));
0486         std::vector<int> dbit = SortMinBiasBit(hfs->etSum(2), hfs->etSum(3));
0487         std::vector<int> ebit = SortMinBiasBit(j->etSum(2), j->etSum(3));
0488       }
0489     }
0490   }
0491 
0492   for (L1CaloRegionCollection::const_iterator it = rgn->begin(); it != rgn->end(); it++) {
0493     if (it->bx() == 0) {
0494       int totm = 0;
0495       int totp = 0;
0496       if (it->gctEta() < 4) {
0497         totm += it->et();
0498       }
0499       if (it->gctEta() > 17) {
0500         totp += it->et();
0501       }
0502       HFNegEnergy_->Fill(totm);
0503       HFPosEnergy_->Fill(totp);
0504       HFEnergy_->Fill(totm + totp);
0505     }
0506   }
0507 }
0508 
0509 std::vector<int> L1THIonImp::SortMinBiasBit(uint16_t a, uint16_t b) {
0510   std::vector<int> Bit;
0511 
0512   if ((a + 1) / 4 > 0.5) {
0513     Bit.push_back(1);
0514   } else {
0515     Bit.push_back(0);
0516   }
0517 
0518   if (a == 2 || a == 3 || a == 6 || a == 7) {
0519     Bit.push_back(1);
0520   } else {
0521     Bit.push_back(0);
0522   }
0523 
0524   Bit.push_back(a % 2);
0525 
0526   if ((b + 1) / 4 > 0.5) {
0527     Bit.push_back(1);
0528   } else {
0529     Bit.push_back(0);
0530   }
0531 
0532   if (b == 2 || b == 3 || b == 6 || b == 7) {
0533     Bit.push_back(1);
0534   } else {
0535     Bit.push_back(0);
0536   }
0537 
0538   Bit.push_back(b % 2);
0539 
0540   return Bit;
0541 }