CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
dqmoffline::l1t::L1TEfficiencyPlotHandler Class Reference

#include <L1TEfficiencyHarvesting.h>

Public Member Functions

void book (DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
 
void computeEfficiency (DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
 
 L1TEfficiencyPlotHandler (const edm::ParameterSet &ps, std::string plotName)
 
 L1TEfficiencyPlotHandler (const L1TEfficiencyPlotHandler &handler)
 
 ~L1TEfficiencyPlotHandler ()
 

Private Attributes

std::string denominatorDir_
 
std::string denominatorSuffix_
 
MonitorElementh_efficiency_
 
std::string numeratorDir_
 
std::string numeratorSuffix_
 
std::string outputDir_
 
std::string plotName_
 

Detailed Description

Definition at line 36 of file L1TEfficiencyHarvesting.h.

Constructor & Destructor Documentation

L1TEfficiencyPlotHandler::L1TEfficiencyPlotHandler ( const edm::ParameterSet ps,
std::string  plotName 
)

Definition at line 17 of file L1TEfficiencyHarvesting.cc.

17  :
18  numeratorDir_(ps.getUntrackedParameter < std::string > ("numeratorDir")),
21  plotName_(plotName),
22  numeratorSuffix_(ps.getUntrackedParameter < std::string > ("numeratorSuffix", "Num")),
23  denominatorSuffix_(ps.getUntrackedParameter < std::string > ("denominatorSuffix", "Den")),
25 {
26 
27 }
T getUntrackedParameter(std::string const &, T const &) const
L1TEfficiencyPlotHandler::L1TEfficiencyPlotHandler ( const L1TEfficiencyPlotHandler handler)

Definition at line 29 of file L1TEfficiencyHarvesting.cc.

29  :
30  numeratorDir_(handler.numeratorDir_),
31  denominatorDir_(handler.denominatorDir_),
32  outputDir_(handler.outputDir_),
33  plotName_(handler.plotName_),
34  numeratorSuffix_(handler.numeratorSuffix_),
35  denominatorSuffix_(handler.denominatorSuffix_),
36  h_efficiency_(handler.h_efficiency_)
37 {
38 
39 }
dqmoffline::l1t::L1TEfficiencyPlotHandler::~L1TEfficiencyPlotHandler ( )
inline

Definition at line 44 of file L1TEfficiencyHarvesting.h.

References book(), and computeEfficiency().

45  {
46  }

Member Function Documentation

void L1TEfficiencyPlotHandler::book ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter 
)

Definition at line 41 of file L1TEfficiencyHarvesting.cc.

References DQMStore::IBooker::book1D(), denominatorDir_, denominatorSuffix_, DQMStore::IGetter::get(), MonitorElement::getTH1F(), h_efficiency_, hpstanc_transforms::max, min(), pileupDistInMC::num, numeratorDir_, numeratorSuffix_, outputDir_, plotName_, DQMStore::IBooker::setCurrentFolder(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by ~L1TEfficiencyPlotHandler().

42 {
43 
44  edm::LogInfo("L1TEfficiencyPlotHandler") << "Booking efficiency histogram for " << outputDir_ << " and " << plotName_
45  << endl;
46 
47  std::string numeratorName = numeratorDir_ + "/" + plotName_ + numeratorSuffix_;
48  std::string denominatorName = denominatorDir_ + "/" + plotName_ + denominatorSuffix_;
49  MonitorElement *num = igetter.get(numeratorName);
50  MonitorElement *den = igetter.get(denominatorName);
51 
52  if (!num || !den) {
53 
54  edm::LogError("L1TEfficiencyPlotHandler")
55  << (!num && !den ? numeratorName + " && " + denominatorName : !num ? numeratorName : denominatorName)
56  << " not gettable. Quitting booking" << endl;
57  return;
58  }
59 
60  TH1F *numH = num->getTH1F();
61  TH1F *denH = den->getTH1F();
62 
63  if (!numH || !denH) {
64 
65  edm::LogError("L1TEfficiencyPlotHandler")
66  << (!numH && !denH ? numeratorName + " && " + denominatorName : !num ? numeratorName : denominatorName)
67  << " is not TH1F. Quitting booking" << endl;
68 
69  return;
70 
71  }
72 
73  int nBinsNum = numH->GetNbinsX();
74  int nBinsDen = denH->GetNbinsX();
75 
76  if (nBinsNum != nBinsDen) {
77  edm::LogError("L1TEfficiencyPlotHandler") << " # bins in " << numeratorName << " and " << denominatorName
78  << " are different. Quitting booking" << endl;
79  return;
80  }
81 
82  double min = numH->GetXaxis()->GetXmin();
83  double max = numH->GetXaxis()->GetXmax();
84 
86  h_efficiency_ = ibooker.book1D(plotName_, plotName_, nBinsNum, min, max);
87 
88 }
MonitorElement * get(const std::string &path)
Definition: DQMStore.cc:305
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
T min(T a, T b)
Definition: MathUtil.h:58
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:277
TH1F * getTH1F(void) const
void L1TEfficiencyPlotHandler::computeEfficiency ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter 
)

Definition at line 90 of file L1TEfficiencyHarvesting.cc.

References denominatorDir_, denominatorSuffix_, DQMStore::IGetter::get(), MonitorElement::getTH1F(), h_efficiency_, pileupDistInMC::num, numeratorDir_, numeratorSuffix_, and plotName_.

Referenced by ~L1TEfficiencyPlotHandler().

91 {
92  if (!h_efficiency_)
93  return;
94 
95  edm::LogInfo("L1TEfficiencyPlotHandler") << " Computing efficiency for " << plotName_ << endl;
96 
99 
100  TH1F *numH = num->getTH1F();
101  TH1F *denH = den->getTH1F();
102 
103  numH->Sumw2();
104  denH->Sumw2();
105 
106  TH1F *effH = h_efficiency_->getTH1F();
107 
108  effH->Divide(numH, denH, 1.0, 1.0, "B");
109 }
MonitorElement * get(const std::string &path)
Definition: DQMStore.cc:305
TH1F * getTH1F(void) const

Member Data Documentation

std::string dqmoffline::l1t::L1TEfficiencyPlotHandler::denominatorDir_
private

Definition at line 58 of file L1TEfficiencyHarvesting.h.

Referenced by book(), and computeEfficiency().

std::string dqmoffline::l1t::L1TEfficiencyPlotHandler::denominatorSuffix_
private

Definition at line 62 of file L1TEfficiencyHarvesting.h.

Referenced by book(), and computeEfficiency().

MonitorElement* dqmoffline::l1t::L1TEfficiencyPlotHandler::h_efficiency_
private

Definition at line 64 of file L1TEfficiencyHarvesting.h.

Referenced by book(), and computeEfficiency().

std::string dqmoffline::l1t::L1TEfficiencyPlotHandler::numeratorDir_
private

Definition at line 57 of file L1TEfficiencyHarvesting.h.

Referenced by book(), and computeEfficiency().

std::string dqmoffline::l1t::L1TEfficiencyPlotHandler::numeratorSuffix_
private

Definition at line 61 of file L1TEfficiencyHarvesting.h.

Referenced by book(), and computeEfficiency().

std::string dqmoffline::l1t::L1TEfficiencyPlotHandler::outputDir_
private
std::string dqmoffline::l1t::L1TEfficiencyPlotHandler::plotName_
private

Definition at line 60 of file L1TEfficiencyHarvesting.h.

Referenced by book(), and computeEfficiency().