CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
L1TEfficiencyPlotHandler Class Reference

#include <L1TEfficiency_Harvesting.h>

Public Member Functions

void book (bool verbose)
 
void computeEfficiency (bool verbose)
 
 L1TEfficiencyPlotHandler (std::string dir, std::string plotName, DQMStore *dbe)
 
 L1TEfficiencyPlotHandler (const L1TEfficiencyPlotHandler &handler)
 
 ~L1TEfficiencyPlotHandler ()
 

Private Attributes

DQMStorem_dbe
 
std::string m_dir
 
MonitorElementm_effHisto
 
std::string m_plotName
 

Detailed Description

Definition at line 40 of file L1TEfficiency_Harvesting.h.

Constructor & Destructor Documentation

L1TEfficiencyPlotHandler::L1TEfficiencyPlotHandler ( std::string  dir,
std::string  plotName,
DQMStore dbe 
)
inline

Definition at line 44 of file L1TEfficiency_Harvesting.h.

44  :
45  m_dir(dir), m_plotName(plotName), m_dbe(dbe), m_effHisto(0) { };
dbl *** dir
Definition: mlp_gen.cc:35
L1TEfficiencyPlotHandler::L1TEfficiencyPlotHandler ( const L1TEfficiencyPlotHandler handler)

Definition at line 34 of file L1TEfficiency_Harvesting.cc.

References m_dbe, m_dir, m_effHisto, and m_plotName.

34  {
35 
36  m_dir = handler.m_dir;
37  m_plotName = handler.m_plotName;
38  m_dbe = handler.m_dbe;
39 
40  m_effHisto = handler.m_effHisto;
41 
42 }
L1TEfficiencyPlotHandler::~L1TEfficiencyPlotHandler ( )
inline

Definition at line 49 of file L1TEfficiency_Harvesting.h.

49 { };

Member Function Documentation

void L1TEfficiencyPlotHandler::book ( bool  verbose)

Definition at line 45 of file L1TEfficiency_Harvesting.cc.

References gather_cfg::cout, MonitorElement::getTH1F(), edm::max(), edm::min(), and pileupDistInMC::num.

45  {
46 
47  if(verbose){
48  cout << "[L1TEfficiencyMuons_Harvesting:] Booking efficiency histo for "
49  << m_dir << " and " << m_plotName << endl;
50  }
51 
52  MonitorElement *num = m_dbe->get(m_dir+"/"+m_plotName+"Num");
53  MonitorElement *den = m_dbe->get(m_dir+"/"+m_plotName+"Den");
54 
55  if (!num || !den) {
56 
57  if(verbose){
58  cout << "[L1TEfficiencyMuons_Harvesting:] "
59  << (!num && !den ? "Num && Den" : !num ? "Num" : "Den")
60  << " not gettable. Quitting booking" << endl;
61  }
62  return;
63 
64  }
65 
66  TH1F *numH = num->getTH1F();
67  TH1F *denH = den->getTH1F();
68 
69  if (!numH || !denH) {
70 
71  if(verbose){
72  cout << "[L1TEfficiencyMuons_Harvesting:] "
73  << (!numH && !denH ? "Num && Den" : !numH ? "Num" : "Den")
74  << " is not TH1F. Quitting booking" << endl;
75  }
76  return;
77 
78  }
79 
80  int nBinsNum = numH->GetNbinsX();
81  int nBinsDen = denH->GetNbinsX();
82 
83  if (nBinsNum != nBinsDen) {
84 
85  if(verbose){
86  cout << "[L1TEfficiencyMuons_Harvesting:] # bins in num and den is different. Quitting booking" << endl;
87  }
88  return;
89 
90  }
91 
92  double min = numH->GetXaxis()->GetXmin();
93  double max = numH->GetXaxis()->GetXmax();
94 
95  m_dbe->setCurrentFolder(m_dir);
96  m_effHisto = m_dbe->book1D(m_plotName,m_plotName,nBinsNum,min,max);
97 
98 }
T min(T a, T b)
Definition: MathUtil.h:58
TH1F * getTH1F(void) const
tuple cout
Definition: gather_cfg.py:121
void L1TEfficiencyPlotHandler::computeEfficiency ( bool  verbose)

Definition at line 101 of file L1TEfficiency_Harvesting.cc.

References gather_cfg::cout, MonitorElement::getTH1F(), and pileupDistInMC::num.

101  {
102 
103  if (!m_effHisto)
104  return;
105 
106  if(verbose){
107  cout << "[L1TEfficiencyMuons_Harvesting:] Computing efficiency for "
108  << m_plotName << endl;
109  }
110 
111  MonitorElement *num = m_dbe->get(m_dir+"/"+m_plotName+"Num");
112  MonitorElement *den = m_dbe->get(m_dir+"/"+m_plotName+"Den");
113 
114  TH1F *numH = num->getTH1F();
115  TH1F *denH = den->getTH1F();
116 
117  numH->Sumw2();
118  denH->Sumw2();
119 
120  TH1F *effH = m_effHisto->getTH1F();
121 
122  effH->Divide(numH,denH);
123 
124 }
TH1F * getTH1F(void) const
tuple cout
Definition: gather_cfg.py:121

Member Data Documentation

DQMStore* L1TEfficiencyPlotHandler::m_dbe
private

Definition at line 61 of file L1TEfficiency_Harvesting.h.

Referenced by L1TEfficiencyPlotHandler().

std::string L1TEfficiencyPlotHandler::m_dir
private

Definition at line 59 of file L1TEfficiency_Harvesting.h.

Referenced by L1TEfficiencyPlotHandler().

MonitorElement* L1TEfficiencyPlotHandler::m_effHisto
private

Definition at line 63 of file L1TEfficiency_Harvesting.h.

Referenced by L1TEfficiencyPlotHandler().

std::string L1TEfficiencyPlotHandler::m_plotName
private

Definition at line 60 of file L1TEfficiency_Harvesting.h.

Referenced by L1TEfficiencyPlotHandler().