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

dqmoffline::l1t::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
dqmoffline::l1t::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 dqmoffline::l1t::L1TEfficiencyPlotHandler::book ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter 
)

Definition at line 41 of file L1TEfficiencyHarvesting.cc.

References DQMStore::IBooker::book1D(), DQMStore::IBooker::book2D(), denominatorDir_, denominatorSuffix_, MonitorElement::DQM_KIND_TH1D, MonitorElement::DQM_KIND_TH1F, MonitorElement::DQM_KIND_TH2D, MonitorElement::DQM_KIND_TH2F, DQMStore::IGetter::get(), MonitorElement::getTH1(), MonitorElement::getTH1F(), MonitorElement::getTH2F(), h_efficiency_, fastTrackerRecHitType::is2D(), callgraph::kind, MonitorElement::kind(), pileupDistInMC::num, numeratorDir_, numeratorSuffix_, outputDir_, plotName_, DQMStore::IBooker::setCurrentFolder(), MonitorElement::setEfficiencyFlag(), 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::LogWarning("L1TEfficiencyPlotHandler")
55  << (!num && !den ? numeratorName + " && " + denominatorName : !num ? numeratorName : denominatorName)
56  << " not gettable. Quitting booking" << endl;
57  return;
58  }
59 
60  TH1 *numH = num->getTH1();
61  TH1 *denH = den->getTH1();
62 
63  if (!numH || !denH) {
64 
65  edm::LogWarning("L1TEfficiencyPlotHandler")
66  << (!numH && !denH ? numeratorName + " && " + denominatorName : !num ? numeratorName : denominatorName)
67  << " is not TH1F. Quitting booking" << endl;
68 
69  return;
70 
71  }
72 
73  if (numH->GetNbinsX() != denH->GetNbinsX()) {
75  "L1TEfficiencyPlotHandler") << " # X bins in " <<
76  numeratorName << " and " << denominatorName <<
77  " are different. Quitting booking" << endl;
78  return;
79  }
80 
82  bool is1D = kind == MonitorElement::DQM_KIND_TH1F ||
84  bool is2D = kind == MonitorElement::DQM_KIND_TH2F ||
86 
87  if (is2D) {
88  if (numH->GetNbinsY() != denH->GetNbinsY()) {
90  "L1TEfficiencyPlotHandler") << " # Y bins in " << numeratorName <<
91  " and " << denominatorName << " are different. Quitting booking" <<
92  endl;
93  return;
94  }
95  }
96 
98  if (is1D) {
99  h_efficiency_ = ibooker.book1D(plotName_, den->getTH1F());
100  }
101  else if (is2D) {
102  h_efficiency_ = ibooker.book2D(plotName_, den->getTH2F());
103  }
105 }
TH1F * getTH1F() const
TH1 * getTH1() const
void setEfficiencyFlag()
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
bool is2D(HitType hitType)
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
TH2F * getTH2F() const
MonitorElement * get(std::string const &path)
Definition: DQMStore.cc:303
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:109
Kind kind() const
Get the type of the monitor element.
void dqmoffline::l1t::L1TEfficiencyPlotHandler::computeEfficiency ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter 
)

Definition at line 107 of file L1TEfficiencyHarvesting.cc.

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

Referenced by ~L1TEfficiencyPlotHandler().

108 {
109  if (!h_efficiency_)
110  return;
111 
112  edm::LogInfo("L1TEfficiencyPlotHandler") << " Computing efficiency for " << plotName_ << endl;
113 
116 
117  TH1 *numH = num->getTH1();
118  TH1 *denH = den->getTH1();
119  TH1 *effH = h_efficiency_->getTH1();
120 
121  effH->Divide(numH, denH, 1.0, 1.0, "B");
122 }
TH1 * getTH1() const
MonitorElement * get(std::string const &path)
Definition: DQMStore.cc:303

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().