CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EfficiencyPlotter.cc
Go to the documentation of this file.
2 
3 // Framework
10 
11 
16 
17 #include <iostream>
18 #include <stdio.h>
19 #include <string>
20 #include <math.h>
21 #include "TF1.h"
22 #include "TH1F.h"
23 
24 using namespace edm;
25 using namespace std;
26 
27 //#define DEBUG
28 
30 #ifdef DEBUG
31  cout << "EfficiencyPlotter(): Constructor " << endl;
32 #endif
33  parameters = ps;
34  theDbe = edm::Service<DQMStore>().operator->();
35 }
37 
39 #ifdef DEBUG
40  cout << "EfficiencyPlotter::beginJob " << endl;
41 #endif
42 
43  theDbe->setCurrentFolder("Muons/EfficiencyAnalyzer");
44 
45  metname = "EfficiencyAnalyzer";
46  LogTrace(metname)<<"[EfficiencyPlotter] beginJob: Parameters initialization";
47 
48  // efficiency plot
49  etaBin = parameters.getParameter<int>("etaBin");
50  etaMin = parameters.getParameter<double>("etaMin");
51  etaMax = parameters.getParameter<double>("etaMax");
52 
53  phiBin = parameters.getParameter<int>("phiBin");
54  phiMin = parameters.getParameter<double>("phiMin");
55  phiMax = parameters.getParameter<double>("phiMax");
56 
57  ptBin = parameters.getParameter<int>("ptBin");
58  ptMin = parameters.getParameter<double>("ptMin");
59  ptMax = parameters.getParameter<double>("ptMax");
60 
61  vtxBin = parameters.getParameter<int>("vtxBin");
62  vtxMin = parameters.getParameter<double>("vtxMin");
63  vtxMax = parameters.getParameter<double>("vtxMax");
64 
65  h_eff_eta_TightMu = theDbe->book1D("Eff_eta_TightMu", "TightMu Eff. vs #eta", etaBin, etaMin, etaMax);
66  h_eff_hp_eta_TightMu = theDbe->book1D("Eff_hp_eta_TightMu", "High Pt TightMu Eff. vs #eta", etaBin, etaMin, etaMax);
67  h_eff_phi_TightMu = theDbe->book1D("Eff_phi_TightMu", "TightMu Eff. vs #phi", phiBin, phiMin, phiMax);
68  h_eff_pt_TightMu = theDbe->book1D("Eff_pt_TightMu", "TightMu Eff. vs Pt", ptBin, ptMin, ptMax);
69  h_eff_pt_EB_TightMu = theDbe->book1D("Eff_pt_EB_TightMu", "Barrel: TightMu Eff. vs Pt", ptBin, ptMin, ptMax);
70  h_eff_pt_EE_TightMu = theDbe->book1D("Eff_pt_EE_TightMu", "Endcap: TightMu Eff. vs Pt", ptBin, ptMin, ptMax);
71  h_eff_pt_detIsoTightMu = theDbe->book1D("Eff_pt_detIsoTightMu", "detIsoTightMu Efficiency vs Pt", ptBin, ptMin, ptMax);
72  h_eff_pt_EB_detIsoTightMu = theDbe->book1D("Eff_pt_EB_detIsoTightMu", "Barrel: detIsoTightMu Eff. vs Pt", ptBin, ptMin, ptMax);
73  h_eff_pt_EE_detIsoTightMu = theDbe->book1D("Eff_pt_EE_detIsoTightMu", "Endcap: detIsoTightMu Eff. vs Pt", ptBin, ptMin, ptMax);
74  h_eff_pt_pfIsoTightMu = theDbe->book1D("Eff_pt_pfIsoTightMu", "pfIsoTightMu Eff. vs Pt", ptBin, ptMin, ptMax);
75  h_eff_pt_EB_pfIsoTightMu = theDbe->book1D("Eff_pt_EB_pfIsoTightMu", "Barrel: pfIsoTightMu Eff. vs Pt", ptBin, ptMin, ptMax);
76  h_eff_pt_EE_pfIsoTightMu = theDbe->book1D("Eff_pt_EE_pfIsoTightMu", "Endcap: pfIsoTightMu Eff. vs Pt", ptBin, ptMin, ptMax);
77  h_eff_vtx_detIsoTightMu = theDbe->book1D("Eff_vtx_detIsoTightMu", "detIsoTightMu Eff. vs nVtx", vtxBin, vtxMin, vtxMax);
78  h_eff_vtx_pfIsoTightMu = theDbe->book1D("Eff_vtx_pfIsoTightMu", "pfIsoTightMu Eff. vs nVtx", vtxBin, vtxMin, vtxMax);
79  h_eff_vtx_EB_detIsoTightMu = theDbe->book1D("Eff_vtx_EB_detIsoTightMu", "Barrel: detIsoTightMu Eff. vs nVtx", vtxBin, vtxMin, vtxMax);
80  h_eff_vtx_EB_pfIsoTightMu = theDbe->book1D("Eff_vtx_EB_pfIsoTightMu", "Barrel: pfIsoTightMu Eff. vs nVtx", vtxBin, vtxMin, vtxMax);
81  h_eff_vtx_EE_detIsoTightMu = theDbe->book1D("Eff_vtx_EE_detIsoTightMu", "Endcap: detIsoTightMu Eff. vs nVtx", vtxBin, vtxMin, vtxMax);
82  h_eff_vtx_EE_pfIsoTightMu = theDbe->book1D("Eff_vtx_EE_pfIsoTightMu", "Endcap: pfIsoTightMu Eff. vs nVtx", vtxBin, vtxMin, vtxMax);
83 
84  h_eff_pt_pfIsodBTightMu = theDbe->book1D("Eff_pt_pfIsodBTightMu", "pfIsoTightMu (deltaBeta) Eff. vs Pt", ptBin, ptMin, ptMax);
85  h_eff_pt_EB_pfIsodBTightMu = theDbe->book1D("Eff_pt_EB_pfIsodBTightMu", "Barrel: pfIsoTightMu (deltaBeta) Eff. vs Pt", ptBin, ptMin, ptMax);
86  h_eff_pt_EE_pfIsodBTightMu = theDbe->book1D("Eff_pt_EE_pfIsodBTightMu", "Endcap: pfIsoTightMu (deltaBeta) Eff. vs Pt", ptBin, ptMin, ptMax);
87  h_eff_vtx_pfIsodBTightMu = theDbe->book1D("Eff_vtx_pfIsodBTightMu", "pfIsoTightMu (deltaBeta) Eff. vs nVtx", vtxBin, vtxMin, vtxMax);
88  h_eff_vtx_EB_pfIsodBTightMu = theDbe->book1D("Eff_vtx_EB_pfIsodBTightMu", "Barrel: pfIsoTightMu (deltaBeta) Eff. vs nVtx", vtxBin, vtxMin, vtxMax);
89  h_eff_vtx_EE_pfIsodBTightMu = theDbe->book1D("Eff_vtx_EE_pfIsodBTightMu", "Endcap: pfIsoTightMu (deltaBeta) Eff. vs nVtx", vtxBin, vtxMin, vtxMax);
90 
91 
92 
93  // This prevents this ME to be normalized when drawn into the GUI
94  h_eff_eta_TightMu ->setEfficiencyFlag();
95  h_eff_hp_eta_TightMu ->setEfficiencyFlag();
96  h_eff_phi_TightMu ->setEfficiencyFlag();
97  h_eff_pt_TightMu ->setEfficiencyFlag();
98  h_eff_pt_EB_TightMu ->setEfficiencyFlag();
99  h_eff_pt_EE_TightMu ->setEfficiencyFlag();
100  h_eff_pt_detIsoTightMu ->setEfficiencyFlag();
101  h_eff_pt_EB_detIsoTightMu ->setEfficiencyFlag();
102  h_eff_pt_EE_detIsoTightMu ->setEfficiencyFlag();
103  h_eff_pt_pfIsoTightMu ->setEfficiencyFlag();
104  h_eff_pt_EB_pfIsoTightMu ->setEfficiencyFlag();
105  h_eff_pt_EE_pfIsoTightMu ->setEfficiencyFlag();
106  h_eff_vtx_detIsoTightMu ->setEfficiencyFlag();
107  h_eff_vtx_pfIsoTightMu ->setEfficiencyFlag();
108  h_eff_vtx_EB_detIsoTightMu->setEfficiencyFlag();
109  h_eff_vtx_EB_pfIsoTightMu ->setEfficiencyFlag();
110  h_eff_vtx_EE_detIsoTightMu->setEfficiencyFlag();
111  h_eff_vtx_EE_pfIsoTightMu ->setEfficiencyFlag();
112 
113  h_eff_pt_pfIsodBTightMu ->setEfficiencyFlag();
114  h_eff_pt_EB_pfIsodBTightMu ->setEfficiencyFlag();
115  h_eff_pt_EE_pfIsodBTightMu ->setEfficiencyFlag();
116  h_eff_vtx_pfIsodBTightMu ->setEfficiencyFlag();
117  h_eff_vtx_EB_pfIsodBTightMu ->setEfficiencyFlag();
118  h_eff_vtx_EE_pfIsodBTightMu ->setEfficiencyFlag();
119 
120 
121 
122  // AXIS TITLES....
123  h_eff_hp_eta_TightMu ->setAxisTitle("#eta", 1);
124  h_eff_eta_TightMu ->setAxisTitle("#eta", 1);
125  h_eff_phi_TightMu ->setAxisTitle("#phi", 1);
126  h_eff_pt_TightMu ->setAxisTitle("p_{T} (GeV)", 1);
127  h_eff_pt_EB_TightMu ->setAxisTitle("p_{T} (GeV)", 1);
128  h_eff_pt_EE_TightMu ->setAxisTitle("p_{T} (GeV)", 1);
129  h_eff_pt_detIsoTightMu ->setAxisTitle("p_{T} (GeV)", 1);
130  h_eff_pt_EB_detIsoTightMu ->setAxisTitle("p_{T} (GeV)", 1);
131  h_eff_pt_EE_detIsoTightMu ->setAxisTitle("p_{T} (GeV)", 1);
132  h_eff_pt_pfIsoTightMu ->setAxisTitle("p_{T} (GeV)", 1);
133  h_eff_pt_EB_pfIsoTightMu ->setAxisTitle("p_{T} (GeV)", 1);
134  h_eff_pt_EE_pfIsoTightMu ->setAxisTitle("p_{T} (GeV)", 1);
135  h_eff_vtx_detIsoTightMu ->setAxisTitle("Number of PV", 1);
136  h_eff_vtx_pfIsoTightMu ->setAxisTitle("Number of PV", 1);
137  h_eff_vtx_EB_detIsoTightMu->setAxisTitle("Number of PV", 1);
138  h_eff_vtx_EB_pfIsoTightMu ->setAxisTitle("Number of PV", 1);
139  h_eff_vtx_EE_detIsoTightMu->setAxisTitle("Number of PV", 1);
140  h_eff_vtx_EE_pfIsoTightMu ->setAxisTitle("Number of PV", 1);
141 
142  h_eff_pt_pfIsodBTightMu ->setAxisTitle("p_{T} (GeV)", 1);
143  h_eff_pt_EB_pfIsodBTightMu ->setAxisTitle("p_{T} (GeV)", 1);
144  h_eff_pt_EE_pfIsodBTightMu ->setAxisTitle("p_{T} (GeV)", 1);
145  h_eff_vtx_pfIsodBTightMu ->setAxisTitle("Number of PV", 1);
146  h_eff_vtx_EB_pfIsodBTightMu ->setAxisTitle("Number of PV", 1);
147  h_eff_vtx_EE_pfIsodBTightMu ->setAxisTitle("Number of PV", 1);
148 
149 
150 // h_eff_eta_TightMu ->setAxisTitle("Tight Mu Eff.", 2);
151 // h_eff_hp_eta_TightMu ->setAxisTitle("High p_{T} Mu Eff.", 2);
152 // h_eff_phi_TightMu ->setAxisTitle("Tight Mu Eff.", 2);
153 // h_eff_pt_TightMu ->setAxisTitle("Tight Mu Eff.", 2);
154 // h_eff_pt_EB_TightMu ->setAxisTitle("Tight Mu Eff.", 2);
155 // h_eff_pt_EE_TightMu ->setAxisTitle("Tight Mu Eff.", 2);
156 // h_eff_pt_detIsoTightMu ->setAxisTitle("Tight Mu Eff.", 2);
157 // h_eff_pt_EB_detIsoTightMu ->setAxisTitle("Tight Mu Eff.", 2);
158 // h_eff_pt_EE_detIsoTightMu ->setAxisTitle("Tight Mu Eff.", 2);
159 // h_eff_pt_pfIsoTightMu ->setAxisTitle("Tight Mu Eff.", 2);
160 // h_eff_pt_EB_pfIsoTightMu ->setAxisTitle("Tight Mu Eff.", 2);
161 // h_eff_pt_EE_pfIsoTightMu ->setAxisTitle("Tight Mu Eff.", 2);
162 // h_eff_vtx_detIsoTightMu ->setAxisTitle("Tight Mu Eff.", 2);
163 // h_eff_vtx_pfIsoTightMu ->setAxisTitle("Tight Mu Eff.", 2);
164 // h_eff_vtx_EB_detIsoTightMu->setAxisTitle("Tight Mu Eff.", 2);
165 // h_eff_vtx_EB_pfIsoTightMu ->setAxisTitle("Tight Mu Eff.", 2);
166 // h_eff_vtx_EE_detIsoTightMu->setAxisTitle("Tight Mu Eff.", 2);
167 // h_eff_vtx_EE_pfIsoTightMu ->setAxisTitle("Tight Mu Eff.", 2);
168 }
169 
170 
171 void EfficiencyPlotter::beginRun(Run const& run, EventSetup const& eSetup) {
172  LogTrace(metname)<<"[EfficiencyPlotter]: beginRun";
173 }
175  LogTrace(metname)<<"[EfficiencyPlotter]: beginLuminosityBlock";
176  // Get the run number
177  run = lumiSeg.run();
178 }
180  nevents++;
181  LogTrace(metname)<< "[EfficiencyPlotter]: "<<nevents<<" events";
182 }
184  // LogTrace(metname)<<"[EfficiencyPlotter]: endLuminosityBlock, performing the DQM LS client operation";
185  // counts number of lumiSegs
186  nLumiSegs = lumiSeg.id().luminosityBlock();
187 }
188 void EfficiencyPlotter::endRun(Run const& run, EventSetup const& eSetup) {
189  LogTrace(metname)<<"[EfficiencyPlotter]: endRun, performing the DQM end of run client operation";
190 
191 
193  string numpath_pt = "Muons/EfficiencyAnalyzer/passProbes_TightMu_pt";
194  string denpath_pt = "Muons/EfficiencyAnalyzer/allProbes_pt";
195 
196  MonitorElement *Numerator_pt = theDbe->get(numpath_pt);
197  MonitorElement *Denominator_pt = theDbe->get(denpath_pt);
198 
199  if (Numerator_pt && Denominator_pt){
200  TH1F *h_numerator_pt = Numerator_pt->getTH1F();
201  TH1F *h_denominator_pt = Denominator_pt->getTH1F();
202  TH1F *h_eff_pt = h_eff_pt_TightMu->getTH1F();
203 
204  if (h_eff_pt->GetSumw2N() == 0) h_eff_pt->Sumw2();
205  h_eff_pt->Divide(h_numerator_pt, h_denominator_pt, 1., 1., "B");
206  }
207 
209  string numpath_EB_pt = "Muons/EfficiencyAnalyzer/passProbes_TightMu_EB_pt";
210  string denpath_EB_pt = "Muons/EfficiencyAnalyzer/allProbes_EB_pt";
211 
212  MonitorElement *Numerator_EB_pt = theDbe->get(numpath_EB_pt);
213  MonitorElement *Denominator_EB_pt = theDbe->get(denpath_EB_pt);
214 
215  if (Numerator_EB_pt && Denominator_EB_pt){
216  TH1F *h_numerator_EB_pt = Numerator_EB_pt->getTH1F();
217  TH1F *h_denominator_EB_pt = Denominator_EB_pt->getTH1F();
218  TH1F *h_eff_EB_pt = h_eff_pt_EB_TightMu->getTH1F();
219 
220  if (h_eff_EB_pt->GetSumw2N() == 0) h_eff_EB_pt->Sumw2();
221  h_eff_EB_pt->Divide(h_numerator_EB_pt, h_denominator_EB_pt, 1., 1., "B");
222  }
223 
225  string numpath_EE_pt = "Muons/EfficiencyAnalyzer/passProbes_TightMu_EE_pt";
226  string denpath_EE_pt = "Muons/EfficiencyAnalyzer/allProbes_EE_pt";
227 
228  MonitorElement *Numerator_EE_pt = theDbe->get(numpath_EE_pt);
229  MonitorElement *Denominator_EE_pt = theDbe->get(denpath_EE_pt);
230 
231  if (Numerator_EE_pt && Denominator_EE_pt){
232  TH1F *h_numerator_EE_pt = Numerator_EE_pt->getTH1F();
233  TH1F *h_denominator_EE_pt = Denominator_EE_pt->getTH1F();
234  TH1F *h_eff_EE_pt = h_eff_pt_EE_TightMu->getTH1F();
235 
236  if (h_eff_EE_pt->GetSumw2N() == 0) h_eff_EE_pt->Sumw2();
237  h_eff_EE_pt->Divide(h_numerator_EE_pt, h_denominator_EE_pt, 1., 1., "B");
238  }
239 
241  string numpath_eta = "Muons/EfficiencyAnalyzer/passProbes_TightMu_eta";
242  string denpath_eta = "Muons/EfficiencyAnalyzer/allProbes_eta";
243 
244  MonitorElement *Numerator_eta = theDbe->get(numpath_eta);
245  MonitorElement *Denominator_eta = theDbe->get(denpath_eta);
246 
247  if (Numerator_eta && Denominator_eta){
248 
249  TH1F *h_numerator_eta = Numerator_eta->getTH1F();
250  TH1F *h_denominator_eta = Denominator_eta->getTH1F();
251 
252  TH1F *h_eff_eta = h_eff_eta_TightMu->getTH1F();
253 
254  if (h_eff_eta->GetSumw2N() == 0) h_eff_eta->Sumw2();
255 
256  h_eff_eta->Divide(h_numerator_eta, h_denominator_eta, 1., 1., "B");
257 
258  }
259 
261 
262  string numpath_hp_eta = "Muons/EfficiencyAnalyzer/passProbes_TightMu_hp_eta";
263  string denpath_hp_eta = "Muons/EfficiencyAnalyzer/allProbes_hp_eta";
264 
265  MonitorElement *Numerator_hp_eta = theDbe->get(numpath_hp_eta);
266  MonitorElement *Denominator_hp_eta = theDbe->get(denpath_hp_eta);
267 
268  if (Numerator_hp_eta && Denominator_hp_eta){
269 
270  TH1F *h_numerator_hp_eta = Numerator_hp_eta->getTH1F();
271  TH1F *h_denominator_hp_eta = Denominator_hp_eta->getTH1F();
272 
273  TH1F *h_eff_hp_eta = h_eff_hp_eta_TightMu->getTH1F();
274 
275  if (h_eff_hp_eta->GetSumw2N() == 0) h_eff_hp_eta->Sumw2();
276 
277  h_eff_hp_eta->Divide(h_numerator_hp_eta, h_denominator_hp_eta, 1., 1., "B");
278 
279  }
280 
282 
283  string numpath_phi = "Muons/EfficiencyAnalyzer/passProbes_TightMu_phi";
284  string denpath_phi = "Muons/EfficiencyAnalyzer/allProbes_phi";
285 
286  MonitorElement *Numerator_phi = theDbe->get(numpath_phi);
287  MonitorElement *Denominator_phi = theDbe->get(denpath_phi);
288 
289  if (Numerator_phi && Denominator_phi){
290 
291  TH1F *h_numerator_phi = Numerator_phi->getTH1F();
292  TH1F *h_denominator_phi = Denominator_phi->getTH1F();
293 
294  TH1F *h_eff_phi = h_eff_phi_TightMu->getTH1F();
295 
296  if (h_eff_phi->GetSumw2N() == 0) h_eff_phi->Sumw2();
297 
298  h_eff_phi->Divide(h_numerator_phi, h_denominator_phi, 1., 1., "B");
299 
300  }
301 
302 
304  string numpath_detIso_pt = "Muons/EfficiencyAnalyzer/passProbes_detIsoTightMu_pt";
305  string denpath_detIso_pt = "Muons/EfficiencyAnalyzer/allProbes_TightMu_pt";
306 
307  MonitorElement *Numerator_detIso_pt = theDbe->get(numpath_detIso_pt);
308  MonitorElement *Denominator_detIso_pt = theDbe->get(denpath_detIso_pt);
309 
310  if (Numerator_detIso_pt && Denominator_detIso_pt){
311 
312  TH1F *h_numerator_detIso_pt = Numerator_detIso_pt->getTH1F();
313  TH1F *h_denominator_detIso_pt = Denominator_detIso_pt->getTH1F();
314 
315  TH1F *h_eff_detIso_pt = h_eff_pt_detIsoTightMu->getTH1F();
316 
317  if (h_eff_detIso_pt->GetSumw2N() == 0) h_eff_detIso_pt->Sumw2();
318  h_eff_detIso_pt->Divide(h_numerator_detIso_pt, h_denominator_detIso_pt, 1., 1., "B");
319 
320  }
321 
322 
324  string numpath_detIso_EB_pt = "Muons/EfficiencyAnalyzer/passProbes_EB_detIsoTightMu_pt";
325  string denpath_detIso_EB_pt = "Muons/EfficiencyAnalyzer/allProbes_EB_TightMu_pt";
326 
327  MonitorElement *Numerator_detIso_EB_pt = theDbe->get(numpath_detIso_EB_pt);
328  MonitorElement *Denominator_detIso_EB_pt = theDbe->get(denpath_detIso_EB_pt);
329 
330  if (Numerator_detIso_EB_pt && Denominator_detIso_EB_pt){
331 
332  TH1F *h_numerator_detIso_EB_pt = Numerator_detIso_EB_pt->getTH1F();
333  TH1F *h_denominator_detIso_EB_pt = Denominator_detIso_EB_pt->getTH1F();
334 
335  TH1F *h_eff_detIso_EB_pt = h_eff_pt_EB_detIsoTightMu->getTH1F();
336 
337  if (h_eff_detIso_EB_pt->GetSumw2N() == 0) h_eff_detIso_EB_pt->Sumw2();
338 
339  h_eff_detIso_EB_pt->Divide(h_numerator_detIso_EB_pt, h_denominator_detIso_EB_pt, 1., 1., "B");
340 
341  }
342 
343 
345  string numpath_detIso_EE_pt = "Muons/EfficiencyAnalyzer/passProbes_EE_detIsoTightMu_pt";
346  string denpath_detIso_EE_pt = "Muons/EfficiencyAnalyzer/allProbes_EE_TightMu_pt";
347 
348  MonitorElement *Numerator_detIso_EE_pt = theDbe->get(numpath_detIso_EE_pt);
349  MonitorElement *Denominator_detIso_EE_pt = theDbe->get(denpath_detIso_EE_pt);
350 
351  if (Numerator_detIso_EE_pt && Denominator_detIso_EE_pt){
352 
353  TH1F *h_numerator_detIso_EE_pt = Numerator_detIso_EE_pt->getTH1F();
354  TH1F *h_denominator_detIso_EE_pt = Denominator_detIso_EE_pt->getTH1F();
355 
356  TH1F *h_eff_detIso_EE_pt = h_eff_pt_EE_detIsoTightMu->getTH1F();
357 
358  if (h_eff_detIso_EE_pt->GetSumw2N() == 0) h_eff_detIso_EE_pt->Sumw2();
359 
360  h_eff_detIso_EE_pt->Divide(h_numerator_detIso_EE_pt, h_denominator_detIso_EE_pt, 1., 1., "B");
361 
362  }
363 
364 
366  string numpath_pfIso_pt = "Muons/EfficiencyAnalyzer/passProbes_pfIsoTightMu_pt";
367  string denpath_pfIso_pt = "Muons/EfficiencyAnalyzer/allProbes_TightMu_pt";
368 
369  MonitorElement *Numerator_pfIso_pt = theDbe->get(numpath_pfIso_pt);
370  MonitorElement *Denominator_pfIso_pt = theDbe->get(denpath_pfIso_pt);
371 
372  if (Numerator_pfIso_pt && Denominator_pfIso_pt){
373 
374  TH1F *h_numerator_pfIso_pt = Numerator_pfIso_pt->getTH1F();
375  TH1F *h_denominator_pfIso_pt = Denominator_pfIso_pt->getTH1F();
376 
377  TH1F *h_eff_pfIso_pt = h_eff_pt_pfIsoTightMu->getTH1F();
378 
379  if (h_eff_pfIso_pt->GetSumw2N() == 0) h_eff_pfIso_pt->Sumw2();
380 
381  h_eff_pfIso_pt->Divide(h_numerator_pfIso_pt, h_denominator_pfIso_pt, 1., 1., "B");
382  }
383 
384 
386 
387  string numpath_pfIso_EB_pt = "Muons/EfficiencyAnalyzer/passProbes_EB_pfIsoTightMu_pt";
388  string denpath_pfIso_EB_pt = "Muons/EfficiencyAnalyzer/allProbes_EB_TightMu_pt";
389 
390  MonitorElement *Numerator_pfIso_EB_pt = theDbe->get(numpath_pfIso_EB_pt);
391  MonitorElement *Denominator_pfIso_EB_pt = theDbe->get(denpath_pfIso_EB_pt);
392 
393  if (Numerator_pfIso_EB_pt && Denominator_pfIso_EB_pt){
394 
395  TH1F *h_numerator_pfIso_EB_pt = Numerator_pfIso_EB_pt->getTH1F();
396  TH1F *h_denominator_pfIso_EB_pt = Denominator_pfIso_EB_pt->getTH1F();
397 
398  TH1F *h_eff_pfIso_EB_pt = h_eff_pt_EB_pfIsoTightMu->getTH1F();
399 
400  if (h_eff_pfIso_EB_pt->GetSumw2N() == 0) h_eff_pfIso_EB_pt->Sumw2();
401  h_eff_pfIso_EB_pt->Divide(h_numerator_pfIso_EB_pt, h_denominator_pfIso_EB_pt, 1., 1., "B");
402 
403  }
404 
405 
407  string numpath_pfIso_EE_pt = "Muons/EfficiencyAnalyzer/passProbes_EE_pfIsoTightMu_pt";
408  string denpath_pfIso_EE_pt = "Muons/EfficiencyAnalyzer/allProbes_EE_TightMu_pt";
409 
410  MonitorElement *Numerator_pfIso_EE_pt = theDbe->get(numpath_pfIso_EE_pt);
411  MonitorElement *Denominator_pfIso_EE_pt = theDbe->get(denpath_pfIso_EE_pt);
412 
413  if (Numerator_pfIso_EE_pt && Denominator_pfIso_EE_pt){
414 
415  TH1F *h_numerator_pfIso_EE_pt = Numerator_pfIso_EE_pt->getTH1F();
416  TH1F *h_denominator_pfIso_EE_pt = Denominator_pfIso_EE_pt->getTH1F();
417 
418  TH1F *h_eff_pfIso_EE_pt = h_eff_pt_EE_pfIsoTightMu->getTH1F();
419 
420  if (h_eff_pfIso_EE_pt->GetSumw2N() == 0) h_eff_pfIso_EE_pt->Sumw2();
421 
422  h_eff_pfIso_EE_pt->Divide(h_numerator_pfIso_EE_pt, h_denominator_pfIso_EE_pt, 1., 1., "B");
423 
424  }
425 
426 
428 
429  string numpath_pfIso_nvtx = "Muons/EfficiencyAnalyzer/passProbes_pfIsoTightMu_nVtx";
430  string denpath_pfIso_nvtx = "Muons/EfficiencyAnalyzer/allProbes_TightMu_nVtx";
431 
432  MonitorElement *Numerator_pfIso_nvtx = theDbe->get(numpath_pfIso_nvtx);
433  MonitorElement *Denominator_pfIso_nvtx = theDbe->get(denpath_pfIso_nvtx);
434 
435  if (Numerator_pfIso_nvtx && Denominator_pfIso_nvtx){
436 
437  TH1F *h_numerator_pfIso_nvtx = Numerator_pfIso_nvtx->getTH1F();
438  TH1F *h_denominator_pfIso_nvtx = Denominator_pfIso_nvtx->getTH1F();
439 
440  TH1F *h_eff_pfIso_nvtx = h_eff_vtx_pfIsoTightMu->getTH1F();
441 
442  if (h_eff_pfIso_nvtx->GetSumw2N() == 0) h_eff_pfIso_nvtx->Sumw2();
443 
444  h_eff_pfIso_nvtx->Divide(h_numerator_pfIso_nvtx, h_denominator_pfIso_nvtx, 1., 1., "B");
445 
446  }
447 
448 
449 
451  string numpath_detIso_nvtx = "Muons/EfficiencyAnalyzer/passProbes_detIsoTightMu_nVtx";
452  string denpath_detIso_nvtx = "Muons/EfficiencyAnalyzer/allProbes_TightMu_nVtx";
453 
454  MonitorElement *Numerator_detIso_nvtx = theDbe->get(numpath_detIso_nvtx);
455  MonitorElement *Denominator_detIso_nvtx = theDbe->get(denpath_detIso_nvtx);
456 
457  if (Numerator_detIso_nvtx && Denominator_detIso_nvtx){
458 
459  TH1F *h_numerator_detIso_nvtx = Numerator_detIso_nvtx->getTH1F();
460  TH1F *h_denominator_detIso_nvtx = Denominator_detIso_nvtx->getTH1F();
461 
462  TH1F *h_eff_detIso_nvtx = h_eff_vtx_detIsoTightMu->getTH1F();
463 
464  if (h_eff_detIso_nvtx->GetSumw2N() == 0) h_eff_detIso_nvtx->Sumw2();
465 
466  h_eff_detIso_nvtx->Divide(h_numerator_detIso_nvtx, h_denominator_detIso_nvtx, 1., 1., "B");
467 
468  }
469 
470 
472  numpath_detIso_nvtx = "Muons/EfficiencyAnalyzer/passProbes_EB_detIsoTightMu_nVtx";
473  denpath_detIso_nvtx = "Muons/EfficiencyAnalyzer/allProbes_EB_TightMu_nVtx";
474 
475  Numerator_detIso_nvtx = theDbe->get(numpath_detIso_nvtx);
476  Denominator_detIso_nvtx = theDbe->get(denpath_detIso_nvtx);
477 
478  if (Numerator_detIso_nvtx && Denominator_detIso_nvtx){
479  TH1F *h_numerator_detIso_nvtx = Numerator_detIso_nvtx->getTH1F();
480  TH1F *h_denominator_detIso_nvtx = Denominator_detIso_nvtx->getTH1F();
481 
482  TH1F *h_eff_detIso_nvtx = h_eff_vtx_EB_detIsoTightMu->getTH1F();
483 
484  if (h_eff_detIso_nvtx->GetSumw2N() == 0) h_eff_detIso_nvtx->Sumw2();
485  h_eff_detIso_nvtx->Divide(h_numerator_detIso_nvtx, h_denominator_detIso_nvtx, 1., 1., "B");
486  }
487 
489  numpath_detIso_nvtx = "Muons/EfficiencyAnalyzer/passProbes_EE_detIsoTightMu_nVtx";
490  denpath_detIso_nvtx = "Muons/EfficiencyAnalyzer/allProbes_EE_TightMu_nVtx";
491 
492  Numerator_detIso_nvtx = theDbe->get(numpath_detIso_nvtx);
493  Denominator_detIso_nvtx = theDbe->get(denpath_detIso_nvtx);
494 
495  if (Numerator_detIso_nvtx && Denominator_detIso_nvtx){
496 
497  TH1F *h_numerator_detIso_nvtx = Numerator_detIso_nvtx->getTH1F();
498  TH1F *h_denominator_detIso_nvtx = Denominator_detIso_nvtx->getTH1F();
499 
500  TH1F *h_eff_detIso_nvtx = h_eff_vtx_EE_detIsoTightMu->getTH1F();
501 
502  if (h_eff_detIso_nvtx->GetSumw2N() == 0) h_eff_detIso_nvtx->Sumw2();
503 
504  h_eff_detIso_nvtx->Divide(h_numerator_detIso_nvtx, h_denominator_detIso_nvtx, 1., 1., "B");
505 
506  }
507 
508 
510  numpath_pfIso_nvtx = "Muons/EfficiencyAnalyzer/passProbes_EB_pfIsoTightMu_nVtx";
511  denpath_pfIso_nvtx = "Muons/EfficiencyAnalyzer/allProbes_EB_TightMu_nVtx";
512 
513  Numerator_pfIso_nvtx = theDbe->get(numpath_pfIso_nvtx);
514  Denominator_pfIso_nvtx = theDbe->get(denpath_pfIso_nvtx);
515 
516  if (Numerator_pfIso_nvtx && Denominator_pfIso_nvtx){
517 
518  TH1F *h_numerator_pfIso_nvtx = Numerator_pfIso_nvtx->getTH1F();
519  TH1F *h_denominator_pfIso_nvtx = Denominator_pfIso_nvtx->getTH1F();
520 
521  TH1F *h_eff_pfIso_nvtx = h_eff_vtx_EB_pfIsoTightMu->getTH1F();
522 
523  if (h_eff_pfIso_nvtx->GetSumw2N() == 0) h_eff_pfIso_nvtx->Sumw2();
524 
525  h_eff_pfIso_nvtx->Divide(h_numerator_pfIso_nvtx, h_denominator_pfIso_nvtx, 1., 1., "B");
526  }
527 
529  numpath_pfIso_nvtx = "Muons/EfficiencyAnalyzer/passProbes_EE_pfIsoTightMu_nVtx";
530  denpath_pfIso_nvtx = "Muons/EfficiencyAnalyzer/allProbes_EE_TightMu_nVtx";
531 
532  Numerator_pfIso_nvtx = theDbe->get(numpath_pfIso_nvtx);
533  Denominator_pfIso_nvtx = theDbe->get(denpath_pfIso_nvtx);
534 
535  if (Numerator_pfIso_nvtx && Denominator_pfIso_nvtx){
536 
537  TH1F *h_numerator_pfIso_nvtx = Numerator_pfIso_nvtx->getTH1F();
538  TH1F *h_denominator_pfIso_nvtx = Denominator_pfIso_nvtx->getTH1F();
539 
540  TH1F *h_eff_pfIso_nvtx = h_eff_vtx_EE_pfIsoTightMu->getTH1F();
541 
542  if (h_eff_pfIso_nvtx->GetSumw2N() == 0) h_eff_pfIso_nvtx->Sumw2();
543 
544  h_eff_pfIso_nvtx->Divide(h_numerator_pfIso_nvtx, h_denominator_pfIso_nvtx, 1., 1., "B");
545 
546  }
547 
548 
549 
551  string numpath_pfIsodB_pt = "Muons/EfficiencyAnalyzer/passProbes_pfIsodBTightMu_pt";
552  string denpath_pfIsodB_pt = "Muons/EfficiencyAnalyzer/allProbes_TightMu_pt";
553 
554  MonitorElement *Numerator_pfIsodB_pt = theDbe->get(numpath_pfIsodB_pt);
555  MonitorElement *Denominator_pfIsodB_pt = theDbe->get(denpath_pfIsodB_pt);
556 
557  if (Numerator_pfIsodB_pt && Denominator_pfIsodB_pt){
558 
559  TH1F *h_numerator_pfIsodB_pt = Numerator_pfIsodB_pt->getTH1F();
560  TH1F *h_denominator_pfIsodB_pt = Denominator_pfIsodB_pt->getTH1F();
561 
562  TH1F *h_eff_pfIsodB_pt = h_eff_pt_pfIsodBTightMu->getTH1F();
563 
564  if (h_eff_pfIsodB_pt->GetSumw2N() == 0) h_eff_pfIsodB_pt->Sumw2();
565 
566  h_eff_pfIsodB_pt->Divide(h_numerator_pfIsodB_pt, h_denominator_pfIsodB_pt, 1., 1., "B");
567  }
568 
569 
571 
572  string numpath_pfIsodB_EB_pt = "Muons/EfficiencyAnalyzer/passProbes_EB_pfIsodBTightMu_pt";
573  string denpath_pfIsodB_EB_pt = "Muons/EfficiencyAnalyzer/allProbes_EB_TightMu_pt";
574 
575  MonitorElement *Numerator_pfIsodB_EB_pt = theDbe->get(numpath_pfIsodB_EB_pt);
576  MonitorElement *Denominator_pfIsodB_EB_pt = theDbe->get(denpath_pfIsodB_EB_pt);
577 
578  if (Numerator_pfIsodB_EB_pt && Denominator_pfIsodB_EB_pt){
579 
580  TH1F *h_numerator_pfIsodB_EB_pt = Numerator_pfIsodB_EB_pt->getTH1F();
581  TH1F *h_denominator_pfIsodB_EB_pt = Denominator_pfIsodB_EB_pt->getTH1F();
582 
583  TH1F *h_eff_pfIsodB_EB_pt = h_eff_pt_EB_pfIsodBTightMu->getTH1F();
584 
585  if (h_eff_pfIsodB_EB_pt->GetSumw2N() == 0) h_eff_pfIsodB_EB_pt->Sumw2();
586  h_eff_pfIsodB_EB_pt->Divide(h_numerator_pfIsodB_EB_pt, h_denominator_pfIsodB_EB_pt, 1., 1., "B");
587 
588  }
589 
590 
592  string numpath_pfIsodB_EE_pt = "Muons/EfficiencyAnalyzer/passProbes_EE_pfIsodBTightMu_pt";
593  string denpath_pfIsodB_EE_pt = "Muons/EfficiencyAnalyzer/allProbes_EE_TightMu_pt";
594 
595  MonitorElement *Numerator_pfIsodB_EE_pt = theDbe->get(numpath_pfIsodB_EE_pt);
596  MonitorElement *Denominator_pfIsodB_EE_pt = theDbe->get(denpath_pfIsodB_EE_pt);
597 
598  if (Numerator_pfIsodB_EE_pt && Denominator_pfIsodB_EE_pt){
599 
600  TH1F *h_numerator_pfIsodB_EE_pt = Numerator_pfIsodB_EE_pt->getTH1F();
601  TH1F *h_denominator_pfIsodB_EE_pt = Denominator_pfIsodB_EE_pt->getTH1F();
602 
603  TH1F *h_eff_pfIsodB_EE_pt = h_eff_pt_EE_pfIsodBTightMu->getTH1F();
604 
605  if (h_eff_pfIsodB_EE_pt->GetSumw2N() == 0) h_eff_pfIsodB_EE_pt->Sumw2();
606 
607  h_eff_pfIsodB_EE_pt->Divide(h_numerator_pfIsodB_EE_pt, h_denominator_pfIsodB_EE_pt, 1., 1., "B");
608 
609  }
610 
611 
613 
614  string numpath_pfIsodB_nvtx = "Muons/EfficiencyAnalyzer/passProbes_pfIsodBTightMu_nVtx";
615  string denpath_pfIsodB_nvtx = "Muons/EfficiencyAnalyzer/allProbes_TightMu_nVtx";
616 
617  MonitorElement *Numerator_pfIsodB_nvtx = theDbe->get(numpath_pfIsodB_nvtx);
618  MonitorElement *Denominator_pfIsodB_nvtx = theDbe->get(denpath_pfIsodB_nvtx);
619 
620  if (Numerator_pfIsodB_nvtx && Denominator_pfIsodB_nvtx){
621 
622  TH1F *h_numerator_pfIsodB_nvtx = Numerator_pfIsodB_nvtx->getTH1F();
623  TH1F *h_denominator_pfIsodB_nvtx = Denominator_pfIsodB_nvtx->getTH1F();
624 
625  TH1F *h_eff_pfIsodB_nvtx = h_eff_vtx_pfIsodBTightMu->getTH1F();
626 
627  if (h_eff_pfIsodB_nvtx->GetSumw2N() == 0) h_eff_pfIsodB_nvtx->Sumw2();
628 
629  h_eff_pfIsodB_nvtx->Divide(h_numerator_pfIsodB_nvtx, h_denominator_pfIsodB_nvtx, 1., 1., "B");
630 
631  }
632 
633 
635  numpath_pfIsodB_nvtx = "Muons/EfficiencyAnalyzer/passProbes_EB_pfIsodBTightMu_nVtx";
636  denpath_pfIsodB_nvtx = "Muons/EfficiencyAnalyzer/allProbes_EB_TightMu_nVtx";
637 
638  Numerator_pfIsodB_nvtx = theDbe->get(numpath_pfIsodB_nvtx);
639  Denominator_pfIsodB_nvtx = theDbe->get(denpath_pfIsodB_nvtx);
640 
641  if (Numerator_pfIsodB_nvtx && Denominator_pfIsodB_nvtx){
642 
643  TH1F *h_numerator_pfIsodB_nvtx = Numerator_pfIsodB_nvtx->getTH1F();
644  TH1F *h_denominator_pfIsodB_nvtx = Denominator_pfIsodB_nvtx->getTH1F();
645 
646  TH1F *h_eff_pfIsodB_nvtx = h_eff_vtx_EB_pfIsodBTightMu->getTH1F();
647 
648  if (h_eff_pfIsodB_nvtx->GetSumw2N() == 0) h_eff_pfIsodB_nvtx->Sumw2();
649 
650  h_eff_pfIsodB_nvtx->Divide(h_numerator_pfIsodB_nvtx, h_denominator_pfIsodB_nvtx, 1., 1., "B");
651  }
652 
653 
655  numpath_pfIsodB_nvtx = "Muons/EfficiencyAnalyzer/passProbes_EE_pfIsodBTightMu_nVtx";
656  denpath_pfIsodB_nvtx = "Muons/EfficiencyAnalyzer/allProbes_EE_TightMu_nVtx";
657 
658  Numerator_pfIsodB_nvtx = theDbe->get(numpath_pfIsodB_nvtx);
659  Denominator_pfIsodB_nvtx = theDbe->get(denpath_pfIsodB_nvtx);
660 
661  if (Numerator_pfIsodB_nvtx && Denominator_pfIsodB_nvtx){
662 
663  TH1F *h_numerator_pfIsodB_nvtx = Numerator_pfIsodB_nvtx->getTH1F();
664  TH1F *h_denominator_pfIsodB_nvtx = Denominator_pfIsodB_nvtx->getTH1F();
665 
666  TH1F *h_eff_pfIsodB_nvtx = h_eff_vtx_EE_pfIsodBTightMu->getTH1F();
667 
668  if (h_eff_pfIsodB_nvtx->GetSumw2N() == 0) h_eff_pfIsodB_nvtx->Sumw2();
669 
670  h_eff_pfIsodB_nvtx->Divide(h_numerator_pfIsodB_nvtx, h_denominator_pfIsodB_nvtx, 1., 1., "B");
671 
672  }
673 
674 
675 }
676 
677 
679  LogTrace(metname)<< "[EfficiencyPlotter] endJob called!";
680  theDbe->rmdir("Muons/EfficiencyAnalyzer");
681 }
682 
void endLuminosityBlock(edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &c)
DQM Client Diagnostic.
LuminosityBlockID id() const
dictionary parameters
Definition: Parameters.py:2
const std::string metname
EfficiencyPlotter(const edm::ParameterSet &ps)
Constructor.
void endJob()
Endjob.
void beginLuminosityBlock(edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &context)
virtual ~EfficiencyPlotter()
Destructor.
RunNumber_t run() const
int nevents
#define LogTrace(id)
void endRun(edm::Run const &run, edm::EventSetup const &eSetup)
void analyze(const edm::Event &e, const edm::EventSetup &c)
Analyze.
TH1F * getTH1F(void) const
void beginJob(void)
BeginJob.
void beginRun(edm::Run const &run, edm::EventSetup const &eSetup)
LuminosityBlockNumber_t luminosityBlock() const
tuple cout
Definition: gather_cfg.py:121
Definition: Run.h:41