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
23 
24 struct MEPSet {
27 };
28 
30 public:
31  explicit PSMonitorClient(edm::ParameterSet const &);
32  ~PSMonitorClient() override = default;
33 
34  static void fillDescriptions(edm::ConfigurationDescriptions & descriptions);
35  static void fillMePSetDescription(edm::ParameterSetDescription & pset);
36 
37 private:
38 
39  static MEPSet getHistoPSet(edm::ParameterSet pset);
40 
42 
43  void dqmEndLuminosityBlock(DQMStore::IBooker & booker, DQMStore::IGetter & getter, edm::LuminosityBlock const &, edm::EventSetup const&) override;
44  void dqmEndJob(DQMStore::IBooker & booker, DQMStore::IGetter & getter) override;
45 
46  void check(DQMStore::IBooker & booker, DQMStore::IGetter & getter);
47 
49 };
50 
51 
53  m_dqm_path( config.getUntrackedParameter<std::string>( "dqmPath" ) )
54  , psColumnVSlumiPSet ( getHistoPSet(config.getParameter<edm::ParameterSet>("me")) )
55 {
56 }
57 
59 {
60  return MEPSet{
61  pset.getParameter<std::string>("name"),
62  pset.getParameter<std::string>("folder"),
63  };
64 }
65 
67 {
68  pset.add<std::string>("folder","HLT/PSMonitoring");
69  pset.add<std::string>("name","psColumnVSlumi");
70 }
71 
72 
73 void
75 {
76  check(booker, getter);
77 }
78 
79 void
81 {
82  check(booker, getter);
83 }
84 
86 void
88 {
89 
92 
93  getter.setCurrentFolder(folder);
94  MonitorElement* psColumnVSlumi = getter.get(psColumnVSlumiPSet.folder+"/"+psColumnVSlumiPSet.name);
95  // if no ME available, return
96  if ( !psColumnVSlumi ) {
97  edm::LogWarning("PSMonitorClient") << "no " << psColumnVSlumiPSet.name << " ME is available in " << psColumnVSlumiPSet.folder << std::endl;
98  return;
99  }
100 
101  /*
102  TH2F* h = psColumnVSlumi->getTH2F();
103  size_t nbinsX = psColumnVSlumi->getNbinsX();
104  size_t nbinsY = psColumnVSlumi->getNbinsY();
105 
106  for ( size_t ibinY=1; ibinY < nbinsY; ++ibinY )
107  std::cout << h->GetXaxis()->GetBinLabel(ibinY) << std::endl;
108  for ( size_t ibinX=1; ibinX< nbinsX; ++ibinX )
109  if ( psColumnVSlumi->getBinContent(ibinX) )
110  std::cout << "ibinX: " << psColumnVSlumi->getBinContent(ibinX) << std::endl;
111  */
112 
113 }
114 
115 void
117  // The following says we do not know what parameters are allowed so do no validation
118  // Please change this to state exactly what you do use, even if it is no parameters
120  desc.addUntracked<std::string>( "dqmPath", "HLT/PSMonitoring");
121 
123  fillMePSetDescription(mePSet);
124  desc.add<edm::ParameterSetDescription>("me", mePSet);
125 
126  descriptions.add("psMonitorClient", desc);
127 }
128 
129 //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)
MonitorElement * get(const std::string &path)
Definition: DQMStore.cc:302
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
std::string folder
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:1
Definition: config.py:1
static MEPSet getHistoPSet(edm::ParameterSet pset)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
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
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:344
HLT enums.
void dqmEndJob(DQMStore::IBooker &booker, DQMStore::IGetter &getter) override
def check(config)
Definition: trackerTree.py:14
std::string m_dqm_path
static void fillMePSetDescription(edm::ParameterSetDescription &pset)