Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-12-01 03:53:40

0001 #include "DQMOffline/Muon/interface/EfficiencyPlotter.h"
0002 
0003 // Framework
0004 #include <FWCore/Framework/interface/Event.h>
0005 #include "DataFormats/Common/interface/Handle.h"
0006 #include <FWCore/Framework/interface/ESHandle.h>
0007 #include <FWCore/Framework/interface/MakerMacros.h>
0008 #include <FWCore/Framework/interface/EventSetup.h>
0009 #include <FWCore/ParameterSet/interface/ParameterSet.h>
0010 
0011 #include "DQMServices/Core/interface/DQMStore.h"
0012 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0013 #include "FWCore/Framework/interface/Run.h"
0014 
0015 #include <iostream>
0016 #include <cstdio>
0017 #include <string>
0018 #include <cmath>
0019 #include "TF1.h"
0020 #include "TH1F.h"
0021 
0022 using namespace edm;
0023 using namespace std;
0024 
0025 //#define DEBUG
0026 
0027 EfficiencyPlotter::EfficiencyPlotter(const edm::ParameterSet &ps) {
0028 #ifdef DEBUG
0029   cout << "EfficiencyPlotter(): Constructor " << endl;
0030 #endif
0031   parameters = ps;
0032 
0033   etaBin = parameters.getParameter<int>("etaBin");
0034   etaMin = parameters.getParameter<double>("etaMin");
0035   etaMax = parameters.getParameter<double>("etaMax");
0036 
0037   phiBin = parameters.getParameter<int>("phiBin");
0038   phiMin = parameters.getParameter<double>("phiMin");
0039   phiMax = parameters.getParameter<double>("phiMax");
0040 
0041   ptBin = parameters.getParameter<int>("ptBin");
0042   ptMin = parameters.getParameter<double>("ptMin");
0043   ptMax = parameters.getParameter<double>("ptMax");
0044 
0045   vtxBin = parameters.getParameter<int>("vtxBin");
0046   vtxMin = parameters.getParameter<double>("vtxMin");
0047   vtxMax = parameters.getParameter<double>("vtxMax");
0048 
0049   ID_ = parameters.getParameter<string>("MuonID");
0050   theFolder = parameters.getParameter<string>("folder");
0051 }
0052 EfficiencyPlotter::~EfficiencyPlotter() {}
0053 
0054 void EfficiencyPlotter::dqmEndJob(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter) {
0055   ibooker.setCurrentFolder(theFolder);
0056 
0057   // efficiency plot
0058   h_eff_eta_ID = ibooker.book1D("Eff_eta_" + ID_, ID_ + " Eff. vs #eta", etaBin, etaMin, etaMax);
0059   h_eff_inner_pt_ID = ibooker.book1D("Eff_inner_pt_" + ID_, ID_ + " Eff. vs pt", ptBin, ptMin, ptMax);
0060   h_eff_inner_eta_ID = ibooker.book1D("Eff_inner_eta_" + ID_, ID_ + " Eff. vs #eta", etaBin, etaMin, etaMax);
0061   h_eff_inner_phi_ID = ibooker.book1D("Eff_inner_phi_" + ID_, ID_ + " Eff. vs #phi", phiBin, phiMin, phiMax);
0062   h_eff_hp_eta_ID =
0063       ibooker.book1D("Eff_hp_eta_" + ID_, "High Pt (Pt>20)" + ID_ + " Eff. vs #eta", etaBin, etaMin, etaMax);
0064   h_eff_phi_ID = ibooker.book1D("Eff_phi_" + ID_, ID_ + " Eff. vs #phi", phiBin, phiMin, phiMax);
0065   h_eff_pt_ID = ibooker.book1D("Eff_pt_" + ID_, ID_ + " Eff. vs Pt", ptBin, ptMin, ptMax);
0066   h_eff_pt_EB_ID = ibooker.book1D("Eff_pt_EB_" + ID_, "Barrel: " + ID_ + " Eff. vs Pt", ptBin, ptMin, ptMax);
0067   h_eff_pt_EE_ID = ibooker.book1D("Eff_pt_EE_" + ID_, "Endcap: " + ID_ + " Eff. vs Pt", ptBin, ptMin, ptMax);
0068   h_eff_pt_detIsoID = ibooker.book1D("Eff_pt_detIso" + ID_, "detIso" + ID_ + " Efficiency vs Pt", ptBin, ptMin, ptMax);
0069   h_eff_pt_EB_detIsoID =
0070       ibooker.book1D("Eff_pt_EB_detIso" + ID_, "Barrel: detIso" + ID_ + " Eff. vs Pt", ptBin, ptMin, ptMax);
0071   h_eff_pt_EE_detIsoID =
0072       ibooker.book1D("Eff_pt_EE_detIso" + ID_, "Endcap: detIso" + ID_ + " Eff. vs Pt", ptBin, ptMin, ptMax);
0073   h_eff_pt_pfIsoID = ibooker.book1D("Eff_pt_pfIso" + ID_, "pfIso" + ID_ + " Eff. vs Pt", ptBin, ptMin, ptMax);
0074   h_eff_pt_EB_pfIsoID =
0075       ibooker.book1D("Eff_pt_EB_pfIso" + ID_, "Barrel: pfIso" + ID_ + " Eff. vs Pt", ptBin, ptMin, ptMax);
0076   h_eff_pt_EE_pfIsoID =
0077       ibooker.book1D("Eff_pt_EE_pfIso" + ID_, "Endcap: pfIso" + ID_ + " Eff. vs Pt", ptBin, ptMin, ptMax);
0078   h_eff_vtx_detIsoID = ibooker.book1D("Eff_vtx_detIso" + ID_, "detIso" + ID_ + " Eff. vs nVtx", vtxBin, vtxMin, vtxMax);
0079   h_eff_vtx_pfIsoID = ibooker.book1D("Eff_vtx_pfIso" + ID_, "pfIso" + ID_ + " Eff. vs nVtx", vtxBin, vtxMin, vtxMax);
0080   h_eff_vtx_EB_detIsoID =
0081       ibooker.book1D("Eff_vtx_EB_detIso" + ID_, "Barrel: detIso" + ID_ + " Eff. vs nVtx", vtxBin, vtxMin, vtxMax);
0082   h_eff_vtx_EB_pfIsoID =
0083       ibooker.book1D("Eff_vtx_EB_pfIso" + ID_, "Barrel: pfIso" + ID_ + " Eff. vs nVtx", vtxBin, vtxMin, vtxMax);
0084   h_eff_vtx_EE_detIsoID =
0085       ibooker.book1D("Eff_vtx_EE_detIso" + ID_, "Endcap: detIso" + ID_ + " Eff. vs nVtx", vtxBin, vtxMin, vtxMax);
0086   h_eff_vtx_EE_pfIsoID =
0087       ibooker.book1D("Eff_vtx_EE_pfIso" + ID_, "Endcap: pfIso" + ID_ + " Eff. vs nVtx", vtxBin, vtxMin, vtxMax);
0088 
0089   h_eff_pt_pfIsodBID =
0090       ibooker.book1D("Eff_pt_pfIsodB" + ID_, "pfIso" + ID_ + " (deltaBeta) Eff. vs Pt", ptBin, ptMin, ptMax);
0091   h_eff_pt_EB_pfIsodBID =
0092       ibooker.book1D("Eff_pt_EB_pfIsodB" + ID_, "Barrel: pfIso" + ID_ + " (deltaBeta) Eff. vs Pt", ptBin, ptMin, ptMax);
0093   h_eff_pt_EE_pfIsodBID =
0094       ibooker.book1D("Eff_pt_EE_pfIsodB" + ID_, "Endcap: pfIso" + ID_ + " (deltaBeta) Eff. vs Pt", ptBin, ptMin, ptMax);
0095   h_eff_vtx_pfIsodBID =
0096       ibooker.book1D("Eff_vtx_pfIsodB" + ID_, "pfIso" + ID_ + " (deltaBeta) Eff. vs nVtx", vtxBin, vtxMin, vtxMax);
0097   h_eff_vtx_EB_pfIsodBID = ibooker.book1D(
0098       "Eff_vtx_EB_pfIsodB" + ID_, "Barrel: pfIso" + ID_ + " (deltaBeta) Eff. vs nVtx", vtxBin, vtxMin, vtxMax);
0099   h_eff_vtx_EE_pfIsodBID = ibooker.book1D(
0100       "Eff_vtx_EE_pfIsodB" + ID_, "Endcap: pfIso" + ID_ + " (deltaBeta) Eff. vs nVtx", vtxBin, vtxMin, vtxMax);
0101 
0102   // This prevents this ME to be normalized when drawn into the GUI
0103   h_eff_eta_ID->setEfficiencyFlag();
0104   h_eff_inner_eta_ID->setEfficiencyFlag();
0105   h_eff_inner_pt_ID->setEfficiencyFlag();
0106   h_eff_inner_phi_ID->setEfficiencyFlag();
0107   h_eff_hp_eta_ID->setEfficiencyFlag();
0108   h_eff_phi_ID->setEfficiencyFlag();
0109   h_eff_pt_ID->setEfficiencyFlag();
0110   h_eff_pt_EB_ID->setEfficiencyFlag();
0111   h_eff_pt_EE_ID->setEfficiencyFlag();
0112   h_eff_pt_detIsoID->setEfficiencyFlag();
0113   h_eff_pt_EB_detIsoID->setEfficiencyFlag();
0114   h_eff_pt_EE_detIsoID->setEfficiencyFlag();
0115   h_eff_pt_pfIsoID->setEfficiencyFlag();
0116   h_eff_pt_EB_pfIsoID->setEfficiencyFlag();
0117   h_eff_pt_EE_pfIsoID->setEfficiencyFlag();
0118   h_eff_vtx_detIsoID->setEfficiencyFlag();
0119   h_eff_vtx_pfIsoID->setEfficiencyFlag();
0120   h_eff_vtx_EB_detIsoID->setEfficiencyFlag();
0121   h_eff_vtx_EB_pfIsoID->setEfficiencyFlag();
0122   h_eff_vtx_EE_detIsoID->setEfficiencyFlag();
0123   h_eff_vtx_EE_pfIsoID->setEfficiencyFlag();
0124 
0125   h_eff_pt_pfIsodBID->setEfficiencyFlag();
0126   h_eff_pt_EB_pfIsodBID->setEfficiencyFlag();
0127   h_eff_pt_EE_pfIsodBID->setEfficiencyFlag();
0128   h_eff_vtx_pfIsodBID->setEfficiencyFlag();
0129   h_eff_vtx_EB_pfIsodBID->setEfficiencyFlag();
0130   h_eff_vtx_EE_pfIsodBID->setEfficiencyFlag();
0131 
0132   // AXIS TITLES....
0133   h_eff_hp_eta_ID->setAxisTitle("#eta", 1);
0134   h_eff_inner_eta_ID->setAxisTitle("#eta", 1);
0135   h_eff_inner_pt_ID->setAxisTitle("#eta", 1);
0136   h_eff_inner_phi_ID->setAxisTitle("#eta", 1);
0137   h_eff_eta_ID->setAxisTitle("#eta", 1);
0138   h_eff_phi_ID->setAxisTitle("#phi", 1);
0139   h_eff_pt_ID->setAxisTitle("p_{T} (GeV)", 1);
0140   h_eff_pt_EB_ID->setAxisTitle("p_{T} (GeV)", 1);
0141   h_eff_pt_EE_ID->setAxisTitle("p_{T} (GeV)", 1);
0142   h_eff_pt_detIsoID->setAxisTitle("p_{T} (GeV)", 1);
0143   h_eff_pt_EB_detIsoID->setAxisTitle("p_{T} (GeV)", 1);
0144   h_eff_pt_EE_detIsoID->setAxisTitle("p_{T} (GeV)", 1);
0145   h_eff_pt_pfIsoID->setAxisTitle("p_{T} (GeV)", 1);
0146   h_eff_pt_EB_pfIsoID->setAxisTitle("p_{T} (GeV)", 1);
0147   h_eff_pt_EE_pfIsoID->setAxisTitle("p_{T} (GeV)", 1);
0148   h_eff_vtx_detIsoID->setAxisTitle("Number of PV", 1);
0149   h_eff_vtx_pfIsoID->setAxisTitle("Number of PV", 1);
0150   h_eff_vtx_EB_detIsoID->setAxisTitle("Number of PV", 1);
0151   h_eff_vtx_EB_pfIsoID->setAxisTitle("Number of PV", 1);
0152   h_eff_vtx_EE_detIsoID->setAxisTitle("Number of PV", 1);
0153   h_eff_vtx_EE_pfIsoID->setAxisTitle("Number of PV", 1);
0154 
0155   h_eff_pt_pfIsodBID->setAxisTitle("p_{T} (GeV)", 1);
0156   h_eff_pt_EB_pfIsodBID->setAxisTitle("p_{T} (GeV)", 1);
0157   h_eff_pt_EE_pfIsodBID->setAxisTitle("p_{T} (GeV)", 1);
0158   h_eff_vtx_pfIsodBID->setAxisTitle("Number of PV", 1);
0159   h_eff_vtx_EB_pfIsodBID->setAxisTitle("Number of PV", 1);
0160   h_eff_vtx_EE_pfIsodBID->setAxisTitle("Number of PV", 1);
0161 
0162   /// --- Tight Muon efficiency vs muon Pt
0163   string inputdir = "Muons/EfficiencyAnalyzer/" + ID_;
0164   string numpath_pt = inputdir + "/passProbes_ID_pt";
0165   string denpath_pt = inputdir + "/allProbes_pt";
0166 
0167   MonitorElement *Numerator_pt = igetter.get(numpath_pt);
0168   MonitorElement *Denominator_pt = igetter.get(denpath_pt);
0169 
0170   if (Numerator_pt && Denominator_pt) {
0171     TH1F *h_numerator_pt = Numerator_pt->getTH1F();
0172     TH1F *h_denominator_pt = Denominator_pt->getTH1F();
0173     TH1F *h_eff_pt = h_eff_pt_ID->getTH1F();
0174 
0175     if (h_eff_pt->GetSumw2N() == 0)
0176       h_eff_pt->Sumw2();
0177     h_eff_pt->Divide(h_numerator_pt, h_denominator_pt, 1., 1., "B");
0178   }
0179 
0180   /// --- Tight Muon efficiency vs muon inner Pt
0181   string numpath_inner_pt = inputdir + "/passProbes_ID_inner_pt";
0182   string denpath_inner_pt = inputdir + "/allProbes_inner_pt";
0183 
0184   MonitorElement *Numerator_inner_pt = igetter.get(numpath_inner_pt);
0185   MonitorElement *Denominator_inner_pt = igetter.get(denpath_inner_pt);
0186 
0187   if (Numerator_inner_pt && Denominator_inner_pt) {
0188     TH1F *h_numerator_inner_pt = Numerator_inner_pt->getTH1F();
0189     TH1F *h_denominator_inner_pt = Denominator_inner_pt->getTH1F();
0190     TH1F *h_eff_inner_pt = h_eff_inner_pt_ID->getTH1F();
0191 
0192     if (h_eff_inner_pt->GetSumw2N() == 0)
0193       h_eff_inner_pt->Sumw2();
0194     h_eff_inner_pt->Divide(h_numerator_inner_pt, h_denominator_inner_pt, 1., 1., "B");
0195   }
0196 
0197   /// --- Tight Muon efficiency vs muon inner eta
0198   string numpath_inner_eta = inputdir + "/passProbes_ID_inner_eta";
0199   string denpath_inner_eta = inputdir + "/allProbes_inner_eta";
0200 
0201   MonitorElement *Numerator_inner_eta = igetter.get(numpath_inner_eta);
0202   MonitorElement *Denominator_inner_eta = igetter.get(denpath_inner_eta);
0203 
0204   if (Numerator_inner_eta && Denominator_inner_eta) {
0205     TH1F *h_numerator_inner_eta = Numerator_inner_eta->getTH1F();
0206     TH1F *h_denominator_inner_eta = Denominator_inner_eta->getTH1F();
0207     TH1F *h_eff_inner_eta = h_eff_inner_eta_ID->getTH1F();
0208 
0209     if (h_eff_inner_eta->GetSumw2N() == 0)
0210       h_eff_inner_eta->Sumw2();
0211     h_eff_inner_eta->Divide(h_numerator_inner_eta, h_denominator_inner_eta, 1., 1., "B");
0212   }
0213 
0214   /// --- Tight Muon efficiency vs muon inner phi
0215   string numpath_inner_phi = inputdir + "/passProbes_ID_inner_phi";
0216   string denpath_inner_phi = inputdir + "/allProbes_inner_phi";
0217 
0218   MonitorElement *Numerator_inner_phi = igetter.get(numpath_inner_phi);
0219   MonitorElement *Denominator_inner_phi = igetter.get(denpath_inner_phi);
0220 
0221   if (Numerator_inner_phi && Denominator_inner_phi) {
0222     TH1F *h_numerator_inner_phi = Numerator_inner_phi->getTH1F();
0223     TH1F *h_denominator_inner_phi = Denominator_inner_phi->getTH1F();
0224     TH1F *h_eff_inner_phi = h_eff_inner_phi_ID->getTH1F();
0225 
0226     if (h_eff_inner_phi->GetSumw2N() == 0)
0227       h_eff_inner_phi->Sumw2();
0228     h_eff_inner_phi->Divide(h_numerator_inner_phi, h_denominator_inner_phi, 1., 1., "B");
0229   }
0230 
0231   /// --- Tight Muon efficiency vs muon Pt [EB]
0232   string numpath_EB_pt = inputdir + "/passProbes_ID_EB_pt";
0233   string denpath_EB_pt = inputdir + "/allProbes_EB_pt";
0234 
0235   MonitorElement *Numerator_EB_pt = igetter.get(numpath_EB_pt);
0236   MonitorElement *Denominator_EB_pt = igetter.get(denpath_EB_pt);
0237 
0238   if (Numerator_EB_pt && Denominator_EB_pt) {
0239     TH1F *h_numerator_EB_pt = Numerator_EB_pt->getTH1F();
0240     TH1F *h_denominator_EB_pt = Denominator_EB_pt->getTH1F();
0241     TH1F *h_eff_EB_pt = h_eff_pt_EB_ID->getTH1F();
0242 
0243     if (h_eff_EB_pt->GetSumw2N() == 0)
0244       h_eff_EB_pt->Sumw2();
0245     h_eff_EB_pt->Divide(h_numerator_EB_pt, h_denominator_EB_pt, 1., 1., "B");
0246   }
0247 
0248   /// --- Tight Muon efficiency vs muon Pt [EE]
0249   string numpath_EE_pt = inputdir + "/passProbes_ID_EE_pt";
0250   string denpath_EE_pt = inputdir + "/allProbes_EE_pt";
0251 
0252   MonitorElement *Numerator_EE_pt = igetter.get(numpath_EE_pt);
0253   MonitorElement *Denominator_EE_pt = igetter.get(denpath_EE_pt);
0254 
0255   if (Numerator_EE_pt && Denominator_EE_pt) {
0256     TH1F *h_numerator_EE_pt = Numerator_EE_pt->getTH1F();
0257     TH1F *h_denominator_EE_pt = Denominator_EE_pt->getTH1F();
0258     TH1F *h_eff_EE_pt = h_eff_pt_EE_ID->getTH1F();
0259 
0260     if (h_eff_EE_pt->GetSumw2N() == 0)
0261       h_eff_EE_pt->Sumw2();
0262     h_eff_EE_pt->Divide(h_numerator_EE_pt, h_denominator_EE_pt, 1., 1., "B");
0263   }
0264 
0265   /// --- Tight Muon efficiency vs muon Eta
0266   string numpath_eta = inputdir + "/passProbes_ID_eta";
0267   string denpath_eta = inputdir + "/allProbes_eta";
0268 
0269   MonitorElement *Numerator_eta = igetter.get(numpath_eta);
0270   MonitorElement *Denominator_eta = igetter.get(denpath_eta);
0271 
0272   if (Numerator_eta && Denominator_eta) {
0273     TH1F *h_numerator_eta = Numerator_eta->getTH1F();
0274     TH1F *h_denominator_eta = Denominator_eta->getTH1F();
0275 
0276     TH1F *h_eff_eta = h_eff_eta_ID->getTH1F();
0277 
0278     if (h_eff_eta->GetSumw2N() == 0)
0279       h_eff_eta->Sumw2();
0280 
0281     h_eff_eta->Divide(h_numerator_eta, h_denominator_eta, 1., 1., "B");
0282   }
0283 
0284   /// --- Tight Muon efficiency vs muon Eta [ pt > 20 ]
0285 
0286   string numpath_hp_eta = inputdir + "/passProbes_ID_hp_eta";
0287   string denpath_hp_eta = inputdir + "/allProbes_hp_eta";
0288 
0289   MonitorElement *Numerator_hp_eta = igetter.get(numpath_hp_eta);
0290   MonitorElement *Denominator_hp_eta = igetter.get(denpath_hp_eta);
0291 
0292   if (Numerator_hp_eta && Denominator_hp_eta) {
0293     TH1F *h_numerator_hp_eta = Numerator_hp_eta->getTH1F();
0294     TH1F *h_denominator_hp_eta = Denominator_hp_eta->getTH1F();
0295 
0296     TH1F *h_eff_hp_eta = h_eff_hp_eta_ID->getTH1F();
0297 
0298     if (h_eff_hp_eta->GetSumw2N() == 0)
0299       h_eff_hp_eta->Sumw2();
0300 
0301     h_eff_hp_eta->Divide(h_numerator_hp_eta, h_denominator_hp_eta, 1., 1., "B");
0302   }
0303 
0304   /// --- Tight Muon efficiency vs muon Phi
0305 
0306   string numpath_phi = inputdir + "/passProbes_ID_phi";
0307   string denpath_phi = inputdir + "/allProbes_phi";
0308 
0309   MonitorElement *Numerator_phi = igetter.get(numpath_phi);
0310   MonitorElement *Denominator_phi = igetter.get(denpath_phi);
0311 
0312   if (Numerator_phi && Denominator_phi) {
0313     TH1F *h_numerator_phi = Numerator_phi->getTH1F();
0314     TH1F *h_denominator_phi = Denominator_phi->getTH1F();
0315 
0316     TH1F *h_eff_phi = h_eff_phi_ID->getTH1F();
0317 
0318     if (h_eff_phi->GetSumw2N() == 0)
0319       h_eff_phi->Sumw2();
0320 
0321     h_eff_phi->Divide(h_numerator_phi, h_denominator_phi, 1., 1., "B");
0322   }
0323 
0324   /// --- Tight Muon + Detector Isolation  efficiency vs muon Pt
0325   string numpath_detIso_pt = inputdir + "/passProbes_detIsoID_pt";
0326   string denpath_detIso_pt = inputdir + "/allProbes_ID_pt";
0327 
0328   MonitorElement *Numerator_detIso_pt = igetter.get(numpath_detIso_pt);
0329   MonitorElement *Denominator_detIso_pt = igetter.get(denpath_detIso_pt);
0330 
0331   if (Numerator_detIso_pt && Denominator_detIso_pt) {
0332     TH1F *h_numerator_detIso_pt = Numerator_detIso_pt->getTH1F();
0333     TH1F *h_denominator_detIso_pt = Denominator_detIso_pt->getTH1F();
0334 
0335     TH1F *h_eff_detIso_pt = h_eff_pt_detIsoID->getTH1F();
0336 
0337     if (h_eff_detIso_pt->GetSumw2N() == 0)
0338       h_eff_detIso_pt->Sumw2();
0339     h_eff_detIso_pt->Divide(h_numerator_detIso_pt, h_denominator_detIso_pt, 1., 1., "B");
0340   }
0341 
0342   /// --- Tight Muon + Detector Isolation  efficiency vs muon Pt [EB]
0343   string numpath_detIso_EB_pt = inputdir + "/passProbes_EB_detIsoID_pt";
0344   string denpath_detIso_EB_pt = inputdir + "/allProbes_EB_ID_pt";
0345 
0346   MonitorElement *Numerator_detIso_EB_pt = igetter.get(numpath_detIso_EB_pt);
0347   MonitorElement *Denominator_detIso_EB_pt = igetter.get(denpath_detIso_EB_pt);
0348 
0349   if (Numerator_detIso_EB_pt && Denominator_detIso_EB_pt) {
0350     TH1F *h_numerator_detIso_EB_pt = Numerator_detIso_EB_pt->getTH1F();
0351     TH1F *h_denominator_detIso_EB_pt = Denominator_detIso_EB_pt->getTH1F();
0352 
0353     TH1F *h_eff_detIso_EB_pt = h_eff_pt_EB_detIsoID->getTH1F();
0354 
0355     if (h_eff_detIso_EB_pt->GetSumw2N() == 0)
0356       h_eff_detIso_EB_pt->Sumw2();
0357 
0358     h_eff_detIso_EB_pt->Divide(h_numerator_detIso_EB_pt, h_denominator_detIso_EB_pt, 1., 1., "B");
0359   }
0360 
0361   /// --- Tight Muon + Detector Isolation  efficiency vs muon Pt [EE]
0362   string numpath_detIso_EE_pt = inputdir + "/passProbes_EE_detIsoID_pt";
0363   string denpath_detIso_EE_pt = inputdir + "/allProbes_EE_ID_pt";
0364 
0365   MonitorElement *Numerator_detIso_EE_pt = igetter.get(numpath_detIso_EE_pt);
0366   MonitorElement *Denominator_detIso_EE_pt = igetter.get(denpath_detIso_EE_pt);
0367 
0368   if (Numerator_detIso_EE_pt && Denominator_detIso_EE_pt) {
0369     TH1F *h_numerator_detIso_EE_pt = Numerator_detIso_EE_pt->getTH1F();
0370     TH1F *h_denominator_detIso_EE_pt = Denominator_detIso_EE_pt->getTH1F();
0371 
0372     TH1F *h_eff_detIso_EE_pt = h_eff_pt_EE_detIsoID->getTH1F();
0373 
0374     if (h_eff_detIso_EE_pt->GetSumw2N() == 0)
0375       h_eff_detIso_EE_pt->Sumw2();
0376 
0377     h_eff_detIso_EE_pt->Divide(h_numerator_detIso_EE_pt, h_denominator_detIso_EE_pt, 1., 1., "B");
0378   }
0379 
0380   /// --- Tight Muon + PF Isolation  efficiency vs muon Pt
0381   string numpath_pfIso_pt = inputdir + "/passProbes_pfIsoID_pt";
0382   string denpath_pfIso_pt = inputdir + "/allProbes_ID_pt";
0383 
0384   MonitorElement *Numerator_pfIso_pt = igetter.get(numpath_pfIso_pt);
0385   MonitorElement *Denominator_pfIso_pt = igetter.get(denpath_pfIso_pt);
0386 
0387   if (Numerator_pfIso_pt && Denominator_pfIso_pt) {
0388     TH1F *h_numerator_pfIso_pt = Numerator_pfIso_pt->getTH1F();
0389     TH1F *h_denominator_pfIso_pt = Denominator_pfIso_pt->getTH1F();
0390 
0391     TH1F *h_eff_pfIso_pt = h_eff_pt_pfIsoID->getTH1F();
0392 
0393     if (h_eff_pfIso_pt->GetSumw2N() == 0)
0394       h_eff_pfIso_pt->Sumw2();
0395 
0396     h_eff_pfIso_pt->Divide(h_numerator_pfIso_pt, h_denominator_pfIso_pt, 1., 1., "B");
0397   }
0398 
0399   /// --- Tight Muon + PF Isolation  efficiency vs muon Pt [EB]
0400 
0401   string numpath_pfIso_EB_pt = inputdir + "/passProbes_EB_pfIsoID_pt";
0402   string denpath_pfIso_EB_pt = inputdir + "/allProbes_EB_ID_pt";
0403 
0404   MonitorElement *Numerator_pfIso_EB_pt = igetter.get(numpath_pfIso_EB_pt);
0405   MonitorElement *Denominator_pfIso_EB_pt = igetter.get(denpath_pfIso_EB_pt);
0406 
0407   if (Numerator_pfIso_EB_pt && Denominator_pfIso_EB_pt) {
0408     TH1F *h_numerator_pfIso_EB_pt = Numerator_pfIso_EB_pt->getTH1F();
0409     TH1F *h_denominator_pfIso_EB_pt = Denominator_pfIso_EB_pt->getTH1F();
0410 
0411     TH1F *h_eff_pfIso_EB_pt = h_eff_pt_EB_pfIsoID->getTH1F();
0412 
0413     if (h_eff_pfIso_EB_pt->GetSumw2N() == 0)
0414       h_eff_pfIso_EB_pt->Sumw2();
0415     h_eff_pfIso_EB_pt->Divide(h_numerator_pfIso_EB_pt, h_denominator_pfIso_EB_pt, 1., 1., "B");
0416   }
0417 
0418   /// --- Tight Muon + PF Isolation  efficiency vs muon Pt [EE]
0419   string numpath_pfIso_EE_pt = inputdir + "/passProbes_EE_pfIsoID_pt";
0420   string denpath_pfIso_EE_pt = inputdir + "/allProbes_EE_ID_pt";
0421 
0422   MonitorElement *Numerator_pfIso_EE_pt = igetter.get(numpath_pfIso_EE_pt);
0423   MonitorElement *Denominator_pfIso_EE_pt = igetter.get(denpath_pfIso_EE_pt);
0424 
0425   if (Numerator_pfIso_EE_pt && Denominator_pfIso_EE_pt) {
0426     TH1F *h_numerator_pfIso_EE_pt = Numerator_pfIso_EE_pt->getTH1F();
0427     TH1F *h_denominator_pfIso_EE_pt = Denominator_pfIso_EE_pt->getTH1F();
0428 
0429     TH1F *h_eff_pfIso_EE_pt = h_eff_pt_EE_pfIsoID->getTH1F();
0430 
0431     if (h_eff_pfIso_EE_pt->GetSumw2N() == 0)
0432       h_eff_pfIso_EE_pt->Sumw2();
0433 
0434     h_eff_pfIso_EE_pt->Divide(h_numerator_pfIso_EE_pt, h_denominator_pfIso_EE_pt, 1., 1., "B");
0435   }
0436 
0437   /// --- Tight Muon + PF Isolation  efficiency vs muon number of reco Vertex
0438 
0439   string numpath_pfIso_nvtx = inputdir + "/passProbes_pfIsoID_nVtx";
0440   string denpath_pfIso_nvtx = inputdir + "/allProbes_ID_nVtx";
0441 
0442   MonitorElement *Numerator_pfIso_nvtx = igetter.get(numpath_pfIso_nvtx);
0443   MonitorElement *Denominator_pfIso_nvtx = igetter.get(denpath_pfIso_nvtx);
0444 
0445   if (Numerator_pfIso_nvtx && Denominator_pfIso_nvtx) {
0446     TH1F *h_numerator_pfIso_nvtx = Numerator_pfIso_nvtx->getTH1F();
0447     TH1F *h_denominator_pfIso_nvtx = Denominator_pfIso_nvtx->getTH1F();
0448 
0449     TH1F *h_eff_pfIso_nvtx = h_eff_vtx_pfIsoID->getTH1F();
0450 
0451     if (h_eff_pfIso_nvtx->GetSumw2N() == 0)
0452       h_eff_pfIso_nvtx->Sumw2();
0453 
0454     h_eff_pfIso_nvtx->Divide(h_numerator_pfIso_nvtx, h_denominator_pfIso_nvtx, 1., 1., "B");
0455   }
0456 
0457   /// --- Tight Muon + detector-Based Isolation  efficiency vs muon number of reco Vertex
0458   string numpath_detIso_nvtx = inputdir + "/passProbes_detIsoID_nVtx";
0459   string denpath_detIso_nvtx = inputdir + "/allProbes_ID_nVtx";
0460 
0461   MonitorElement *Numerator_detIso_nvtx = igetter.get(numpath_detIso_nvtx);
0462   MonitorElement *Denominator_detIso_nvtx = igetter.get(denpath_detIso_nvtx);
0463 
0464   if (Numerator_detIso_nvtx && Denominator_detIso_nvtx) {
0465     TH1F *h_numerator_detIso_nvtx = Numerator_detIso_nvtx->getTH1F();
0466     TH1F *h_denominator_detIso_nvtx = Denominator_detIso_nvtx->getTH1F();
0467 
0468     TH1F *h_eff_detIso_nvtx = h_eff_vtx_detIsoID->getTH1F();
0469 
0470     if (h_eff_detIso_nvtx->GetSumw2N() == 0)
0471       h_eff_detIso_nvtx->Sumw2();
0472 
0473     h_eff_detIso_nvtx->Divide(h_numerator_detIso_nvtx, h_denominator_detIso_nvtx, 1., 1., "B");
0474   }
0475 
0476   /// --- Tight Muon + detector-Based Isolation  efficiency vs muon number of reco Vertex [EB]
0477   numpath_detIso_nvtx = inputdir + "/passProbes_EB_detIsoID_nVtx";
0478   denpath_detIso_nvtx = inputdir + "/allProbes_EB_ID_nVtx";
0479 
0480   Numerator_detIso_nvtx = igetter.get(numpath_detIso_nvtx);
0481   Denominator_detIso_nvtx = igetter.get(denpath_detIso_nvtx);
0482 
0483   if (Numerator_detIso_nvtx && Denominator_detIso_nvtx) {
0484     TH1F *h_numerator_detIso_nvtx = Numerator_detIso_nvtx->getTH1F();
0485     TH1F *h_denominator_detIso_nvtx = Denominator_detIso_nvtx->getTH1F();
0486 
0487     TH1F *h_eff_detIso_nvtx = h_eff_vtx_EB_detIsoID->getTH1F();
0488 
0489     if (h_eff_detIso_nvtx->GetSumw2N() == 0)
0490       h_eff_detIso_nvtx->Sumw2();
0491     h_eff_detIso_nvtx->Divide(h_numerator_detIso_nvtx, h_denominator_detIso_nvtx, 1., 1., "B");
0492   }
0493 
0494   /// --- Tight Muon + detector-Based Isolation  efficiency vs muon number of reco Vertex [EE]
0495   numpath_detIso_nvtx = inputdir + "/passProbes_EE_detIsoID_nVtx";
0496   denpath_detIso_nvtx = inputdir + "/allProbes_EE_ID_nVtx";
0497 
0498   Numerator_detIso_nvtx = igetter.get(numpath_detIso_nvtx);
0499   Denominator_detIso_nvtx = igetter.get(denpath_detIso_nvtx);
0500 
0501   if (Numerator_detIso_nvtx && Denominator_detIso_nvtx) {
0502     TH1F *h_numerator_detIso_nvtx = Numerator_detIso_nvtx->getTH1F();
0503     TH1F *h_denominator_detIso_nvtx = Denominator_detIso_nvtx->getTH1F();
0504 
0505     TH1F *h_eff_detIso_nvtx = h_eff_vtx_EE_detIsoID->getTH1F();
0506 
0507     if (h_eff_detIso_nvtx->GetSumw2N() == 0)
0508       h_eff_detIso_nvtx->Sumw2();
0509 
0510     h_eff_detIso_nvtx->Divide(h_numerator_detIso_nvtx, h_denominator_detIso_nvtx, 1., 1., "B");
0511   }
0512 
0513   /// --- Tight Muon + PF-Based Isolation  efficiency vs muon number of reco Vertex [EB]
0514   numpath_pfIso_nvtx = inputdir + "/passProbes_EB_pfIsoID_nVtx";
0515   denpath_pfIso_nvtx = inputdir + "/allProbes_EB_ID_nVtx";
0516 
0517   Numerator_pfIso_nvtx = igetter.get(numpath_pfIso_nvtx);
0518   Denominator_pfIso_nvtx = igetter.get(denpath_pfIso_nvtx);
0519 
0520   if (Numerator_pfIso_nvtx && Denominator_pfIso_nvtx) {
0521     TH1F *h_numerator_pfIso_nvtx = Numerator_pfIso_nvtx->getTH1F();
0522     TH1F *h_denominator_pfIso_nvtx = Denominator_pfIso_nvtx->getTH1F();
0523 
0524     TH1F *h_eff_pfIso_nvtx = h_eff_vtx_EB_pfIsoID->getTH1F();
0525 
0526     if (h_eff_pfIso_nvtx->GetSumw2N() == 0)
0527       h_eff_pfIso_nvtx->Sumw2();
0528 
0529     h_eff_pfIso_nvtx->Divide(h_numerator_pfIso_nvtx, h_denominator_pfIso_nvtx, 1., 1., "B");
0530   }
0531 
0532   /// --- Tight Muon + PF-Based Isolation  efficiency vs muon number of reco Vertex [EE]
0533   numpath_pfIso_nvtx = inputdir + "/passProbes_EE_pfIsoID_nVtx";
0534   denpath_pfIso_nvtx = inputdir + "/allProbes_EE_ID_nVtx";
0535 
0536   Numerator_pfIso_nvtx = igetter.get(numpath_pfIso_nvtx);
0537   Denominator_pfIso_nvtx = igetter.get(denpath_pfIso_nvtx);
0538 
0539   if (Numerator_pfIso_nvtx && Denominator_pfIso_nvtx) {
0540     TH1F *h_numerator_pfIso_nvtx = Numerator_pfIso_nvtx->getTH1F();
0541     TH1F *h_denominator_pfIso_nvtx = Denominator_pfIso_nvtx->getTH1F();
0542 
0543     TH1F *h_eff_pfIso_nvtx = h_eff_vtx_EE_pfIsoID->getTH1F();
0544 
0545     if (h_eff_pfIso_nvtx->GetSumw2N() == 0)
0546       h_eff_pfIso_nvtx->Sumw2();
0547 
0548     h_eff_pfIso_nvtx->Divide(h_numerator_pfIso_nvtx, h_denominator_pfIso_nvtx, 1., 1., "B");
0549   }
0550 
0551   /// --- Tight Muon + PF IsodBlation corrected by deltaBeta  efficiency vs muon Pt
0552   string numpath_pfIsodB_pt = inputdir + "/passProbes_pfIsodBID_pt";
0553   string denpath_pfIsodB_pt = inputdir + "/allProbes_ID_pt";
0554 
0555   MonitorElement *Numerator_pfIsodB_pt = igetter.get(numpath_pfIsodB_pt);
0556   MonitorElement *Denominator_pfIsodB_pt = igetter.get(denpath_pfIsodB_pt);
0557 
0558   if (Numerator_pfIsodB_pt && Denominator_pfIsodB_pt) {
0559     TH1F *h_numerator_pfIsodB_pt = Numerator_pfIsodB_pt->getTH1F();
0560     TH1F *h_denominator_pfIsodB_pt = Denominator_pfIsodB_pt->getTH1F();
0561 
0562     TH1F *h_eff_pfIsodB_pt = h_eff_pt_pfIsodBID->getTH1F();
0563 
0564     if (h_eff_pfIsodB_pt->GetSumw2N() == 0)
0565       h_eff_pfIsodB_pt->Sumw2();
0566 
0567     h_eff_pfIsodB_pt->Divide(h_numerator_pfIsodB_pt, h_denominator_pfIsodB_pt, 1., 1., "B");
0568   }
0569 
0570   /// --- Tight Muon + PF IsodBlation corrected by deltaBeta   efficiency vs muon Pt [EB]
0571 
0572   string numpath_pfIsodB_EB_pt = inputdir + "/passProbes_EB_pfIsodBID_pt";
0573   string denpath_pfIsodB_EB_pt = inputdir + "/allProbes_EB_ID_pt";
0574 
0575   MonitorElement *Numerator_pfIsodB_EB_pt = igetter.get(numpath_pfIsodB_EB_pt);
0576   MonitorElement *Denominator_pfIsodB_EB_pt = igetter.get(denpath_pfIsodB_EB_pt);
0577 
0578   if (Numerator_pfIsodB_EB_pt && Denominator_pfIsodB_EB_pt) {
0579     TH1F *h_numerator_pfIsodB_EB_pt = Numerator_pfIsodB_EB_pt->getTH1F();
0580     TH1F *h_denominator_pfIsodB_EB_pt = Denominator_pfIsodB_EB_pt->getTH1F();
0581 
0582     TH1F *h_eff_pfIsodB_EB_pt = h_eff_pt_EB_pfIsodBID->getTH1F();
0583 
0584     if (h_eff_pfIsodB_EB_pt->GetSumw2N() == 0)
0585       h_eff_pfIsodB_EB_pt->Sumw2();
0586     h_eff_pfIsodB_EB_pt->Divide(h_numerator_pfIsodB_EB_pt, h_denominator_pfIsodB_EB_pt, 1., 1., "B");
0587   }
0588 
0589   /// --- Tight Muon + PF IsodBlation corrected by deltaBeta  efficiency vs muon Pt [EE]
0590   string numpath_pfIsodB_EE_pt = inputdir + "/passProbes_EE_pfIsodBID_pt";
0591   string denpath_pfIsodB_EE_pt = inputdir + "/allProbes_EE_ID_pt";
0592 
0593   MonitorElement *Numerator_pfIsodB_EE_pt = igetter.get(numpath_pfIsodB_EE_pt);
0594   MonitorElement *Denominator_pfIsodB_EE_pt = igetter.get(denpath_pfIsodB_EE_pt);
0595 
0596   if (Numerator_pfIsodB_EE_pt && Denominator_pfIsodB_EE_pt) {
0597     TH1F *h_numerator_pfIsodB_EE_pt = Numerator_pfIsodB_EE_pt->getTH1F();
0598     TH1F *h_denominator_pfIsodB_EE_pt = Denominator_pfIsodB_EE_pt->getTH1F();
0599 
0600     TH1F *h_eff_pfIsodB_EE_pt = h_eff_pt_EE_pfIsodBID->getTH1F();
0601 
0602     if (h_eff_pfIsodB_EE_pt->GetSumw2N() == 0)
0603       h_eff_pfIsodB_EE_pt->Sumw2();
0604 
0605     h_eff_pfIsodB_EE_pt->Divide(h_numerator_pfIsodB_EE_pt, h_denominator_pfIsodB_EE_pt, 1., 1., "B");
0606   }
0607 
0608   /// --- Tight Muon + PF Isolation corrected by deltaBeta efficiency vs muon number of reco Vertex
0609 
0610   string numpath_pfIsodB_nvtx = inputdir + "/passProbes_pfIsodBID_nVtx";
0611   string denpath_pfIsodB_nvtx = inputdir + "/allProbes_ID_nVtx";
0612 
0613   MonitorElement *Numerator_pfIsodB_nvtx = igetter.get(numpath_pfIsodB_nvtx);
0614   MonitorElement *Denominator_pfIsodB_nvtx = igetter.get(denpath_pfIsodB_nvtx);
0615 
0616   if (Numerator_pfIsodB_nvtx && Denominator_pfIsodB_nvtx) {
0617     TH1F *h_numerator_pfIsodB_nvtx = Numerator_pfIsodB_nvtx->getTH1F();
0618     TH1F *h_denominator_pfIsodB_nvtx = Denominator_pfIsodB_nvtx->getTH1F();
0619 
0620     TH1F *h_eff_pfIsodB_nvtx = h_eff_vtx_pfIsodBID->getTH1F();
0621 
0622     if (h_eff_pfIsodB_nvtx->GetSumw2N() == 0)
0623       h_eff_pfIsodB_nvtx->Sumw2();
0624 
0625     h_eff_pfIsodB_nvtx->Divide(h_numerator_pfIsodB_nvtx, h_denominator_pfIsodB_nvtx, 1., 1., "B");
0626   }
0627 
0628   /// --- Tight Muon + PF-Based Isolation corrected by deltaBeta efficiency vs muon number of reco Vertex [EB]
0629   numpath_pfIsodB_nvtx = inputdir + "/passProbes_EB_pfIsodBID_nVtx";
0630   denpath_pfIsodB_nvtx = inputdir + "/allProbes_EB_ID_nVtx";
0631 
0632   Numerator_pfIsodB_nvtx = igetter.get(numpath_pfIsodB_nvtx);
0633   Denominator_pfIsodB_nvtx = igetter.get(denpath_pfIsodB_nvtx);
0634 
0635   if (Numerator_pfIsodB_nvtx && Denominator_pfIsodB_nvtx) {
0636     TH1F *h_numerator_pfIsodB_nvtx = Numerator_pfIsodB_nvtx->getTH1F();
0637     TH1F *h_denominator_pfIsodB_nvtx = Denominator_pfIsodB_nvtx->getTH1F();
0638 
0639     TH1F *h_eff_pfIsodB_nvtx = h_eff_vtx_EB_pfIsodBID->getTH1F();
0640 
0641     if (h_eff_pfIsodB_nvtx->GetSumw2N() == 0)
0642       h_eff_pfIsodB_nvtx->Sumw2();
0643 
0644     h_eff_pfIsodB_nvtx->Divide(h_numerator_pfIsodB_nvtx, h_denominator_pfIsodB_nvtx, 1., 1., "B");
0645   }
0646 
0647   /// --- Tight Muon + PF-Based Isolation corrected by deltaBeta efficiency vs muon number of reco Vertex [EE]
0648   numpath_pfIsodB_nvtx = inputdir + "/passProbes_EE_pfIsodBID_nVtx";
0649   denpath_pfIsodB_nvtx = inputdir + "/allProbes_EE_ID_nVtx";
0650 
0651   Numerator_pfIsodB_nvtx = igetter.get(numpath_pfIsodB_nvtx);
0652   Denominator_pfIsodB_nvtx = igetter.get(denpath_pfIsodB_nvtx);
0653 
0654   if (Numerator_pfIsodB_nvtx && Denominator_pfIsodB_nvtx) {
0655     TH1F *h_numerator_pfIsodB_nvtx = Numerator_pfIsodB_nvtx->getTH1F();
0656     TH1F *h_denominator_pfIsodB_nvtx = Denominator_pfIsodB_nvtx->getTH1F();
0657 
0658     TH1F *h_eff_pfIsodB_nvtx = h_eff_vtx_EE_pfIsodBID->getTH1F();
0659 
0660     if (h_eff_pfIsodB_nvtx->GetSumw2N() == 0)
0661       h_eff_pfIsodB_nvtx->Sumw2();
0662 
0663     h_eff_pfIsodB_nvtx->Divide(h_numerator_pfIsodB_nvtx, h_denominator_pfIsodB_nvtx, 1., 1., "B");
0664   }
0665 }