test
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 (DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
 
void computeEfficiency (DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
 
 L1TEfficiencyPlotHandler (std::string dir, std::string plotName)
 
 L1TEfficiencyPlotHandler (const L1TEfficiencyPlotHandler &handler)
 
 ~L1TEfficiencyPlotHandler ()
 

Private Attributes

std::string m_dir
 
MonitorElementm_effHisto
 
std::string m_plotName
 

Detailed Description

Definition at line 41 of file L1TEfficiency_Harvesting.h.

Constructor & Destructor Documentation

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

Definition at line 45 of file L1TEfficiency_Harvesting.h.

45  :
46  m_dir(dir), m_plotName(plotName), 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_dir, m_effHisto, and m_plotName.

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

Definition at line 50 of file L1TEfficiency_Harvesting.h.

50 { };

Member Function Documentation

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

Definition at line 40 of file L1TEfficiency_Harvesting.cc.

References DQMStore::IBooker::book1D(), gather_cfg::cout, DQMStore::IGetter::get(), MonitorElement::getTH1F(), edm::max(), edm::min(), pileupDistInMC::num, DQMStore::IBooker::setCurrentFolder(), indexGen::title, and fw3dlego::xbins.

40  {
41 
42  cout << "[L1TEfficiencyMuons_Harvesting:] Booking efficiency histo for " << m_dir << " and " << m_plotName << endl;
43 
44  MonitorElement *num = igetter.get(m_dir+"/"+m_plotName+"Num");
45  MonitorElement *den = igetter.get(m_dir+"/"+m_plotName+"Den");
46 
47  if (!num || !den) {
48  cout << "[L1TEfficiencyMuons_Harvesting:] " << (!num && !den ? "Num && Den" : !num ? "Num" : "Den") << " not gettable. Quitting booking" << endl;
49  return;
50  }
51  TH1F *numH = num->getTH1F();
52  TH1F *denH = den->getTH1F();
53 
54  if (!numH || !denH) {
55  cout << "[L1TEfficiencyMuons_Harvesting:] " << (!numH && !denH ? "Num && Den" : !numH ? "Num" : "Den") << " is not TH1F. Quitting booking" << endl;
56  return;
57  }
58 
59  int nBinsNum = numH->GetNbinsX();
60  int nBinsDen = denH->GetNbinsX();
61 
62  if (nBinsNum != nBinsDen) {
63  cout << "[L1TEfficiencyMuons_Harvesting:] # bins in num and den is different. Quitting booking" << endl;
64  return;
65  }
66 
67  double min = numH->GetXaxis()->GetXmin();
68  double max = numH->GetXaxis()->GetXmax();
69 
70  ibooker.setCurrentFolder(m_dir);
71 
72  string pt_sketo = "EffvsPt";
73 
74  string ptS20 = "EffvsPt_SINGLE_20";
75  string etaS20 = "EffvsEta_SINGLE_20";
76  string phiS20 = "EffvsPhi_SINGLE_20";
77 
78  string ptS16 = "EffvsPt_SINGLE_16";
79  string etaS16 = "EffvsEta_SINGLE_16";
80  string phiS16 = "EffvsPhi_SINGLE_16";
81 
82  string ptS25 = "EffvsPt_SINGLE_25";
83  string etaS25 = "EffvsEta_SINGLE_25";
84  string phiS25 = "EffvsPhi_SINGLE_25";
85 
86  if (m_plotName == pt_sketo.c_str()) {
87  string title = "L1T Efficiency vs pt [-]";
88  float xbins[33] = {0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 55, 60, 65, 70, 80, 90, 100};
89  m_effHisto = ibooker.book1D(m_plotName,title.c_str(),32, xbins);
90  }
91  if (m_plotName == ptS20.c_str()) {
92  string title = "";
93  float xbins[33] = {0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 55, 60, 65, 70, 80, 90, 100};
94  m_effHisto = ibooker.book1D(m_plotName,title.c_str(),32, xbins);
95  }
96  else if (m_plotName == etaS20.c_str()) {
97  string title = "";
98  m_effHisto = ibooker.book1D(m_plotName,title.c_str(),nBinsNum,min,max);
99  }
100  else if (m_plotName == phiS20.c_str()) {
101  string title = "";
102  m_effHisto = ibooker.book1D(m_plotName,title.c_str(),nBinsNum,min,max);
103  }
104  else if (m_plotName == ptS16.c_str()) {
105  string title = "";
106  float xbins[33] = {0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 55, 60, 65, 70, 80, 90, 100};
107  m_effHisto = ibooker.book1D(m_plotName,title.c_str(),32, xbins);
108  }
109  else if (m_plotName == etaS16.c_str()) {
110  string title = "";
111  m_effHisto = ibooker.book1D(m_plotName,title.c_str(),nBinsNum,min,max);
112  }
113  else if (m_plotName == phiS16.c_str()) {
114  string title = "";
115  m_effHisto = ibooker.book1D(m_plotName,title.c_str(),nBinsNum,min,max);
116  }
117  else if (m_plotName == ptS25.c_str()) {
118  string title = "";
119  float xbins[33] = {0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 55, 60, 65, 70, 80, 90, 100};
120  m_effHisto = ibooker.book1D(m_plotName,title.c_str(),32, xbins);
121  }
122  else if (m_plotName == etaS25.c_str()) {
123  string title = "";
124  m_effHisto = ibooker.book1D(m_plotName,title.c_str(),nBinsNum,min,max);
125  }
126  else if (m_plotName == phiS25.c_str()) {
127  string title = "";
128  m_effHisto = ibooker.book1D(m_plotName,title.c_str(),nBinsNum,min,max);
129  }
130  else {
131  m_effHisto = ibooker.book1D(m_plotName,m_plotName,nBinsNum,min,max);
132  }
133 }
const double xbins[]
MonitorElement * get(const std::string &path)
Definition: DQMStore.cc:304
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:276
TH1F * getTH1F(void) const
tuple cout
Definition: gather_cfg.py:145
void L1TEfficiencyPlotHandler::computeEfficiency ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter 
)

Definition at line 135 of file L1TEfficiency_Harvesting.cc.

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

135  {
136 
137  if (!m_effHisto) return;
138 
139  cout << "[L1TEfficiencyMuons_Harvesting:] Computing efficiency for " << m_plotName << endl;
140 
141  MonitorElement *num = igetter.get(m_dir+"/"+m_plotName+"Num");
142  MonitorElement *den = igetter.get(m_dir+"/"+m_plotName+"Den");
143 
144  TH1F *numH = num->getTH1F();
145  TH1F *denH = den->getTH1F();
146 
147  numH->Sumw2();
148  denH->Sumw2();
149 
150  TH1F *effH = m_effHisto->getTH1F();
151 
152 //************************************************************************
153 
154  string pt_sketo = "EffvsPt";
155 
156  string ptS20 = "EffvsPt_SINGLE_20";
157  string etaS20 = "EffvsEta_SINGLE_20";
158  string phiS20 = "EffvsPhi_SINGLE_20";
159 
160  string ptS16 = "EffvsPt_SINGLE_16";
161  string etaS16 = "EffvsEta_SINGLE_16";
162  string phiS16 = "EffvsPhi_SINGLE_16";
163 
164  string ptS25 = "EffvsPt_SINGLE_25";
165  string etaS25 = "EffvsEta_SINGLE_25";
166  string phiS25 = "EffvsPhi_SINGLE_25";
167 
168  if (m_plotName == ptS20.c_str()) {
169  effH->GetXaxis()->SetTitle("p_{T}\\,(\\text{Reco} \\, \\mu) ~\\text{[GeV]}");
170  effH->SetTitle("\\text{Single} \\, \\, \\text{Muon} \\, \\, \\text{Quality} ~[\\geq 12] ~/~ p_{T}(\\text{L1} \\, \\mu) \\geq 20 \\, \\text{GeV}");
171  }
172  else if (m_plotName == etaS20.c_str()) {
173  effH->GetXaxis()->SetTitle("\\eta \\,(\\text{Reco} \\, \\mu) ");
174  effH->SetTitle("\\text{Single} \\, \\, \\text{Muon} \\, \\, \\text{Quality} ~[\\geq 12] ~/~ p_{T}(\\text{L1} \\, \\mu) \\geq 20 \\, \\text{GeV}");
175  }
176  else if (m_plotName == phiS20.c_str()) {
177  effH->GetXaxis()->SetTitle("\\phi \\,(\\text{Reco} \\, \\mu) ~\\text{[rad]}");
178  effH->SetTitle("\\text{Single} \\, \\, \\text{Muon} \\, \\, \\text{Quality} ~[\\geq 12] ~/~ p_{T}(\\text{L1} \\, \\mu) \\geq 20 \\, \\text{GeV}");
179  }
180  else if (m_plotName == ptS16.c_str()) {
181  effH->GetXaxis()->SetTitle("p_{T}\\,(\\text{Reco} \\, \\mu) ~\\text{[GeV]}");
182  effH->SetTitle("\\text{Single} \\, \\, \\text{Muon} \\, \\, \\text{Quality} ~[\\geq 12] ~/~ p_{T}(\\text{L1} \\, \\mu) \\geq 16 \\, \\text{GeV}");
183  }
184  else if (m_plotName == etaS16.c_str()) {
185  effH->GetXaxis()->SetTitle("\\eta \\,(\\text{Reco} \\, \\mu) ");
186  effH->SetTitle("\\text{Single} \\, \\, \\text{Muon} \\, \\, \\text{Quality} ~[\\geq 12] ~/~ p_{T}(\\text{L1} \\, \\mu) \\geq 16 \\, \\text{GeV}");
187  }
188  else if (m_plotName == phiS16.c_str()) {
189  effH->GetXaxis()->SetTitle("\\phi \\,(\\text{Reco} \\, \\mu) ~\\text{[rad]}");
190  effH->SetTitle("\\text{Single} \\, \\, \\text{Muon} \\, \\, \\text{Quality} ~[\\geq 12] ~/~ p_{T}(\\text{L1} \\, \\mu) \\geq 16 \\, \\text{GeV}");
191  }
192  else if (m_plotName == ptS25.c_str()) {
193  effH->GetXaxis()->SetTitle("p_{T}\\,(\\text{Reco} \\, \\mu) ~\\text{[GeV]}");
194  effH->SetTitle("\\text{Single} \\, \\, \\text{Muon} \\, \\, \\text{Quality} ~[\\geq 12] ~/~ p_{T}(\\text{L1} \\, \\mu) \\geq 25 \\, \\text{GeV}");
195  }
196  else if (m_plotName == etaS25.c_str()) {
197  effH->GetXaxis()->SetTitle("\\eta \\,(\\text{Reco} \\, \\mu) ");
198  effH->SetTitle("\\text{Single} \\, \\, \\text{Muon} \\, \\, \\text{Quality} ~[\\geq 12] ~/~ p_{T}(\\text{L1} \\, \\mu) \\geq 25 \\, \\text{GeV}");
199  }
200  else if (m_plotName == phiS25.c_str()) {
201  effH->GetXaxis()->SetTitle("\\phi \\,(\\text{Reco} \\, \\mu) ~\\text{[rad]}");
202  effH->SetTitle("\\text{Single} \\, \\, \\text{Muon} \\, \\, \\text{Quality} ~[\\geq 12] ~/~ p_{T}(\\text{L1} \\, \\mu) \\geq 25 \\, \\text{GeV}");
203  }
204  else {
205  effH->GetXaxis()->SetTitle("not");
206  effH->SetTitle("not");
207  }
208 
209  effH->GetYaxis()->SetTitle("L1T Efficiency");
210  effH->GetXaxis()->SetTitleSize(0.028);
211  effH->GetYaxis()->SetTitleSize(0.028);
212  effH->SetTitleSize(0.028);
213  effH->SetTitleOffset(1.29,"X");
214  effH->GetXaxis()->SetLabelSize(0.028);
215  effH->GetYaxis()->SetLabelSize(0.028);
216  effH->SetLineStyle(1);
217  effH->SetLineWidth(2);
218  effH->SetLineColor(2);
219 
220 //************************************************************************
221  effH->Divide(numH,denH, 1.0, 1.0, "B");
222 
223  effH->SetMinimum(0.);
224  effH->SetMaximum(1.1);
225 }
MonitorElement * get(const std::string &path)
Definition: DQMStore.cc:304
TH1F * getTH1F(void) const
tuple cout
Definition: gather_cfg.py:145

Member Data Documentation

std::string L1TEfficiencyPlotHandler::m_dir
private

Definition at line 60 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 61 of file L1TEfficiency_Harvesting.h.

Referenced by L1TEfficiencyPlotHandler().