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 42 of file L1TEfficiency_Harvesting.h.

Constructor & Destructor Documentation

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

Definition at line 46 of file L1TEfficiency_Harvesting.h.

46  :
47  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 36 of file L1TEfficiency_Harvesting.cc.

References m_dbe, m_dir, m_effHisto, and m_plotName.

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

Definition at line 51 of file L1TEfficiency_Harvesting.h.

51 { };

Member Function Documentation

void L1TEfficiencyPlotHandler::book ( bool  verbose)

Definition at line 47 of file L1TEfficiency_Harvesting.cc.

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

47  {
48 
49  if(verbose){
50  cout << "[L1TEfficiencyMuons_Harvesting:] Booking efficiency histo for "
51  << m_dir << " and " << m_plotName << endl;
52  }
53 
54  MonitorElement *num = m_dbe->get(m_dir+"/"+m_plotName+"Num");
55  MonitorElement *den = m_dbe->get(m_dir+"/"+m_plotName+"Den");
56 
57  if (!num || !den) {
58 
59  if(verbose){
60  cout << "[L1TEfficiencyMuons_Harvesting:] "
61  << (!num && !den ? "Num && Den" : !num ? "Num" : "Den")
62  << " not gettable. Quitting booking" << endl;
63  }
64  return;
65 
66  }
67 
68  TH1F *numH = num->getTH1F();
69  TH1F *denH = den->getTH1F();
70 
71  if (!numH || !denH) {
72 
73  if(verbose){
74  cout << "[L1TEfficiencyMuons_Harvesting:] "
75  << (!numH && !denH ? "Num && Den" : !numH ? "Num" : "Den")
76  << " is not TH1F. Quitting booking" << endl;
77  }
78  return;
79 
80  }
81 
82  int nBinsNum = numH->GetNbinsX();
83  int nBinsDen = denH->GetNbinsX();
84 
85  if (nBinsNum != nBinsDen) {
86 
87  if(verbose){
88  cout << "[L1TEfficiencyMuons_Harvesting:] # bins in num and den is different. Quitting booking" << endl;
89  }
90  return;
91 
92  }
93 
94  double min = numH->GetXaxis()->GetXmin();
95  double max = numH->GetXaxis()->GetXmax();
96 
98  m_effHisto = m_dbe->book1D(m_plotName,m_plotName,nBinsNum,min,max);
99 
100 }
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:722
#define min(a, b)
Definition: mlp_lapack.h:161
const T & max(const T &a, const T &b)
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1473
TH1F * getTH1F(void) const
long long int num
Definition: procUtils.cc:71
tuple cout
Definition: gather_cfg.py:121
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:434
void L1TEfficiencyPlotHandler::computeEfficiency ( bool  verbose)

Definition at line 103 of file L1TEfficiency_Harvesting.cc.

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

103  {
104 
105  if (!m_effHisto)
106  return;
107 
108  if(verbose){
109  cout << "[L1TEfficiencyMuons_Harvesting:] Computing efficiency for "
110  << m_plotName << endl;
111  }
112 
113  MonitorElement *num = m_dbe->get(m_dir+"/"+m_plotName+"Num");
114  MonitorElement *den = m_dbe->get(m_dir+"/"+m_plotName+"Den");
115 
116  TH1F *numH = num->getTH1F();
117  TH1F *denH = den->getTH1F();
118 
119  numH->Sumw2();
120  denH->Sumw2();
121 
122  TH1F *effH = m_effHisto->getTH1F();
123 
124  effH->Divide(numH,denH);
125 
126 }
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1473
TH1F * getTH1F(void) const
long long int num
Definition: procUtils.cc:71
tuple cout
Definition: gather_cfg.py:121

Member Data Documentation

DQMStore* L1TEfficiencyPlotHandler::m_dbe
private

Definition at line 63 of file L1TEfficiency_Harvesting.h.

Referenced by L1TEfficiencyPlotHandler().

std::string L1TEfficiencyPlotHandler::m_dir
private

Definition at line 61 of file L1TEfficiency_Harvesting.h.

Referenced by L1TEfficiencyPlotHandler().

MonitorElement* L1TEfficiencyPlotHandler::m_effHisto
private

Definition at line 65 of file L1TEfficiency_Harvesting.h.

Referenced by L1TEfficiencyPlotHandler().

std::string L1TEfficiencyPlotHandler::m_plotName
private

Definition at line 62 of file L1TEfficiency_Harvesting.h.

Referenced by L1TEfficiencyPlotHandler().