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
#include "DQMOffline/Trigger/plugins/METDQM.h"

METDQM::METDQM() = default;

METDQM::~METDQM() = default;

void METDQM::initialise(const edm::ParameterSet& iConfig) {
  met_variable_binning_ =
      iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<std::vector<double> >("metBinning");
  met_binning_ =
      getHistoPSet(iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<edm::ParameterSet>("metPSet"));
  phi_binning_ =
      getHistoPSet(iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<edm::ParameterSet>("phiPSet"));
  ls_binning_ =
      getHistoPSet(iConfig.getParameter<edm::ParameterSet>("histoPSet").getParameter<edm::ParameterSet>("lsPSet"));
}

void METDQM::bookHistograms(DQMStore::IBooker& ibooker) {
  std::string histname, histtitle;

  histname = "met";
  histtitle = "PFMET";
  bookME(ibooker, metME_, histname, histtitle, met_binning_.nbins, met_binning_.xmin, met_binning_.xmax);
  setMETitle(metME_, "PF MET [GeV]", "events / [GeV]");

  histname = "met_variable";
  histtitle = "PFMET";
  bookME(ibooker, metME_variableBinning_, histname, histtitle, met_variable_binning_);
  setMETitle(metME_variableBinning_, "PF MET [GeV]", "events / [GeV]");

  histname = "metVsLS";
  histtitle = "PFMET vs LS";
  bookME(ibooker,
         metVsLS_,
         histname,
         histtitle,
         ls_binning_.nbins,
         ls_binning_.xmin,
         ls_binning_.xmax,
         met_binning_.xmin,
         met_binning_.xmax);
  setMETitle(metVsLS_, "LS", "PF MET [GeV]");

  histname = "metPhi";
  histtitle = "PFMET phi";
  bookME(ibooker, metPhiME_, histname, histtitle, phi_binning_.nbins, phi_binning_.xmin, phi_binning_.xmax);
  setMETitle(metPhiME_, "PF MET #phi", "events / 0.1 rad");
}

void METDQM::fillHistograms(const double& met, const double& phi, const int& ls, const bool passCond) {
  // filling histograms (denominator)
  metME_.denominator->Fill(met);
  metME_variableBinning_.denominator->Fill(met);
  metPhiME_.denominator->Fill(phi);

  metVsLS_.denominator->Fill(ls, met);

  // applying selection for numerator
  if (passCond) {
    // filling histograms (num_genTriggerEventFlag_)
    metME_.numerator->Fill(met);
    metME_variableBinning_.numerator->Fill(met);
    metPhiME_.numerator->Fill(phi);
    metVsLS_.numerator->Fill(ls, met);
  }
}

void METDQM::fillMetDescription(edm::ParameterSetDescription& histoPSet) {
  edm::ParameterSetDescription metPSet;
  fillHistoPSetDescription(metPSet);
  histoPSet.add<edm::ParameterSetDescription>("metPSet", metPSet);

  std::vector<double> bins = {0.,   20.,  40.,  60.,  80.,  90.,  100., 110., 120., 130., 140., 150., 160.,
                              170., 180., 190., 200., 220., 240., 260., 280., 300., 350., 400., 450., 1000.};
  histoPSet.add<std::vector<double> >("metBinning", bins);

  edm::ParameterSetDescription phiPSet;
  fillHistoPSetDescription(phiPSet);
  histoPSet.add<edm::ParameterSetDescription>("phiPSet", phiPSet);

  edm::ParameterSetDescription lsPSet;
  fillHistoLSPSetDescription(lsPSet);
  histoPSet.add<edm::ParameterSetDescription>("lsPSet", lsPSet);
}