CMS 3D CMS Logo

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

#include <L1TEfficiencyHarvesting.h>

Public Types

typedef dqm::legacy::DQMStore DQMStore
 
typedef dqm::legacy::MonitorElement MonitorElement
 

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 35 of file L1TEfficiencyHarvesting.h.

Member Typedef Documentation

◆ DQMStore

Definition at line 37 of file L1TEfficiencyHarvesting.h.

◆ MonitorElement

Definition at line 38 of file L1TEfficiencyHarvesting.h.

Constructor & Destructor Documentation

◆ L1TEfficiencyPlotHandler() [1/2]

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

Definition at line 17 of file L1TEfficiencyHarvesting.cc.

18  : numeratorDir_(ps.getUntrackedParameter<std::string>("numeratorDir")),
22  numeratorSuffix_(ps.getUntrackedParameter<std::string>("numeratorSuffix", "Num")),
23  denominatorSuffix_(ps.getUntrackedParameter<std::string>("denominatorSuffix", "Den")),
24  h_efficiency_() {}
T getUntrackedParameter(std::string const &, T const &) const

◆ L1TEfficiencyPlotHandler() [2/2]

dqmoffline::l1t::L1TEfficiencyPlotHandler::L1TEfficiencyPlotHandler ( const L1TEfficiencyPlotHandler handler)

Definition at line 26 of file L1TEfficiencyHarvesting.cc.

27  : numeratorDir_(handler.numeratorDir_),
28  denominatorDir_(handler.denominatorDir_),
29  outputDir_(handler.outputDir_),
30  plotName_(handler.plotName_),
31  numeratorSuffix_(handler.numeratorSuffix_),
32  denominatorSuffix_(handler.denominatorSuffix_),
33  h_efficiency_(handler.h_efficiency_) {}

◆ ~L1TEfficiencyPlotHandler()

dqmoffline::l1t::L1TEfficiencyPlotHandler::~L1TEfficiencyPlotHandler ( )
inline

Definition at line 44 of file L1TEfficiencyHarvesting.h.

44 {};

Member Function Documentation

◆ book()

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

Definition at line 35 of file L1TEfficiencyHarvesting.cc.

References dqm::implementation::IBooker::book1D(), dqm::implementation::IBooker::book2D(), denominatorDir_, denominatorSuffix_, dqm::implementation::IGetter::get(), dqm::legacy::MonitorElement::getTH1(), dqm::legacy::MonitorElement::getTH1F(), dqm::legacy::MonitorElement::getTH2F(), h_efficiency_, fastTrackerRecHitType::is2D(), CalibrationSummaryClient_cfi::kind, EgammaValidation_cff::num, numeratorDir_, numeratorSuffix_, outputDir_, plotName_, dqm::implementation::NavigatorBase::setCurrentFolder(), dqm::impl::MonitorElement::setEfficiencyFlag(), AlCaHLTBitMon_QueryRunRegistry::string, MonitorElementData::TH1D, MonitorElementData::TH1F, MonitorElementData::TH2D, and MonitorElementData::TH2F.

35  {
36  edm::LogInfo("L1TEfficiencyPlotHandler")
37  << "Booking efficiency histogram for " << outputDir_ << " and " << plotName_ << endl;
38 
39  std::string numeratorName = numeratorDir_ + "/" + plotName_ + numeratorSuffix_;
40  std::string denominatorName = denominatorDir_ + "/" + plotName_ + denominatorSuffix_;
41  MonitorElement *num = igetter.get(numeratorName);
42  MonitorElement *den = igetter.get(denominatorName);
43 
44  if (!num || !den) {
45  edm::LogWarning("L1TEfficiencyPlotHandler") << (!num && !den ? numeratorName + " && " + denominatorName
46  : !num ? numeratorName
47  : denominatorName)
48  << " not gettable. Quitting booking" << endl;
49  return;
50  }
51 
52  TH1 *numH = num->getTH1();
53  TH1 *denH = den->getTH1();
54 
55  if (!numH || !denH) {
56  edm::LogWarning("L1TEfficiencyPlotHandler") << (!numH && !denH ? numeratorName + " && " + denominatorName
57  : !num ? numeratorName
58  : denominatorName)
59  << " is not TH1F. Quitting booking" << endl;
60 
61  return;
62  }
63 
64  if (numH->GetNbinsX() != denH->GetNbinsX()) {
65  edm::LogWarning("L1TEfficiencyPlotHandler") << " # X bins in " << numeratorName << " and " << denominatorName
66  << " are different. Quitting booking" << endl;
67  return;
68  }
69 
70  MonitorElement::Kind kind = num->kind();
73 
74  if (is2D) {
75  if (numH->GetNbinsY() != denH->GetNbinsY()) {
76  edm::LogWarning("L1TEfficiencyPlotHandler") << " # Y bins in " << numeratorName << " and " << denominatorName
77  << " are different. Quitting booking" << endl;
78  return;
79  }
80  }
81 
83  if (is1D) {
84  h_efficiency_ = ibooker.book1D(plotName_, den->getTH1F());
85  } else if (is2D) {
86  h_efficiency_ = ibooker.book2D(plotName_, den->getTH2F());
87  }
89  }
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
virtual TH2F * getTH2F() const
bool is2D(HitType hitType)
Log< level::Info, false > LogInfo
virtual TH1F * getTH1F() const
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:212
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:690
virtual TH1 * getTH1() const
Log< level::Warning, false > LogWarning
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98

◆ computeEfficiency()

void dqmoffline::l1t::L1TEfficiencyPlotHandler::computeEfficiency ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter 
)

Definition at line 91 of file L1TEfficiencyHarvesting.cc.

References denominatorDir_, denominatorSuffix_, dqm::implementation::IGetter::get(), dqm::legacy::MonitorElement::getTH1(), h_efficiency_, EgammaValidation_cff::num, numeratorDir_, numeratorSuffix_, and plotName_.

91  {
92  if (!h_efficiency_)
93  return;
94 
95  edm::LogInfo("L1TEfficiencyPlotHandler") << " Computing efficiency for " << plotName_ << endl;
96 
99 
100  TH1 *numH = num->getTH1();
101  TH1 *denH = den->getTH1();
102  TH1 *effH = h_efficiency_->getTH1();
103 
104  effH->Divide(numH, denH, 1.0, 1.0, "B");
105  }
Log< level::Info, false > LogInfo
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:690
virtual TH1 * getTH1() const

Member Data Documentation

◆ denominatorDir_

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

Definition at line 54 of file L1TEfficiencyHarvesting.h.

Referenced by book(), and computeEfficiency().

◆ denominatorSuffix_

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

Definition at line 58 of file L1TEfficiencyHarvesting.h.

Referenced by book(), and computeEfficiency().

◆ h_efficiency_

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

Definition at line 60 of file L1TEfficiencyHarvesting.h.

Referenced by book(), and computeEfficiency().

◆ numeratorDir_

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

Definition at line 53 of file L1TEfficiencyHarvesting.h.

Referenced by book(), and computeEfficiency().

◆ numeratorSuffix_

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

Definition at line 57 of file L1TEfficiencyHarvesting.h.

Referenced by book(), and computeEfficiency().

◆ outputDir_

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

Definition at line 55 of file L1TEfficiencyHarvesting.h.

Referenced by book(), and batchmanager.BatchManager::PrepareJob().

◆ plotName_

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

Definition at line 56 of file L1TEfficiencyHarvesting.h.

Referenced by book(), and computeEfficiency().