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

void TriggerDQMBase::setMETitle(ObjME& me, const std::string& titleX, const std::string& titleY) {
  if (me.numerator) {
    me.numerator->setAxisTitle(titleX, 1);
    me.numerator->setAxisTitle(titleY, 2);
  }

  if (me.denominator) {
    me.denominator->setAxisTitle(titleX, 1);
    me.denominator->setAxisTitle(titleY, 2);
  }
}

void TriggerDQMBase::bookME(DQMStore::IBooker& ibooker,
                            ObjME& me,
                            const std::string& histname,
                            const std::string& histtitle,
                            const uint nbins,
                            const double min,
                            const double max,
                            const bool bookDen) {
  me.numerator = ibooker.book1D(histname + "_numerator", histtitle + " (numerator)", nbins, min, max);

  if (bookDen) {
    me.denominator = ibooker.book1D(histname + "_denominator", histtitle + " (denominator)", nbins, min, max);
  }
}

void TriggerDQMBase::bookME(DQMStore::IBooker& ibooker,
                            ObjME& me,
                            const std::string& histname,
                            const std::string& histtitle,
                            const std::vector<double>& binning,
                            const bool bookDen) {
  uint nbins = binning.size() - 1;
  std::vector<float> fbinning(binning.begin(), binning.end());
  float* arr = &fbinning[0];

  me.numerator = ibooker.book1D(histname + "_numerator", histtitle + " (numerator)", nbins, arr);

  if (bookDen) {
    me.denominator = ibooker.book1D(histname + "_denominator", histtitle + " (denominator)", nbins, arr);
  }
}

void TriggerDQMBase::bookME(DQMStore::IBooker& ibooker,
                            ObjME& me,
                            const std::string& histname,
                            const std::string& histtitle,
                            const uint nbinsX,
                            const double xmin,
                            const double xmax,
                            const double ymin,
                            const double ymax,
                            const bool bookDen) {
  me.numerator =
      ibooker.bookProfile(histname + "_numerator", histtitle + " (numerator)", nbinsX, xmin, xmax, ymin, ymax);

  if (bookDen) {
    me.denominator =
        ibooker.bookProfile(histname + "_denominator", histtitle + " (denominator)", nbinsX, xmin, xmax, ymin, ymax);
  }
}

void TriggerDQMBase::bookME(DQMStore::IBooker& ibooker,
                            ObjME& me,
                            const std::string& histname,
                            const std::string& histtitle,
                            const uint nbinsX,
                            const double xmin,
                            const double xmax,
                            const uint nbinsY,
                            const double ymin,
                            const double ymax,
                            const bool bookDen) {
  me.numerator =
      ibooker.book2D(histname + "_numerator", histtitle + " (numerator)", nbinsX, xmin, xmax, nbinsY, ymin, ymax);

  if (bookDen) {
    me.denominator =
        ibooker.book2D(histname + "_denominator", histtitle + " (denominator)", nbinsX, xmin, xmax, nbinsY, ymin, ymax);
  }
}

void TriggerDQMBase::bookME(DQMStore::IBooker& ibooker,
                            ObjME& me,
                            const std::string& histname,
                            const std::string& histtitle,
                            const std::vector<double>& binningX,
                            const std::vector<double>& binningY,
                            const bool bookDen) {
  uint nbinsX = binningX.size() - 1;
  std::vector<float> fbinningX(binningX.begin(), binningX.end());
  float* arrX = &fbinningX[0];
  uint nbinsY = binningY.size() - 1;
  std::vector<float> fbinningY(binningY.begin(), binningY.end());
  float* arrY = &fbinningY[0];

  me.numerator = ibooker.book2D(histname + "_numerator", histtitle + " (numerator)", nbinsX, arrX, nbinsY, arrY);

  if (bookDen) {
    me.denominator =
        ibooker.book2D(histname + "_denominator", histtitle + " (denominator)", nbinsX, arrX, nbinsY, arrY);
  }
}

void TriggerDQMBase::fillHistoPSetDescription(edm::ParameterSetDescription& pset) {
  pset.add<uint>("nbins");
  pset.add<double>("xmin");
  pset.add<double>("xmax");
}

void TriggerDQMBase::fillHistoLSPSetDescription(edm::ParameterSetDescription& pset) {
  pset.add<uint>("nbins", 2500);
  pset.add<double>("xmin", 0.);
  pset.add<double>("xmax", 2500.);
}

TriggerDQMBase::MEbinning TriggerDQMBase::getHistoPSet(const edm::ParameterSet& pset) {
  return TriggerDQMBase::MEbinning{
      pset.getParameter<uint32_t>("nbins"), pset.getParameter<double>("xmin"), pset.getParameter<double>("xmax")};
}

TriggerDQMBase::MEbinning TriggerDQMBase::getHistoLSPSet(const edm::ParameterSet& pset) {
  return TriggerDQMBase::MEbinning{
      pset.getParameter<uint32_t>("nbins"), 0., double(pset.getParameter<uint32_t>("nbins"))};
}