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);
35 
36 private:
38 
40 
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)
PSMonitorClient(edm::ParameterSet const &)
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
std::string folder
Definition: config.py:1
static MEPSet getHistoPSet(edm::ParameterSet pset)
~PSMonitorClient() override=default
void check(DQMStore::IBooker &booker, DQMStore::IGetter &getter)
void dqmEndLuminosityBlock(DQMStore::IBooker &booker, DQMStore::IGetter &getter, edm::LuminosityBlock const &, edm::EventSetup const &) override
std::string name
void add(std::string const &label, ParameterSetDescription const &psetDescription)
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:673
HLT enums.
Log< level::Warning, false > LogWarning
void dqmEndJob(DQMStore::IBooker &booker, DQMStore::IGetter &getter) override
std::string m_dqm_path
static void fillMePSetDescription(edm::ParameterSetDescription &pset)