Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345
#include "DQM/L1TMonitor/interface/L1TStage2CaloLayer2.h"

L1TStage2CaloLayer2::L1TStage2CaloLayer2(const edm::ParameterSet& ps)
    : monitorDir_(ps.getUntrackedParameter<std::string>("monitorDir", "")),
      stage2CaloLayer2JetToken_(
          consumes<l1t::JetBxCollection>(ps.getParameter<edm::InputTag>("stage2CaloLayer2JetSource"))),
      stage2CaloLayer2EGammaToken_(
          consumes<l1t::EGammaBxCollection>(ps.getParameter<edm::InputTag>("stage2CaloLayer2EGammaSource"))),
      stage2CaloLayer2TauToken_(
          consumes<l1t::TauBxCollection>(ps.getParameter<edm::InputTag>("stage2CaloLayer2TauSource"))),
      stage2CaloLayer2EtSumToken_(
          consumes<l1t::EtSumBxCollection>(ps.getParameter<edm::InputTag>("stage2CaloLayer2EtSumSource"))),
      verbose_(ps.getUntrackedParameter<bool>("verbose", false)) {}

L1TStage2CaloLayer2::~L1TStage2CaloLayer2() {}

void L1TStage2CaloLayer2::bookHistograms(DQMStore::IBooker& ibooker, edm::Run const&, edm::EventSetup const&) {
  //central jet
  ibooker.setCurrentFolder(monitorDir_ + "/Central-Jets");

  stage2CaloLayer2CenJetEtEtaPhi_ = ibooker.book2D(
      "CenJetsEtEtaPhi", "CENTRAL JET E_{T} ETA PHI; Jet i#eta; Jet i#phi", 229, -114.5, 114.5, 144, -0.5, 143.5);
  stage2CaloLayer2CenJetEta_ = ibooker.book1D("CenJetsEta", "CENTRAL JET ETA; Jet i#eta; Counts", 229, -114.5, 114.5);
  stage2CaloLayer2CenJetPhi_ = ibooker.book1D("CenJetsPhi", "CENTRAL JET PHI; Jet i#phi; Counts", 144, -0.5, 143.5);
  stage2CaloLayer2CenJetRank_ =
      ibooker.book1D("CenJetsRank", "CENTRAL JET E_{T}; Jet iE_{T}; Counts", 2048, -0.5, 2047.5);
  stage2CaloLayer2CenJetOcc_ =
      ibooker.book2D("CenJetsOcc", "CENTRAL JET OCCUPANCY; i#eta; i#phi", 229, -114.5, 114.5, 144, -0.5, 143.5);
  stage2CaloLayer2CenJetBxOcc_ =
      ibooker.book2D("CenJetsBxOcc", "CENTRAL JET BX OCCUPANCY; BX; Counts", 5, -2.5, 2.5, 512, -0.5, 2047.5);
  stage2CaloLayer2CenJetQual_ = ibooker.book1D("CenJetsQual", "CENTRAL JET QUALITY; Quality; Counts", 32, -0.5, 31.5);

  //forward jet
  ibooker.setCurrentFolder(monitorDir_ + "/Forward-Jets");

  stage2CaloLayer2ForJetEtEtaPhi_ = ibooker.book2D(
      "ForJetsEtEtaPhi", "FORWARD JET E_{T} ETA PHI; Jet i#eta; Jet i#phi", 229, -114.5, 114.5, 144, -0.5, 143.5);
  stage2CaloLayer2ForJetEta_ = ibooker.book1D("ForJetsEta", "FORWARD JET ETA; Jet i#eta; Counts", 229, -114.5, 114.5);
  stage2CaloLayer2ForJetPhi_ = ibooker.book1D("ForJetsPhi", "FORWARD JET PHI; Jet i#phi; Counts", 144, -0.5, 143.5);
  stage2CaloLayer2ForJetRank_ =
      ibooker.book1D("ForJetsRank", "FORWARD JET E_{T}; Jet iE_{T}; Counts", 2048, -0.5, 2047.5);
  stage2CaloLayer2ForJetOcc_ =
      ibooker.book2D("ForJetsOcc", "FORWARD JET OCCUPANCY; Jet i#eta; Jet i#phi", 229, -114.5, 114.5, 144, -0.5, 143.5);
  stage2CaloLayer2ForJetBxOcc_ =
      ibooker.book2D("ForJetsBxOcc", "FORWARD JET BX OCCUPANCY; BX; Counts", 5, -2.5, 2.5, 512, -0.5, 2047.5);
  stage2CaloLayer2ForJetQual_ = ibooker.book1D("ForJetsQual", "FORWARD JET QUALITY; Quality; Counts", 32, -0.5, 31.5);

  //IsoEG
  ibooker.setCurrentFolder(monitorDir_ + "/Isolated-EG");

  stage2CaloLayer2EGIso_ = ibooker.book1D("EGIso", "EG ISO; Iso Flag; Counts", 4, -0.5, 3.5);
  stage2CaloLayer2IsoEGEtEtaPhi_ =
      ibooker.book2D("IsoEGsEtEtaPhi", "ISO EG E_{T} ETA PHI; i#eta; i#phi", 229, -114.5, 114.5, 144, -0.5, 143.5);
  stage2CaloLayer2IsoEGEta_ = ibooker.book1D("IsoEGsEta", "ISO EG ETA; EG i#eta; Counts", 229, -114.5, 114.5);
  stage2CaloLayer2IsoEGPhi_ = ibooker.book1D("IsoEGsPhi", "ISO EG PHI; EG i#phi; Counts", 144, -0.5, 143.5);
  stage2CaloLayer2IsoEGRank_ = ibooker.book1D("IsoEGsRank", "ISO EG E_{T}; EG iE_{T}; Counts", 512, -0.5, 511.5);
  stage2CaloLayer2IsoEGOcc_ =
      ibooker.book2D("IsoEGsOcc", "ISO EG OCCUPANCY; i#eta; i#phi", 229, -114.5, 114.5, 144, -0.5, 143.5);
  stage2CaloLayer2IsoEGBxOcc_ =
      ibooker.book2D("IsoEGsBxOcc", "ISO EG BX OCCUPANCY; BX; Counts", 5, -2.5, 2.5, 128, -0.5, 511.5);
  stage2CaloLayer2IsoEGQual_ = ibooker.book1D("IsoEGsQual", "ISO EG QUALITY; Quality; Counts", 32, -0.5, 31.5);

  //NonIsoEG
  ibooker.setCurrentFolder(monitorDir_ + "/NonIsolated-EG");

  stage2CaloLayer2NonIsoEGEtEtaPhi_ = ibooker.book2D(
      "NonIsoEGsEtEtaPhi", "NonISO EG E_{T} ETA PHI; i#eta; i#phi", 229, -114.5, 114.5, 144, -0.5, 143.5);
  stage2CaloLayer2NonIsoEGEta_ =
      ibooker.book1D("NonIsoEGsEta", "NonISO EG ETA; NonISO EG i#eta; Counts", 229, -114.5, 114.5);
  stage2CaloLayer2NonIsoEGPhi_ =
      ibooker.book1D("NonIsoEGsPhi", "NonISO EG PHI; NonISO EG i#phi; Counts", 144, -0.5, 143.5);
  stage2CaloLayer2NonIsoEGRank_ =
      ibooker.book1D("NonIsoEGsRank", "NonISO EG E_{T}; NonISO EG iE_{T}; Counts", 512, -0.5, 511.5);
  stage2CaloLayer2NonIsoEGOcc_ =
      ibooker.book2D("NonIsoEGsOcc", "NonISO EG OCCUPANCY; i#eta; i#phi", 229, -114.5, 114.5, 144, -0.5, 143.5);
  stage2CaloLayer2NonIsoEGBxOcc_ =
      ibooker.book2D("NonIsoEGsBxOcc", "NonISO EG BX OCCUPANCY; BX; Counts", 5, -2.5, 2.5, 128, -0.5, 511.5);
  stage2CaloLayer2NonIsoEGQual_ = ibooker.book1D("NonIsoEGsQual", "NonISO EG QUALITY; Quality; Counts", 32, -0.5, 31.5);

  //IsoTau
  ibooker.setCurrentFolder(monitorDir_ + "/Isolated-Tau");

  stage2CaloLayer2TauIso_ = ibooker.book1D("TauIso", "Tau ISO; Iso Flag; Counts", 4, -0.5, 3.5);
  stage2CaloLayer2IsoTauEtEtaPhi_ =
      ibooker.book2D("IsoTausEtEtaPhi", "ISO Tau E_{T} ETA PHI; i#eta; i#phi", 229, -114.5, 114.5, 144, -0.5, 143.5);
  stage2CaloLayer2IsoTauEta_ = ibooker.book1D("IsoTausEta", "ISO Tau ETA; ISO Tau i#eta; Counts", 229, -114.5, 114.5);
  stage2CaloLayer2IsoTauPhi_ = ibooker.book1D("IsoTausPhi", "ISO Tau PHI; ISO Tau i#phi; Counts", 144, -0.5, 143.5);
  stage2CaloLayer2IsoTauRank_ =
      ibooker.book1D("IsoTausRank", "ISO Tau E_{T}; ISO Tau iE_{T}; Counts", 512, -0.5, 511.5);
  stage2CaloLayer2IsoTauOcc_ =
      ibooker.book2D("IsoTausOcc", "ISO Tau OCCUPANCY; i#eta; i#phi", 229, -114.5, 114.5, 144, -0.5, 143.5);
  stage2CaloLayer2IsoTauBxOcc_ =
      ibooker.book2D("IsoTausBxOcc", "ISO Tau BX OCCUPANCY; BX; Counts", 5, -2.5, 2.5, 128, -0.5, 511.5);
  stage2CaloLayer2IsoTauQual_ = ibooker.book1D("IsoTausQual", "ISO Tau QUALITY; Quality; Counts", 32, -0.5, 31.5);

  //NonIsoTau
  ibooker.setCurrentFolder(monitorDir_ + "/NonIsolated-Tau");

  stage2CaloLayer2TauEtEtaPhi_ =
      ibooker.book2D("TausEtEtaPhi", "Tau E_{T} ETA PHI; i#eta; i#phi", 229, -114.5, 114.5, 144, -0.5, 143.5);
  stage2CaloLayer2TauEta_ = ibooker.book1D("TausEta", "NonISO Tau ETA; Tau i#eta; Counts", 229, -114.5, 114.5);
  stage2CaloLayer2TauPhi_ = ibooker.book1D("TausPhi", "NonISO Tau PHI; Tau i#phi; Counts", 144, -0.5, 143.5);
  stage2CaloLayer2TauRank_ = ibooker.book1D("TausRank", "NonISO Tau E_{T}; Tau iE_{T}; Counts", 512, -0.5, 511.5);
  stage2CaloLayer2TauOcc_ =
      ibooker.book2D("TausOcc", "NonISO Tau OCCUPANCY; i#eta; i#phi", 229, -114.5, 114.5, 144, -0.5, 143.5);
  stage2CaloLayer2TauBxOcc_ =
      ibooker.book2D("TausBxOcc", "NonISO Tau BX OCCUPANCY; BX; Counts", 5, -2.5, 2.5, 128, -0.5, 511.5);
  stage2CaloLayer2TauQual_ = ibooker.book1D("TausQual", "NonISO Tau QUALITY; Quality; Counts", 32, -0.5, 31.5);

  //EtSums
  ibooker.setCurrentFolder(monitorDir_ + "/Energy-Sums");

  stage2CaloLayer2EtSumBxOcc_ =
      ibooker.book2D("EtSumBxOcc", "EtSum BX OCCUPANCY; BX; Counts", 5, -2.5, 2.5, 1024, -0.5, 4095.5);
  stage2CaloLayer2METRank_ = ibooker.book1D("METRank", "MET E_{T}; iE_{T}; Counts", 4096, -0.5, 4095.5);
  stage2CaloLayer2METPhi_ = ibooker.book1D("METPhi", "MET Phi; MET i#Phi; Counts", 144, -0.5, 143.5);
  stage2CaloLayer2ETTRank_ = ibooker.book1D("ETTRank", "ETT E_{T}; ETT iE_{T}; Counts", 4096, -0.5, 4095.5);
  stage2CaloLayer2MHTRank_ = ibooker.book1D("MHTRank", "MHT E_{T}; MHT iE_{T}; Counts", 4096, -0.5, 4095.5);
  stage2CaloLayer2MHTPhi_ = ibooker.book1D("MHTPhi", "MHT Phi; MHT i#phi; Counts", 144, -0.5, 143.5);
  stage2CaloLayer2HTTRank_ = ibooker.book1D("HTTRank", "HTT E_{T}; HTT iE_{T}; Counts", 4096, -0.5, 4095.5);
  stage2CaloLayer2METHFRank_ = ibooker.book1D("METHFRank", "METHF E_{T}; METHF iE_{T}; Counts", 4096, -0.5, 4095.5);
  stage2CaloLayer2METHFPhi_ = ibooker.book1D("METHFPhi", "METHF Phi; METHF i#phi; Counts", 144, -0.5, 143.5);
  // stage2CaloLayer2ETTHFRank_ = ibooker.book1D("ETTHFRank", "ETTHF E_{T}", 4096, -0.5, 4095.5);
  stage2CaloLayer2MHTHFRank_ = ibooker.book1D("MHTHFRank", "MHTHF E_{T}; MHTHF iE_{T}; Counts", 4096, -0.5, 4095.5);
  stage2CaloLayer2MHTHFPhi_ = ibooker.book1D("MHTHFPhi", "MHTHF Phi; MHTHF i#phi; Counts", 144, -0.5, 143.5);
  // stage2CaloLayer2HTTHFRank_ = ibooker.book1D("HTTHFRank", "HTTHF E_{T}", 4096, -0.5, 4095.5);
  stage2CaloLayer2ETTEMRank_ = ibooker.book1D("ETTEMRank", "ETTEM E_{T}; ETTEM iE_{T}; Counts", 4096, -0.5, 4095.5);

  stage2CaloLayer2Asymmetry_ = ibooker.book1D("Asymmetry", "Asymmetry; Assymmetry; Counts", 256, -0.5, 255.5);
  stage2CaloLayer2Centrality_ = ibooker.book1D("Centrality", "Centrality; Centrality; Counts", 9, -1.5, 7.5);

  stage2CaloLayer2MinBiasHFP0_ =
      ibooker.book1D("MinBiasHFP0", "HF Min Bias Sum Threshold 0, Positive #eta; N_{towers}; Events", 16, -0.5, 15.5);
  stage2CaloLayer2MinBiasHFM0_ =
      ibooker.book1D("MinBiasHFM0", "HF Min Bias Sum Threshold 1, Nevagive #eta; N_{towers}; Events", 16, -0.5, 15.5);
  stage2CaloLayer2MinBiasHFP1_ =
      ibooker.book1D("MinBiasHFP1", "HF Min Bias Sum Threshold 1, Positive #eta; N_{towers}; Events", 16, -0.5, 15.5);
  stage2CaloLayer2MinBiasHFM1_ =
      ibooker.book1D("MinBiasHFM1", "HF Min Bias Sum Threshold 1, Negative #eta; N_{towers}; Events", 16, -0.5, 15.5);

  stage2CaloLayer2TowCount_ =
      ibooker.book1D("TowCount", "Count of Trigger towers above threshold; N_{towers}; Events", 5904, -0.5, 5903.5);

  ibooker.setCurrentFolder(monitorDir_ + "/Timing");
  timingStage2CaloLayer2CenJetBxOcc_ = stage2CaloLayer2CenJetBxOcc_;
  timingStage2CaloLayer2ForJetBxOcc_ = stage2CaloLayer2ForJetBxOcc_;
  timingStage2CaloLayer2IsoEGBxOcc_ = stage2CaloLayer2IsoEGBxOcc_;
  timingStage2CaloLayer2NonIsoEGBxOcc_ = stage2CaloLayer2NonIsoEGBxOcc_;
  timingStage2CaloLayer2IsoTauBxOcc_ = stage2CaloLayer2TauBxOcc_;
  timingStage2CaloLayer2TauBxOcc_ = stage2CaloLayer2EtSumBxOcc_;
  timingStage2CaloLayer2EtSumBxOcc_ = stage2CaloLayer2EtSumBxOcc_;

  //Shifter
  ibooker.setCurrentFolder(monitorDir_ + "/shifter");
  stage2CaloLayer2CenJetEtEtaPhi_shift_ = ibooker.book2D(
      "CenJetsEtEtaPhi_shift", "CENTRAL JET E_{T} ETA PHI; Jet i#eta; Jet i#phi", 68, -68, 68, 72, -0.5, 143.5);
  stage2CaloLayer2ForJetEtEtaPhi_shift_ = ibooker.book2D(
      "ForJetsEtEtaPhi_shift", "FORWARD JET E_{T} ETA PHI; Jet i#eta; Jet i#phi", 58, -116, 116, 36, -0.5, 143.5);
  stage2CaloLayer2IsoEGEtEtaPhi_shift_ =
      ibooker.book2D("IsoEGsEtEtaPhi_shift", "ISO EG E_{T} ETA PHI; i#eta; i#phi", 70, -70, 70, 72, -0.5, 143.5);
  stage2CaloLayer2NonIsoEGEtEtaPhi_shift_ =
      ibooker.book2D("NonIsoEGsEtEtaPhi_shift", "NonISO EG E_{T} ETA PHI; i#eta; i#phi", 70, -70, 70, 72, -0.5, 143.5);
  stage2CaloLayer2IsoTauEtEtaPhi_shift_ =
      ibooker.book2D("IsoTausEtEtaPhi_shift", "ISO Tau E_{T} ETA PHI; i#eta; i#phi", 60, -60, 60, 72, -0.5, 143.5);
  stage2CaloLayer2TauEtEtaPhi_shift_ =
      ibooker.book2D("TausEtEtaPhi_shift", "Tau E_{T} ETA PHI; i#eta; i#phi", 60, -60, 60, 72, -0.5, 143.5);
}

void L1TStage2CaloLayer2::analyze(const edm::Event& e, const edm::EventSetup& c) {
  if (verbose_) {
    edm::LogInfo("L1TStage2CaloLayer2") << "L1TStage2CaloLayer2: analyze...." << std::endl;
  }

  // analyze Jet
  edm::Handle<l1t::JetBxCollection> Jet;
  e.getByToken(stage2CaloLayer2JetToken_, Jet);

  for (int itBX = Jet->getFirstBX(); itBX <= Jet->getLastBX(); ++itBX) {
    for (l1t::JetBxCollection::const_iterator itJet = Jet->begin(itBX); itJet != Jet->end(itBX); ++itJet) {
      const bool forward = (itJet->hwEta() > 68 || itJet->hwEta() < (-68));
      if (forward) {
        stage2CaloLayer2ForJetBxOcc_->Fill(itBX, itJet->hwPt());
        if (itBX == 0) {
          stage2CaloLayer2ForJetRank_->Fill(itJet->hwPt());
          if (itJet->hwPt() != 0) {
            stage2CaloLayer2ForJetEtEtaPhi_->Fill(itJet->hwEta(), itJet->hwPhi(), itJet->hwPt());
            stage2CaloLayer2ForJetEtEtaPhi_shift_->Fill(itJet->hwEta(), itJet->hwPhi(), itJet->hwPt());
            stage2CaloLayer2ForJetOcc_->Fill(itJet->hwEta(), itJet->hwPhi());
            stage2CaloLayer2ForJetPhi_->Fill(itJet->hwPhi());
            stage2CaloLayer2ForJetEta_->Fill(itJet->hwEta());
            stage2CaloLayer2ForJetQual_->Fill(itJet->hwQual());
          }
        }
      } else {
        stage2CaloLayer2CenJetBxOcc_->Fill(itBX, itJet->hwPt());
        if (itBX == 0) {
          stage2CaloLayer2CenJetRank_->Fill(itJet->hwPt());
          if (itJet->hwPt() != 0) {
            stage2CaloLayer2CenJetEtEtaPhi_->Fill(itJet->hwEta(), itJet->hwPhi(), itJet->hwPt());
            stage2CaloLayer2CenJetEtEtaPhi_shift_->Fill(itJet->hwEta(), itJet->hwPhi(), itJet->hwPt());
            stage2CaloLayer2CenJetOcc_->Fill(itJet->hwEta(), itJet->hwPhi());
            stage2CaloLayer2CenJetPhi_->Fill(itJet->hwPhi());
            stage2CaloLayer2CenJetEta_->Fill(itJet->hwEta());
            stage2CaloLayer2CenJetQual_->Fill(itJet->hwQual());
          }
        }
      }
    }
  }

  //analyze EGamma
  edm::Handle<l1t::EGammaBxCollection> EGamma;
  e.getByToken(stage2CaloLayer2EGammaToken_, EGamma);

  for (int itBX = EGamma->getFirstBX(); itBX <= EGamma->getLastBX(); ++itBX) {
    for (l1t::EGammaBxCollection::const_iterator itEG = EGamma->begin(itBX); itEG != EGamma->end(itBX); ++itEG) {
      bool iso = itEG->hwIso();
      if (iso) {
        stage2CaloLayer2IsoEGBxOcc_->Fill(itBX, itEG->hwPt());
        if (itBX == 0) {
          stage2CaloLayer2IsoEGRank_->Fill(itEG->hwPt());
          if (itEG->hwPt() != 0) {
            stage2CaloLayer2IsoEGEtEtaPhi_->Fill(itEG->hwEta(), itEG->hwPhi(), itEG->hwPt());
            stage2CaloLayer2IsoEGEtEtaPhi_shift_->Fill(itEG->hwEta(), itEG->hwPhi(), itEG->hwPt());
            stage2CaloLayer2IsoEGOcc_->Fill(itEG->hwEta(), itEG->hwPhi());
            stage2CaloLayer2IsoEGPhi_->Fill(itEG->hwPhi());
            stage2CaloLayer2IsoEGEta_->Fill(itEG->hwEta());
            stage2CaloLayer2IsoEGQual_->Fill(itEG->hwQual());
            stage2CaloLayer2EGIso_->Fill(itEG->hwIso());
          }
        }
      } else {
        stage2CaloLayer2NonIsoEGBxOcc_->Fill(itBX, itEG->hwPt());
        if (itBX == 0) {
          stage2CaloLayer2NonIsoEGRank_->Fill(itEG->hwPt());
          if (itEG->hwPt() != 0) {
            stage2CaloLayer2NonIsoEGEtEtaPhi_->Fill(itEG->hwEta(), itEG->hwPhi(), itEG->hwPt());
            stage2CaloLayer2NonIsoEGEtEtaPhi_shift_->Fill(itEG->hwEta(), itEG->hwPhi(), itEG->hwPt());
            stage2CaloLayer2NonIsoEGOcc_->Fill(itEG->hwEta(), itEG->hwPhi());
            stage2CaloLayer2NonIsoEGPhi_->Fill(itEG->hwPhi());
            stage2CaloLayer2NonIsoEGEta_->Fill(itEG->hwEta());
            stage2CaloLayer2NonIsoEGQual_->Fill(itEG->hwQual());
            stage2CaloLayer2EGIso_->Fill(itEG->hwIso());
          }
        }
      }
    }
  }

  //analyze Tau
  edm::Handle<l1t::TauBxCollection> Tau;
  e.getByToken(stage2CaloLayer2TauToken_, Tau);
  for (int itBX = Tau->getFirstBX(); itBX <= Tau->getLastBX(); ++itBX) {
    for (l1t::TauBxCollection::const_iterator itTau = Tau->begin(itBX); itTau != Tau->end(itBX); ++itTau) {
      bool iso = itTau->hwIso();
      if (iso) {
        stage2CaloLayer2IsoTauBxOcc_->Fill(itBX, itTau->hwPt());
        if (itBX == 0) {
          stage2CaloLayer2IsoTauRank_->Fill(itTau->hwPt());
          if (itTau->hwPt() != 0) {
            stage2CaloLayer2IsoTauEtEtaPhi_->Fill(itTau->hwEta(), itTau->hwPhi(), itTau->hwPt());
            stage2CaloLayer2IsoTauEtEtaPhi_shift_->Fill(itTau->hwEta(), itTau->hwPhi(), itTau->hwPt());
            stage2CaloLayer2IsoTauOcc_->Fill(itTau->hwEta(), itTau->hwPhi());
            stage2CaloLayer2IsoTauPhi_->Fill(itTau->hwPhi());
            stage2CaloLayer2IsoTauEta_->Fill(itTau->hwEta());
            stage2CaloLayer2IsoTauQual_->Fill(itTau->hwQual());
            stage2CaloLayer2TauIso_->Fill(itTau->hwIso());
          }
        }
      } else {
        stage2CaloLayer2TauBxOcc_->Fill(itBX, itTau->hwPt());
        if (itBX == 0) {
          stage2CaloLayer2TauRank_->Fill(itTau->hwPt());
          if (itTau->hwPt() != 0) {
            stage2CaloLayer2TauEtEtaPhi_->Fill(itTau->hwEta(), itTau->hwPhi(), itTau->hwPt());
            stage2CaloLayer2TauEtEtaPhi_shift_->Fill(itTau->hwEta(), itTau->hwPhi(), itTau->hwPt());
            stage2CaloLayer2TauOcc_->Fill(itTau->hwEta(), itTau->hwPhi());
            stage2CaloLayer2TauPhi_->Fill(itTau->hwPhi());
            stage2CaloLayer2TauEta_->Fill(itTau->hwEta());
            stage2CaloLayer2TauQual_->Fill(itTau->hwQual());
            stage2CaloLayer2TauIso_->Fill(itTau->hwIso());
          }
        }
      }
    }
  }

  //energy sum
  edm::Handle<l1t::EtSumBxCollection> EtSum;
  e.getByToken(stage2CaloLayer2EtSumToken_, EtSum);
  for (int itBX = EtSum->getFirstBX(); itBX <= EtSum->getLastBX(); ++itBX) {
    for (l1t::EtSumBxCollection::const_iterator itEtSum = EtSum->begin(itBX); itEtSum != EtSum->end(itBX); ++itEtSum) {
      stage2CaloLayer2EtSumBxOcc_->Fill(itBX, itEtSum->hwPt());

      if (itBX == 0) {
        if (l1t::EtSum::EtSumType::kMissingEt == itEtSum->getType()) {
          ;  // MET
          stage2CaloLayer2METRank_->Fill(itEtSum->hwPt());
          stage2CaloLayer2METPhi_->Fill(itEtSum->hwPhi());
        } else if (l1t::EtSum::EtSumType::kMissingEtHF == itEtSum->getType()) {  // METHF
          stage2CaloLayer2METHFRank_->Fill(itEtSum->hwPt());
          stage2CaloLayer2METHFPhi_->Fill(itEtSum->hwPhi());
        } else if (l1t::EtSum::EtSumType::kTotalEt == itEtSum->getType()) {  // ETT
          stage2CaloLayer2ETTRank_->Fill(itEtSum->hwPt());
          //} else if(l1t::EtSum::EtSumType::kTotalEtHF == itEtSum->getType()){    // ETTHF
          // stage2CaloLayer2ETTHFRank_->Fill(itEtSum->hwPt());
        } else if (l1t::EtSum::EtSumType::kMissingHt == itEtSum->getType()) {  // MHT
          stage2CaloLayer2MHTRank_->Fill(itEtSum->hwPt());
          if (itEtSum->hwPt() > 0)
            stage2CaloLayer2MHTPhi_->Fill(itEtSum->hwPhi());
        } else if (l1t::EtSum::EtSumType::kMissingHtHF == itEtSum->getType()) {  // MHTHF
          stage2CaloLayer2MHTHFRank_->Fill(itEtSum->hwPt());
          if (itEtSum->hwPt() > 0)
            stage2CaloLayer2MHTHFPhi_->Fill(itEtSum->hwPhi());
        } else if (l1t::EtSum::EtSumType::kMinBiasHFP0 == itEtSum->getType()) {  // MBHFP0
          stage2CaloLayer2MinBiasHFP0_->Fill(itEtSum->hwPt());
        } else if (l1t::EtSum::EtSumType::kMinBiasHFM0 == itEtSum->getType()) {  // MBHFM0
          stage2CaloLayer2MinBiasHFM0_->Fill(itEtSum->hwPt());
        } else if (l1t::EtSum::EtSumType::kMinBiasHFP1 == itEtSum->getType()) {  // MBHFP1
          stage2CaloLayer2MinBiasHFP1_->Fill(itEtSum->hwPt());
        } else if (l1t::EtSum::EtSumType::kMinBiasHFM1 == itEtSum->getType()) {  // MBHFM1
          stage2CaloLayer2MinBiasHFM1_->Fill(itEtSum->hwPt());
          //} else if(l1t::EtSum::EtSumType::kTotalHtHF == itEtSum->getType()){    // HTTHF
          //stage2CaloLayer2HTTHFRank_->Fill(itEtSum->hwPt());
        } else if (l1t::EtSum::EtSumType::kTotalEtEm == itEtSum->getType()) {  // ETTEM
          stage2CaloLayer2ETTEMRank_->Fill(itEtSum->hwPt());
        } else if (l1t::EtSum::EtSumType::kTowerCount == itEtSum->getType()) {
          stage2CaloLayer2TowCount_->Fill(itEtSum->hwPt());
        } else if (l1t::EtSum::EtSumType::kTotalHt == itEtSum->getType()) {
          stage2CaloLayer2HTTRank_->Fill(itEtSum->hwPt());
        } else if (l1t::EtSum::EtSumType::kAsymEt == itEtSum->getType()) {  //Asym ET
          stage2CaloLayer2Asymmetry_->Fill(itEtSum->hwPt());
        } else if (l1t::EtSum::EtSumType::kCentrality == itEtSum->getType()) {  //Centrality
          if (itEtSum->hwPt() == 0)
            stage2CaloLayer2Centrality_->Fill(-1);
          else {
            for (int i = 0; i < 8; i++)
              if (((itEtSum->hwPt() >> i) & 1) == 1)
                stage2CaloLayer2Centrality_->Fill(i);
          }
        }
      }
    }
  }
}