File indexing completed on 2024-04-06 12:10:00
0001 #include "DQMOffline/Trigger/plugins/TriggerDQMBase.h"
0002
0003 void TriggerDQMBase::setMETitle(ObjME& me, const std::string& titleX, const std::string& titleY) {
0004 if (me.numerator) {
0005 me.numerator->setAxisTitle(titleX, 1);
0006 me.numerator->setAxisTitle(titleY, 2);
0007 }
0008
0009 if (me.denominator) {
0010 me.denominator->setAxisTitle(titleX, 1);
0011 me.denominator->setAxisTitle(titleY, 2);
0012 }
0013 }
0014
0015 void TriggerDQMBase::bookME(DQMStore::IBooker& ibooker,
0016 ObjME& me,
0017 const std::string& histname,
0018 const std::string& histtitle,
0019 const uint nbins,
0020 const double min,
0021 const double max,
0022 const bool bookDen) {
0023 me.numerator = ibooker.book1D(histname + "_numerator", histtitle + " (numerator)", nbins, min, max);
0024
0025 if (bookDen) {
0026 me.denominator = ibooker.book1D(histname + "_denominator", histtitle + " (denominator)", nbins, min, max);
0027 }
0028 }
0029
0030 void TriggerDQMBase::bookME(DQMStore::IBooker& ibooker,
0031 ObjME& me,
0032 const std::string& histname,
0033 const std::string& histtitle,
0034 const std::vector<double>& binning,
0035 const bool bookDen) {
0036 uint nbins = binning.size() - 1;
0037 std::vector<float> fbinning(binning.begin(), binning.end());
0038 float* arr = &fbinning[0];
0039
0040 me.numerator = ibooker.book1D(histname + "_numerator", histtitle + " (numerator)", nbins, arr);
0041
0042 if (bookDen) {
0043 me.denominator = ibooker.book1D(histname + "_denominator", histtitle + " (denominator)", nbins, arr);
0044 }
0045 }
0046
0047 void TriggerDQMBase::bookME(DQMStore::IBooker& ibooker,
0048 ObjME& me,
0049 const std::string& histname,
0050 const std::string& histtitle,
0051 const uint nbinsX,
0052 const double xmin,
0053 const double xmax,
0054 const double ymin,
0055 const double ymax,
0056 const bool bookDen) {
0057 me.numerator =
0058 ibooker.bookProfile(histname + "_numerator", histtitle + " (numerator)", nbinsX, xmin, xmax, ymin, ymax);
0059
0060 if (bookDen) {
0061 me.denominator =
0062 ibooker.bookProfile(histname + "_denominator", histtitle + " (denominator)", nbinsX, xmin, xmax, ymin, ymax);
0063 }
0064 }
0065
0066 void TriggerDQMBase::bookME(DQMStore::IBooker& ibooker,
0067 ObjME& me,
0068 const std::string& histname,
0069 const std::string& histtitle,
0070 const uint nbinsX,
0071 const double xmin,
0072 const double xmax,
0073 const uint nbinsY,
0074 const double ymin,
0075 const double ymax,
0076 const bool bookDen) {
0077 me.numerator =
0078 ibooker.book2D(histname + "_numerator", histtitle + " (numerator)", nbinsX, xmin, xmax, nbinsY, ymin, ymax);
0079
0080 if (bookDen) {
0081 me.denominator =
0082 ibooker.book2D(histname + "_denominator", histtitle + " (denominator)", nbinsX, xmin, xmax, nbinsY, ymin, ymax);
0083 }
0084 }
0085
0086 void TriggerDQMBase::bookME(DQMStore::IBooker& ibooker,
0087 ObjME& me,
0088 const std::string& histname,
0089 const std::string& histtitle,
0090 const std::vector<double>& binningX,
0091 const std::vector<double>& binningY,
0092 const bool bookDen) {
0093 uint nbinsX = binningX.size() - 1;
0094 std::vector<float> fbinningX(binningX.begin(), binningX.end());
0095 float* arrX = &fbinningX[0];
0096 uint nbinsY = binningY.size() - 1;
0097 std::vector<float> fbinningY(binningY.begin(), binningY.end());
0098 float* arrY = &fbinningY[0];
0099
0100 me.numerator = ibooker.book2D(histname + "_numerator", histtitle + " (numerator)", nbinsX, arrX, nbinsY, arrY);
0101
0102 if (bookDen) {
0103 me.denominator =
0104 ibooker.book2D(histname + "_denominator", histtitle + " (denominator)", nbinsX, arrX, nbinsY, arrY);
0105 }
0106 }
0107
0108 void TriggerDQMBase::fillHistoPSetDescription(edm::ParameterSetDescription& pset) {
0109 pset.add<uint>("nbins");
0110 pset.add<double>("xmin");
0111 pset.add<double>("xmax");
0112 }
0113
0114 void TriggerDQMBase::fillHistoLSPSetDescription(edm::ParameterSetDescription& pset) {
0115 pset.add<uint>("nbins", 2500);
0116 pset.add<double>("xmin", 0.);
0117 pset.add<double>("xmax", 2500.);
0118 }
0119
0120 TriggerDQMBase::MEbinning TriggerDQMBase::getHistoPSet(const edm::ParameterSet& pset) {
0121 return TriggerDQMBase::MEbinning{
0122 pset.getParameter<uint32_t>("nbins"), pset.getParameter<double>("xmin"), pset.getParameter<double>("xmax")};
0123 }
0124
0125 TriggerDQMBase::MEbinning TriggerDQMBase::getHistoLSPSet(const edm::ParameterSet& pset) {
0126 return TriggerDQMBase::MEbinning{
0127 pset.getParameter<uint32_t>("nbins"), 0., double(pset.getParameter<uint32_t>("nbins"))};
0128 }