File indexing completed on 2024-04-06 12:10:00
0001 #ifndef DQMOffline_Trigger_TriggerDQMBase_h
0002 #define DQMOffline_Trigger_TriggerDQMBase_h
0003
0004 #include "DQMServices/Core/interface/DQMStore.h"
0005 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0006 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0007
0008 class TriggerDQMBase {
0009 public:
0010 typedef dqm::legacy::MonitorElement MonitorElement;
0011 typedef dqm::legacy::DQMStore DQMStore;
0012
0013 TriggerDQMBase() = default;
0014 virtual ~TriggerDQMBase() = default;
0015
0016 struct MEbinning {
0017 uint nbins;
0018 double xmin;
0019 double xmax;
0020 };
0021
0022 class ObjME {
0023 public:
0024 ObjME() {}
0025 virtual ~ObjME() {}
0026
0027 MonitorElement* numerator = nullptr;
0028 MonitorElement* denominator = nullptr;
0029
0030 template <typename... Args>
0031 void fill(const bool pass_num, Args... args);
0032 };
0033
0034 void setMETitle(ObjME& me, const std::string& titleX, const std::string& titleY);
0035
0036 void bookME(DQMStore::IBooker&,
0037 ObjME& me,
0038 const std::string& histname,
0039 const std::string& histtitle,
0040 const uint nbins,
0041 const double xmin,
0042 const double xmax,
0043 const bool bookDen = true);
0044 void bookME(DQMStore::IBooker&,
0045 ObjME& me,
0046 const std::string& histname,
0047 const std::string& histtitle,
0048 const std::vector<double>& binningX,
0049 const bool bookDen = true);
0050 void bookME(DQMStore::IBooker&,
0051 ObjME& me,
0052 const std::string& histname,
0053 const std::string& histtitle,
0054 const uint nbinsX,
0055 const double xmin,
0056 const double xmax,
0057 const double ymin,
0058 const double ymax,
0059 const bool bookDen = true);
0060 void bookME(DQMStore::IBooker&,
0061 ObjME& me,
0062 const std::string& histname,
0063 const std::string& histtitle,
0064 const uint nbinsX,
0065 const double xmin,
0066 const double xmax,
0067 const uint nbinsY,
0068 const double ymin,
0069 const double ymax,
0070 const bool bookDen = true);
0071 void bookME(DQMStore::IBooker&,
0072 ObjME& me,
0073 const std::string& histname,
0074 const std::string& histtitle,
0075 const std::vector<double>& binningX,
0076 const std::vector<double>& binningY,
0077 const bool bookDen = true);
0078
0079 static void fillHistoPSetDescription(edm::ParameterSetDescription& pset);
0080 static void fillHistoLSPSetDescription(edm::ParameterSetDescription& pset);
0081
0082 static MEbinning getHistoPSet(const edm::ParameterSet& pset);
0083 static MEbinning getHistoLSPSet(const edm::ParameterSet& pset);
0084 };
0085
0086 template <typename... Args>
0087 void TriggerDQMBase::ObjME::fill(const bool fill_num, Args... args) {
0088 if (denominator) {
0089 denominator->Fill(args...);
0090 }
0091
0092 if (fill_num and numerator) {
0093 numerator->Fill(args...);
0094 }
0095 }
0096
0097 #endif