CMS 3D CMS Logo

PSMonitorClient.cc
Go to the documentation of this file.
1 // C++ headers
2 #include <string>
3 #include <cstring>
4 
5 // boost headers
6 #include <boost/regex.hpp>
7 
8 // Root headers
9 #include <TH1F.h>
10 
11 // CMSSW headers
22 
23 struct MEPSet {
26 };
27 
29 public:
30  explicit PSMonitorClient(edm::ParameterSet const &);
31  ~PSMonitorClient() override = default;
32 
33  static void fillDescriptions(edm::ConfigurationDescriptions &descriptions);
34  static void fillMePSetDescription(edm::ParameterSetDescription &pset);
35 
36 private:
37  static MEPSet getHistoPSet(edm::ParameterSet pset);
38 
40 
41  void dqmEndLuminosityBlock(DQMStore::IBooker &booker,
42  DQMStore::IGetter &getter,
43  edm::LuminosityBlock const &,
44  edm::EventSetup const &) override;
45  void dqmEndJob(DQMStore::IBooker &booker, DQMStore::IGetter &getter) override;
46 
47  void check(DQMStore::IBooker &booker, DQMStore::IGetter &getter);
48 
50 };
51 
53  : m_dqm_path(config.getUntrackedParameter<std::string>("dqmPath")),
54  psColumnVSlumiPSet(getHistoPSet(config.getParameter<edm::ParameterSet>("me"))) {}
55 
57  return MEPSet{
58  pset.getParameter<std::string>("name"),
59  pset.getParameter<std::string>("folder"),
60  };
61 }
62 
64  pset.add<std::string>("folder", "HLT/PSMonitoring");
65  pset.add<std::string>("name", "psColumnVSlumi");
66 }
67 
68 void PSMonitorClient::dqmEndJob(DQMStore::IBooker &booker, DQMStore::IGetter &getter) { check(booker, getter); }
69 
71  DQMStore::IGetter &getter,
73  edm::EventSetup const &setup) {
74  check(booker, getter);
75 }
76 
81 
82  getter.setCurrentFolder(folder);
83  MonitorElement *psColumnVSlumi = getter.get(psColumnVSlumiPSet.folder + "/" + psColumnVSlumiPSet.name);
84  // if no ME available, return
85  if (!psColumnVSlumi) {
86  edm::LogWarning("PSMonitorClient") << "no " << psColumnVSlumiPSet.name << " ME is available in "
87  << psColumnVSlumiPSet.folder << std::endl;
88  return;
89  }
90 
91  /*
92  TH2F* h = psColumnVSlumi->getTH2F();
93  size_t nbinsX = psColumnVSlumi->getNbinsX();
94  size_t nbinsY = psColumnVSlumi->getNbinsY();
95 
96  for ( size_t ibinY=1; ibinY < nbinsY; ++ibinY )
97  std::cout << h->GetXaxis()->GetBinLabel(ibinY) << std::endl;
98  for ( size_t ibinX=1; ibinX< nbinsX; ++ibinX )
99  if ( psColumnVSlumi->getBinContent(ibinX) )
100  std::cout << "ibinX: " << psColumnVSlumi->getBinContent(ibinX) << std::endl;
101  */
102 }
103 
105  // The following says we do not know what parameters are allowed so do no validation
106  // Please change this to state exactly what you do use, even if it is no parameters
108  desc.addUntracked<std::string>("dqmPath", "HLT/PSMonitoring");
109 
111  fillMePSetDescription(mePSet);
112  desc.add<edm::ParameterSetDescription>("me", mePSet);
113 
114  descriptions.add("psMonitorClient", desc);
115 }
116 
117 //define this as a plug-in
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
T getParameter(std::string const &) const
PSMonitorClient(edm::ParameterSet const &)
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
std::string folder
Definition: config.py:1
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
static MEPSet getHistoPSet(edm::ParameterSet pset)
void check(DQMStore::IBooker &booker, DQMStore::IGetter &getter)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void dqmEndLuminosityBlock(DQMStore::IBooker &booker, DQMStore::IGetter &getter, edm::LuminosityBlock const &, edm::EventSetup const &) override
std::string name
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
HLT enums.
void dqmEndJob(DQMStore::IBooker &booker, DQMStore::IGetter &getter) override
MonitorElement * get(std::string const &path)
Definition: DQMStore.cc:437
std::string m_dqm_path
static void fillMePSetDescription(edm::ParameterSetDescription &pset)
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:424