CMS 3D CMS Logo

DQMExample_Step2.cc
Go to the documentation of this file.
3 
4 #include <cmath>
5 #include <cstdio>
6 #include <iomanip>
7 #include <iostream>
8 #include <sstream>
9 #include <string>
10 
11 //
12 // -------------------------------------- Constructor
13 // --------------------------------------------
14 //
16  edm::LogInfo("DQMExample_Step2") << "Constructor DQMExample_Step2::DQMExample_Step2 " << std::endl;
17 
18  // Get parameters from configuration file
19  numMonitorName_ = ps.getParameter<std::string>("numMonitorName");
20  denMonitorName_ = ps.getParameter<std::string>("denMonitorName");
21 }
22 
23 //
24 // -- Destructor
25 //
27  edm::LogInfo("DQMExample_Step2") << "Destructor DQMExample_Step2::~DQMExample_Step2 " << std::endl;
28 }
29 
30 //
31 // -------------------------------------- beginJob
32 // --------------------------------------------
33 //
34 void DQMExample_Step2::beginJob() { edm::LogInfo("DQMExample_Step2") << "DQMExample_Step2::beginJob " << std::endl; }
35 //
36 // -------------------------------------- get and book in the endJob
37 // --------------------------------------------
38 //
40  // create and cd into new folder
41  ibooker_.setCurrentFolder("What_I_do_in_the_client/Ratio");
42 
43  // get available histograms
46 
47  if (!numerator || !denominator) {
48  edm::LogError("DQMExample_Step2") << "MEs not found!" << std::endl;
49  return;
50  }
51 
52  // book new histogram
53  h_ptRatio = ibooker_.book1D("ptRatio", "pt ratio pf matched objects", 50, 0., 100.);
54  h_ptRatio->setAxisTitle("pt [GeV]");
55 
56  for (int iBin = 1; iBin < numerator->getNbinsX(); ++iBin) {
57  if (denominator->getBinContent(iBin) == 0)
58  h_ptRatio->setBinContent(iBin, 0.);
59  else
60  h_ptRatio->setBinContent(iBin, numerator->getBinContent(iBin) / denominator->getBinContent(iBin));
61  }
62 }
63 
64 //
65 // -------------------------------------- get in the endLumi if needed
66 // --------------------------------------------
67 //
69  DQMStore::IGetter &igetter_,
71  edm::EventSetup const &iSetup) {
72  edm::LogInfo("DQMExample_Step2") << "DQMExample_Step2::endLumi " << std::endl;
73 }
MessageLogger.h
DQMExample_Step2::~DQMExample_Step2
~DQMExample_Step2() override
Definition: DQMExample_Step2.cc:26
edm::LuminosityBlock
Definition: LuminosityBlock.h:50
edm::LogInfo
Definition: MessageLogger.h:254
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
dqm::legacy::MonitorElement
Definition: MonitorElement.h:461
DQMExample_Step2::DQMExample_Step2
DQMExample_Step2(const edm::ParameterSet &ps)
Definition: DQMExample_Step2.cc:15
DQMExample_Step2::numMonitorName_
std::string numMonitorName_
Definition: DQMExample_Step2.h:31
DQMExample_Step2::beginJob
void beginJob() override
Definition: DQMExample_Step2.cc:34
DQMExample_Step2::dqmEndLuminosityBlock
void dqmEndLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &) override
Definition: DQMExample_Step2.cc:68
DQMExample_Step2::denMonitorName_
std::string denMonitorName_
Definition: DQMExample_Step2.h:32
DQMExample_Step2.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
es_hardcode_cfi.iLumi
iLumi
Definition: es_hardcode_cfi.py:206
edm::ParameterSet
Definition: ParameterSet.h:36
edm::LogError
Definition: MessageLogger.h:183
HLTTauDQMOffline_cfi.numerator
numerator
Definition: HLTTauDQMOffline_cfi.py:194
edm::EventSetup
Definition: EventSetup.h:57
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
HLTTauDQMOffline_cfi.denominator
denominator
Definition: HLTTauDQMOffline_cfi.py:195
dqm::impl::MonitorElement::setBinContent
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
Definition: MonitorElement.cc:691
DQMExample_Step2::h_ptRatio
MonitorElement * h_ptRatio
Definition: DQMExample_Step2.h:35
dqm::implementation::IGetter
Definition: DQMStore.h:484
dqm::implementation::IGetter::get
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:651
dqm::implementation::IBooker
Definition: DQMStore.h:43
DQMExample_Step2::dqmEndJob
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
Definition: DQMExample_Step2.cc:39
dqm::impl::MonitorElement::setAxisTitle
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
Definition: MonitorElement.cc:800
dqm::implementation::IBooker::book1D
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98