CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/DQMOffline/Muon/src/EfficiencyPlotter.cc

Go to the documentation of this file.
00001 #include "DQMOffline/Muon/src/EfficiencyPlotter.h"
00002 
00003 // Framework
00004 #include <FWCore/Framework/interface/Event.h>
00005 #include "DataFormats/Common/interface/Handle.h" 
00006 #include <FWCore/Framework/interface/ESHandle.h>
00007 #include <FWCore/Framework/interface/MakerMacros.h>
00008 #include <FWCore/Framework/interface/EventSetup.h>
00009 #include <FWCore/ParameterSet/interface/ParameterSet.h>
00010 
00011 
00012 #include "DQMServices/Core/interface/DQMStore.h"
00013 #include "DQMServices/Core/interface/MonitorElement.h"
00014 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00015 #include "FWCore/Framework/interface/Run.h"
00016 
00017 #include <iostream>
00018 #include <stdio.h>
00019 #include <string>
00020 #include <math.h>
00021 #include "TF1.h"
00022 #include "TH1F.h"
00023 
00024 using namespace edm;
00025 using namespace std;
00026 
00027 //#define DEBUG
00028 
00029 EfficiencyPlotter::EfficiencyPlotter(const edm::ParameterSet& ps){
00030 #ifdef DEBUG
00031   cout << "EfficiencyPlotter(): Constructor " << endl;
00032 #endif
00033   parameters = ps;
00034   theDbe = edm::Service<DQMStore>().operator->();
00035 }
00036 EfficiencyPlotter::~EfficiencyPlotter(){}
00037 
00038 void EfficiencyPlotter::beginJob(void){
00039 #ifdef DEBUG
00040   cout << "EfficiencyPlotter::beginJob " << endl;
00041 #endif
00042   
00043   theDbe->setCurrentFolder("Muons/EfficiencyAnalyzer");
00044   
00045   metname = "EfficiencyAnalyzer";
00046   LogTrace(metname)<<"[EfficiencyPlotter] beginJob: Parameters initialization";
00047  
00048   // efficiency plot
00049   etaBin = parameters.getParameter<int>("etaBin");
00050   etaMin = parameters.getParameter<double>("etaMin");
00051   etaMax = parameters.getParameter<double>("etaMax");
00052   
00053   phiBin = parameters.getParameter<int>("phiBin");
00054   phiMin = parameters.getParameter<double>("phiMin");
00055   phiMax = parameters.getParameter<double>("phiMax");
00056 
00057   ptBin = parameters.getParameter<int>("ptBin");
00058   ptMin = parameters.getParameter<double>("ptMin");
00059   ptMax = parameters.getParameter<double>("ptMax");
00060 
00061   vtxBin = parameters.getParameter<int>("vtxBin");
00062   vtxMin = parameters.getParameter<double>("vtxMin");
00063   vtxMax = parameters.getParameter<double>("vtxMax");
00064 
00065   h_eff_eta_TightMu          = theDbe->book1D("Eff_eta_TightMu",          "TightMu Eff. vs #eta",               etaBin, etaMin, etaMax);
00066   h_eff_hp_eta_TightMu       = theDbe->book1D("Eff_hp_eta_TightMu",       "High Pt TightMu Eff. vs #eta",       etaBin, etaMin, etaMax);
00067   h_eff_phi_TightMu          = theDbe->book1D("Eff_phi_TightMu",          "TightMu Eff. vs #phi",               phiBin, phiMin, phiMax);
00068   h_eff_pt_TightMu           = theDbe->book1D("Eff_pt_TightMu",           "TightMu Eff. vs Pt",                 ptBin, ptMin, ptMax);
00069   h_eff_pt_EB_TightMu        = theDbe->book1D("Eff_pt_EB_TightMu",        "Barrel: TightMu Eff. vs Pt",         ptBin, ptMin, ptMax);
00070   h_eff_pt_EE_TightMu        = theDbe->book1D("Eff_pt_EE_TightMu",        "Endcap: TightMu Eff. vs Pt",         ptBin, ptMin, ptMax);
00071   h_eff_pt_detIsoTightMu     = theDbe->book1D("Eff_pt_detIsoTightMu",     "detIsoTightMu Efficiency vs Pt",     ptBin, ptMin, ptMax);
00072   h_eff_pt_EB_detIsoTightMu  = theDbe->book1D("Eff_pt_EB_detIsoTightMu",  "Barrel: detIsoTightMu Eff. vs Pt",   ptBin, ptMin, ptMax);
00073   h_eff_pt_EE_detIsoTightMu  = theDbe->book1D("Eff_pt_EE_detIsoTightMu",  "Endcap: detIsoTightMu Eff. vs Pt",   ptBin, ptMin, ptMax);
00074   h_eff_pt_pfIsoTightMu      = theDbe->book1D("Eff_pt_pfIsoTightMu",      "pfIsoTightMu Eff. vs Pt",            ptBin, ptMin, ptMax);
00075   h_eff_pt_EB_pfIsoTightMu   = theDbe->book1D("Eff_pt_EB_pfIsoTightMu",   "Barrel: pfIsoTightMu Eff. vs Pt",    ptBin, ptMin, ptMax);
00076   h_eff_pt_EE_pfIsoTightMu   = theDbe->book1D("Eff_pt_EE_pfIsoTightMu",   "Endcap: pfIsoTightMu Eff. vs Pt",    ptBin, ptMin, ptMax);
00077   h_eff_vtx_detIsoTightMu    = theDbe->book1D("Eff_vtx_detIsoTightMu",    "detIsoTightMu Eff. vs nVtx",         vtxBin, vtxMin, vtxMax);
00078   h_eff_vtx_pfIsoTightMu     = theDbe->book1D("Eff_vtx_pfIsoTightMu",     "pfIsoTightMu Eff. vs nVtx",          vtxBin, vtxMin, vtxMax);
00079   h_eff_vtx_EB_detIsoTightMu = theDbe->book1D("Eff_vtx_EB_detIsoTightMu", "Barrel: detIsoTightMu Eff. vs nVtx", vtxBin, vtxMin, vtxMax);
00080   h_eff_vtx_EB_pfIsoTightMu  = theDbe->book1D("Eff_vtx_EB_pfIsoTightMu",  "Barrel: pfIsoTightMu Eff. vs nVtx",  vtxBin, vtxMin, vtxMax);
00081   h_eff_vtx_EE_detIsoTightMu = theDbe->book1D("Eff_vtx_EE_detIsoTightMu", "Endcap: detIsoTightMu Eff. vs nVtx", vtxBin, vtxMin, vtxMax);
00082   h_eff_vtx_EE_pfIsoTightMu  = theDbe->book1D("Eff_vtx_EE_pfIsoTightMu",  "Endcap: pfIsoTightMu Eff. vs nVtx",  vtxBin, vtxMin, vtxMax);
00083 
00084   h_eff_pt_pfIsodBTightMu      = theDbe->book1D("Eff_pt_pfIsodBTightMu",      "pfIsoTightMu (deltaBeta) Eff. vs Pt",            ptBin, ptMin, ptMax);
00085   h_eff_pt_EB_pfIsodBTightMu   = theDbe->book1D("Eff_pt_EB_pfIsodBTightMu",   "Barrel: pfIsoTightMu (deltaBeta) Eff. vs Pt",    ptBin, ptMin, ptMax);
00086   h_eff_pt_EE_pfIsodBTightMu   = theDbe->book1D("Eff_pt_EE_pfIsodBTightMu",   "Endcap: pfIsoTightMu (deltaBeta) Eff. vs Pt",    ptBin, ptMin, ptMax);
00087   h_eff_vtx_pfIsodBTightMu     = theDbe->book1D("Eff_vtx_pfIsodBTightMu",     "pfIsoTightMu (deltaBeta) Eff. vs nVtx",          vtxBin, vtxMin, vtxMax);
00088   h_eff_vtx_EB_pfIsodBTightMu  = theDbe->book1D("Eff_vtx_EB_pfIsodBTightMu",  "Barrel: pfIsoTightMu (deltaBeta) Eff. vs nVtx",  vtxBin, vtxMin, vtxMax);
00089   h_eff_vtx_EE_pfIsodBTightMu  = theDbe->book1D("Eff_vtx_EE_pfIsodBTightMu",  "Endcap: pfIsoTightMu (deltaBeta) Eff. vs nVtx",  vtxBin, vtxMin, vtxMax);
00090 
00091 
00092 
00093   // This prevents this ME to be normalized when drawn into the GUI
00094   h_eff_eta_TightMu         ->setEfficiencyFlag();
00095   h_eff_hp_eta_TightMu      ->setEfficiencyFlag();
00096   h_eff_phi_TightMu         ->setEfficiencyFlag();
00097   h_eff_pt_TightMu          ->setEfficiencyFlag();
00098   h_eff_pt_EB_TightMu       ->setEfficiencyFlag();
00099   h_eff_pt_EE_TightMu       ->setEfficiencyFlag();
00100   h_eff_pt_detIsoTightMu    ->setEfficiencyFlag();
00101   h_eff_pt_EB_detIsoTightMu ->setEfficiencyFlag();
00102   h_eff_pt_EE_detIsoTightMu ->setEfficiencyFlag();
00103   h_eff_pt_pfIsoTightMu     ->setEfficiencyFlag();
00104   h_eff_pt_EB_pfIsoTightMu  ->setEfficiencyFlag();
00105   h_eff_pt_EE_pfIsoTightMu  ->setEfficiencyFlag();
00106   h_eff_vtx_detIsoTightMu   ->setEfficiencyFlag();
00107   h_eff_vtx_pfIsoTightMu    ->setEfficiencyFlag();
00108   h_eff_vtx_EB_detIsoTightMu->setEfficiencyFlag();
00109   h_eff_vtx_EB_pfIsoTightMu ->setEfficiencyFlag();
00110   h_eff_vtx_EE_detIsoTightMu->setEfficiencyFlag();
00111   h_eff_vtx_EE_pfIsoTightMu ->setEfficiencyFlag();
00112 
00113   h_eff_pt_pfIsodBTightMu   ->setEfficiencyFlag();
00114   h_eff_pt_EB_pfIsodBTightMu ->setEfficiencyFlag();
00115   h_eff_pt_EE_pfIsodBTightMu ->setEfficiencyFlag();
00116   h_eff_vtx_pfIsodBTightMu   ->setEfficiencyFlag();
00117   h_eff_vtx_EB_pfIsodBTightMu ->setEfficiencyFlag();
00118   h_eff_vtx_EE_pfIsodBTightMu ->setEfficiencyFlag();
00119 
00120 
00121 
00122   // AXIS TITLES....
00123   h_eff_hp_eta_TightMu      ->setAxisTitle("#eta",         1);  
00124   h_eff_eta_TightMu         ->setAxisTitle("#eta",         1);  
00125   h_eff_phi_TightMu         ->setAxisTitle("#phi",         1);  
00126   h_eff_pt_TightMu          ->setAxisTitle("p_{T} (GeV)",  1);  
00127   h_eff_pt_EB_TightMu       ->setAxisTitle("p_{T} (GeV)",  1);  
00128   h_eff_pt_EE_TightMu       ->setAxisTitle("p_{T} (GeV)",  1);  
00129   h_eff_pt_detIsoTightMu    ->setAxisTitle("p_{T} (GeV)",  1);  
00130   h_eff_pt_EB_detIsoTightMu ->setAxisTitle("p_{T} (GeV)",  1);  
00131   h_eff_pt_EE_detIsoTightMu ->setAxisTitle("p_{T} (GeV)",  1);  
00132   h_eff_pt_pfIsoTightMu     ->setAxisTitle("p_{T} (GeV)",  1);  
00133   h_eff_pt_EB_pfIsoTightMu  ->setAxisTitle("p_{T} (GeV)",  1);  
00134   h_eff_pt_EE_pfIsoTightMu  ->setAxisTitle("p_{T} (GeV)",  1);  
00135   h_eff_vtx_detIsoTightMu   ->setAxisTitle("Number of PV", 1);
00136   h_eff_vtx_pfIsoTightMu    ->setAxisTitle("Number of PV", 1);
00137   h_eff_vtx_EB_detIsoTightMu->setAxisTitle("Number of PV", 1);
00138   h_eff_vtx_EB_pfIsoTightMu ->setAxisTitle("Number of PV", 1);
00139   h_eff_vtx_EE_detIsoTightMu->setAxisTitle("Number of PV", 1);
00140   h_eff_vtx_EE_pfIsoTightMu ->setAxisTitle("Number of PV", 1);
00141 
00142   h_eff_pt_pfIsodBTightMu     ->setAxisTitle("p_{T} (GeV)",  1); 
00143   h_eff_pt_EB_pfIsodBTightMu  ->setAxisTitle("p_{T} (GeV)",  1);  
00144   h_eff_pt_EE_pfIsodBTightMu  ->setAxisTitle("p_{T} (GeV)",  1);   
00145   h_eff_vtx_pfIsodBTightMu    ->setAxisTitle("Number of PV", 1);
00146   h_eff_vtx_EB_pfIsodBTightMu ->setAxisTitle("Number of PV", 1);
00147   h_eff_vtx_EE_pfIsodBTightMu ->setAxisTitle("Number of PV", 1);
00148 
00149   
00150 //   h_eff_eta_TightMu         ->setAxisTitle("Tight Mu Eff.",      2);  
00151 //   h_eff_hp_eta_TightMu      ->setAxisTitle("High p_{T} Mu Eff.", 2);  
00152 //   h_eff_phi_TightMu         ->setAxisTitle("Tight Mu Eff.",      2);  
00153 //   h_eff_pt_TightMu          ->setAxisTitle("Tight Mu Eff.",      2);  
00154 //   h_eff_pt_EB_TightMu       ->setAxisTitle("Tight Mu Eff.",      2);  
00155 //   h_eff_pt_EE_TightMu       ->setAxisTitle("Tight Mu Eff.",      2);  
00156 //   h_eff_pt_detIsoTightMu    ->setAxisTitle("Tight Mu Eff.",      2);  
00157 //   h_eff_pt_EB_detIsoTightMu ->setAxisTitle("Tight Mu Eff.",      2);  
00158 //   h_eff_pt_EE_detIsoTightMu ->setAxisTitle("Tight Mu Eff.",      2);  
00159 //   h_eff_pt_pfIsoTightMu     ->setAxisTitle("Tight Mu Eff.",      2);  
00160 //   h_eff_pt_EB_pfIsoTightMu  ->setAxisTitle("Tight Mu Eff.",      2);  
00161 //   h_eff_pt_EE_pfIsoTightMu  ->setAxisTitle("Tight Mu Eff.",      2);  
00162 //   h_eff_vtx_detIsoTightMu   ->setAxisTitle("Tight Mu Eff.",      2);
00163 //   h_eff_vtx_pfIsoTightMu    ->setAxisTitle("Tight Mu Eff.",      2);
00164 //   h_eff_vtx_EB_detIsoTightMu->setAxisTitle("Tight Mu Eff.",      2);
00165 //   h_eff_vtx_EB_pfIsoTightMu ->setAxisTitle("Tight Mu Eff.",      2);
00166 //   h_eff_vtx_EE_detIsoTightMu->setAxisTitle("Tight Mu Eff.",      2);
00167 //   h_eff_vtx_EE_pfIsoTightMu ->setAxisTitle("Tight Mu Eff.",      2);
00168 }
00169 
00170 
00171 void EfficiencyPlotter::beginRun(Run const& run, EventSetup const& eSetup) {
00172   LogTrace(metname)<<"[EfficiencyPlotter]: beginRun";
00173 }
00174 void EfficiencyPlotter::beginLuminosityBlock(LuminosityBlock const& lumiSeg, EventSetup const& context) {
00175   LogTrace(metname)<<"[EfficiencyPlotter]: beginLuminosityBlock";
00176   // Get the run number
00177   run = lumiSeg.run();
00178 }
00179 void EfficiencyPlotter::analyze(const edm::Event& e, const edm::EventSetup& context){
00180   nevents++;
00181   LogTrace(metname)<< "[EfficiencyPlotter]: "<<nevents<<" events";
00182 }
00183 void EfficiencyPlotter::endLuminosityBlock(LuminosityBlock const& lumiSeg, EventSetup const& context) {
00184   //  LogTrace(metname)<<"[EfficiencyPlotter]: endLuminosityBlock, performing the DQM LS client operation";
00185   // counts number of lumiSegs 
00186   nLumiSegs = lumiSeg.id().luminosityBlock();
00187 }
00188 void EfficiencyPlotter::endRun(Run const& run, EventSetup const& eSetup) {
00189   LogTrace(metname)<<"[EfficiencyPlotter]: endRun, performing the DQM end of run client operation";
00190   
00191   
00193   string numpath_pt = "Muons/EfficiencyAnalyzer/passProbes_TightMu_pt";
00194   string denpath_pt = "Muons/EfficiencyAnalyzer/allProbes_pt";
00195   
00196   MonitorElement *Numerator_pt   = theDbe->get(numpath_pt);
00197   MonitorElement *Denominator_pt = theDbe->get(denpath_pt);
00198   
00199   if (Numerator_pt && Denominator_pt){
00200     TH1F *h_numerator_pt   = Numerator_pt->getTH1F();
00201     TH1F *h_denominator_pt = Denominator_pt->getTH1F();
00202     TH1F *h_eff_pt         = h_eff_pt_TightMu->getTH1F();
00203     
00204     if (h_eff_pt->GetSumw2N() == 0) h_eff_pt->Sumw2();  
00205     h_eff_pt->Divide(h_numerator_pt, h_denominator_pt, 1., 1., "B");
00206   }
00207   
00209   string numpath_EB_pt = "Muons/EfficiencyAnalyzer/passProbes_TightMu_EB_pt";
00210   string denpath_EB_pt = "Muons/EfficiencyAnalyzer/allProbes_EB_pt";
00211   
00212   MonitorElement *Numerator_EB_pt   = theDbe->get(numpath_EB_pt);
00213   MonitorElement *Denominator_EB_pt = theDbe->get(denpath_EB_pt);
00214   
00215   if (Numerator_EB_pt && Denominator_EB_pt){
00216     TH1F *h_numerator_EB_pt   = Numerator_EB_pt->getTH1F();
00217     TH1F *h_denominator_EB_pt = Denominator_EB_pt->getTH1F();
00218     TH1F *h_eff_EB_pt         = h_eff_pt_EB_TightMu->getTH1F();
00219     
00220     if (h_eff_EB_pt->GetSumw2N() == 0) h_eff_EB_pt->Sumw2();  
00221     h_eff_EB_pt->Divide(h_numerator_EB_pt, h_denominator_EB_pt, 1., 1., "B");
00222   }
00223 
00225   string numpath_EE_pt = "Muons/EfficiencyAnalyzer/passProbes_TightMu_EE_pt";
00226   string denpath_EE_pt = "Muons/EfficiencyAnalyzer/allProbes_EE_pt";
00227   
00228   MonitorElement *Numerator_EE_pt   = theDbe->get(numpath_EE_pt);
00229   MonitorElement *Denominator_EE_pt = theDbe->get(denpath_EE_pt);
00230   
00231   if (Numerator_EE_pt && Denominator_EE_pt){
00232     TH1F *h_numerator_EE_pt   = Numerator_EE_pt->getTH1F();
00233     TH1F *h_denominator_EE_pt = Denominator_EE_pt->getTH1F();
00234     TH1F *h_eff_EE_pt         = h_eff_pt_EE_TightMu->getTH1F();
00235     
00236     if (h_eff_EE_pt->GetSumw2N() == 0) h_eff_EE_pt->Sumw2();  
00237     h_eff_EE_pt->Divide(h_numerator_EE_pt, h_denominator_EE_pt, 1., 1., "B");
00238   }
00239 
00241   string numpath_eta = "Muons/EfficiencyAnalyzer/passProbes_TightMu_eta";
00242   string denpath_eta = "Muons/EfficiencyAnalyzer/allProbes_eta";
00243   
00244   MonitorElement *Numerator_eta   = theDbe->get(numpath_eta);
00245   MonitorElement *Denominator_eta = theDbe->get(denpath_eta);
00246   
00247   if (Numerator_eta && Denominator_eta){
00248  
00249     TH1F *h_numerator_eta   = Numerator_eta->getTH1F();
00250     TH1F *h_denominator_eta = Denominator_eta->getTH1F();
00251 
00252     TH1F *h_eff_eta = h_eff_eta_TightMu->getTH1F();
00253     
00254     if (h_eff_eta->GetSumw2N() == 0) h_eff_eta->Sumw2();  
00255     
00256     h_eff_eta->Divide(h_numerator_eta, h_denominator_eta, 1., 1., "B");
00257 
00258   }
00259 
00261 
00262   string numpath_hp_eta = "Muons/EfficiencyAnalyzer/passProbes_TightMu_hp_eta";
00263   string denpath_hp_eta = "Muons/EfficiencyAnalyzer/allProbes_hp_eta";
00264   
00265   MonitorElement *Numerator_hp_eta   = theDbe->get(numpath_hp_eta);
00266   MonitorElement *Denominator_hp_eta = theDbe->get(denpath_hp_eta);
00267   
00268   if (Numerator_hp_eta && Denominator_hp_eta){
00269  
00270     TH1F *h_numerator_hp_eta   = Numerator_hp_eta->getTH1F();
00271     TH1F *h_denominator_hp_eta = Denominator_hp_eta->getTH1F();
00272 
00273     TH1F *h_eff_hp_eta = h_eff_hp_eta_TightMu->getTH1F();
00274     
00275     if (h_eff_hp_eta->GetSumw2N() == 0) h_eff_hp_eta->Sumw2();  
00276     
00277     h_eff_hp_eta->Divide(h_numerator_hp_eta, h_denominator_hp_eta, 1., 1., "B");
00278 
00279   }
00280 
00282 
00283   string numpath_phi = "Muons/EfficiencyAnalyzer/passProbes_TightMu_phi";
00284   string denpath_phi = "Muons/EfficiencyAnalyzer/allProbes_phi";
00285   
00286   MonitorElement *Numerator_phi   = theDbe->get(numpath_phi);
00287   MonitorElement *Denominator_phi = theDbe->get(denpath_phi);
00288   
00289   if (Numerator_phi && Denominator_phi){
00290  
00291     TH1F *h_numerator_phi   = Numerator_phi->getTH1F();
00292     TH1F *h_denominator_phi = Denominator_phi->getTH1F();
00293 
00294     TH1F *h_eff_phi = h_eff_phi_TightMu->getTH1F();
00295     
00296     if (h_eff_phi->GetSumw2N() == 0) h_eff_phi->Sumw2();  
00297     
00298     h_eff_phi->Divide(h_numerator_phi, h_denominator_phi, 1., 1., "B");
00299 
00300   }
00301 
00302 
00304   string numpath_detIso_pt = "Muons/EfficiencyAnalyzer/passProbes_detIsoTightMu_pt";
00305   string denpath_detIso_pt = "Muons/EfficiencyAnalyzer/allProbes_TightMu_pt";
00306   
00307   MonitorElement *Numerator_detIso_pt   = theDbe->get(numpath_detIso_pt);
00308   MonitorElement *Denominator_detIso_pt = theDbe->get(denpath_detIso_pt);
00309   
00310   if (Numerator_detIso_pt && Denominator_detIso_pt){
00311  
00312     TH1F *h_numerator_detIso_pt   = Numerator_detIso_pt->getTH1F();
00313     TH1F *h_denominator_detIso_pt = Denominator_detIso_pt->getTH1F();
00314 
00315     TH1F *h_eff_detIso_pt = h_eff_pt_detIsoTightMu->getTH1F();
00316     
00317     if (h_eff_detIso_pt->GetSumw2N() == 0) h_eff_detIso_pt->Sumw2();  
00318     h_eff_detIso_pt->Divide(h_numerator_detIso_pt, h_denominator_detIso_pt, 1., 1., "B");
00319     
00320   }
00321 
00322 
00324   string numpath_detIso_EB_pt = "Muons/EfficiencyAnalyzer/passProbes_EB_detIsoTightMu_pt";
00325   string denpath_detIso_EB_pt = "Muons/EfficiencyAnalyzer/allProbes_EB_TightMu_pt";
00326   
00327   MonitorElement *Numerator_detIso_EB_pt   = theDbe->get(numpath_detIso_EB_pt);
00328   MonitorElement *Denominator_detIso_EB_pt = theDbe->get(denpath_detIso_EB_pt);
00329   
00330   if (Numerator_detIso_EB_pt && Denominator_detIso_EB_pt){
00331  
00332     TH1F *h_numerator_detIso_EB_pt   = Numerator_detIso_EB_pt->getTH1F();
00333     TH1F *h_denominator_detIso_EB_pt = Denominator_detIso_EB_pt->getTH1F();
00334 
00335     TH1F *h_eff_detIso_EB_pt = h_eff_pt_EB_detIsoTightMu->getTH1F();
00336     
00337     if (h_eff_detIso_EB_pt->GetSumw2N() == 0) h_eff_detIso_EB_pt->Sumw2();  
00338     
00339     h_eff_detIso_EB_pt->Divide(h_numerator_detIso_EB_pt, h_denominator_detIso_EB_pt, 1., 1., "B");
00340 
00341   }
00342 
00343 
00345   string numpath_detIso_EE_pt = "Muons/EfficiencyAnalyzer/passProbes_EE_detIsoTightMu_pt";
00346   string denpath_detIso_EE_pt = "Muons/EfficiencyAnalyzer/allProbes_EE_TightMu_pt";
00347   
00348   MonitorElement *Numerator_detIso_EE_pt   = theDbe->get(numpath_detIso_EE_pt);
00349   MonitorElement *Denominator_detIso_EE_pt = theDbe->get(denpath_detIso_EE_pt);
00350   
00351   if (Numerator_detIso_EE_pt && Denominator_detIso_EE_pt){
00352  
00353     TH1F *h_numerator_detIso_EE_pt   = Numerator_detIso_EE_pt->getTH1F();
00354     TH1F *h_denominator_detIso_EE_pt = Denominator_detIso_EE_pt->getTH1F();
00355 
00356     TH1F *h_eff_detIso_EE_pt = h_eff_pt_EE_detIsoTightMu->getTH1F();
00357     
00358     if (h_eff_detIso_EE_pt->GetSumw2N() == 0) h_eff_detIso_EE_pt->Sumw2();  
00359     
00360     h_eff_detIso_EE_pt->Divide(h_numerator_detIso_EE_pt, h_denominator_detIso_EE_pt, 1., 1., "B");
00361 
00362   }
00363 
00364 
00366   string numpath_pfIso_pt = "Muons/EfficiencyAnalyzer/passProbes_pfIsoTightMu_pt";
00367   string denpath_pfIso_pt = "Muons/EfficiencyAnalyzer/allProbes_TightMu_pt";
00368   
00369   MonitorElement *Numerator_pfIso_pt   = theDbe->get(numpath_pfIso_pt);
00370   MonitorElement *Denominator_pfIso_pt = theDbe->get(denpath_pfIso_pt);
00371   
00372   if (Numerator_pfIso_pt && Denominator_pfIso_pt){
00373  
00374     TH1F *h_numerator_pfIso_pt   = Numerator_pfIso_pt->getTH1F();
00375     TH1F *h_denominator_pfIso_pt = Denominator_pfIso_pt->getTH1F();
00376 
00377     TH1F *h_eff_pfIso_pt = h_eff_pt_pfIsoTightMu->getTH1F();
00378     
00379     if (h_eff_pfIso_pt->GetSumw2N() == 0) h_eff_pfIso_pt->Sumw2();  
00380     
00381     h_eff_pfIso_pt->Divide(h_numerator_pfIso_pt, h_denominator_pfIso_pt, 1., 1., "B");
00382   }
00383 
00384 
00386 
00387   string numpath_pfIso_EB_pt = "Muons/EfficiencyAnalyzer/passProbes_EB_pfIsoTightMu_pt";
00388   string denpath_pfIso_EB_pt = "Muons/EfficiencyAnalyzer/allProbes_EB_TightMu_pt";
00389   
00390   MonitorElement *Numerator_pfIso_EB_pt   = theDbe->get(numpath_pfIso_EB_pt);
00391   MonitorElement *Denominator_pfIso_EB_pt = theDbe->get(denpath_pfIso_EB_pt);
00392   
00393   if (Numerator_pfIso_EB_pt && Denominator_pfIso_EB_pt){
00394  
00395     TH1F *h_numerator_pfIso_EB_pt   = Numerator_pfIso_EB_pt->getTH1F();
00396     TH1F *h_denominator_pfIso_EB_pt = Denominator_pfIso_EB_pt->getTH1F();
00397 
00398     TH1F *h_eff_pfIso_EB_pt = h_eff_pt_EB_pfIsoTightMu->getTH1F();
00399     
00400     if (h_eff_pfIso_EB_pt->GetSumw2N() == 0) h_eff_pfIso_EB_pt->Sumw2();  
00401     h_eff_pfIso_EB_pt->Divide(h_numerator_pfIso_EB_pt, h_denominator_pfIso_EB_pt, 1., 1., "B");
00402 
00403   }
00404 
00405 
00407   string numpath_pfIso_EE_pt = "Muons/EfficiencyAnalyzer/passProbes_EE_pfIsoTightMu_pt";
00408   string denpath_pfIso_EE_pt = "Muons/EfficiencyAnalyzer/allProbes_EE_TightMu_pt";
00409   
00410   MonitorElement *Numerator_pfIso_EE_pt   = theDbe->get(numpath_pfIso_EE_pt);
00411   MonitorElement *Denominator_pfIso_EE_pt = theDbe->get(denpath_pfIso_EE_pt);
00412   
00413   if (Numerator_pfIso_EE_pt && Denominator_pfIso_EE_pt){
00414  
00415     TH1F *h_numerator_pfIso_EE_pt   = Numerator_pfIso_EE_pt->getTH1F();
00416     TH1F *h_denominator_pfIso_EE_pt = Denominator_pfIso_EE_pt->getTH1F();
00417 
00418     TH1F *h_eff_pfIso_EE_pt = h_eff_pt_EE_pfIsoTightMu->getTH1F();
00419     
00420     if (h_eff_pfIso_EE_pt->GetSumw2N() == 0) h_eff_pfIso_EE_pt->Sumw2();  
00421     
00422     h_eff_pfIso_EE_pt->Divide(h_numerator_pfIso_EE_pt, h_denominator_pfIso_EE_pt, 1., 1., "B");
00423 
00424   }
00425 
00426 
00428 
00429   string numpath_pfIso_nvtx = "Muons/EfficiencyAnalyzer/passProbes_pfIsoTightMu_nVtx";
00430   string denpath_pfIso_nvtx = "Muons/EfficiencyAnalyzer/allProbes_TightMu_nVtx";
00431   
00432   MonitorElement *Numerator_pfIso_nvtx   = theDbe->get(numpath_pfIso_nvtx);
00433   MonitorElement *Denominator_pfIso_nvtx = theDbe->get(denpath_pfIso_nvtx);
00434   
00435   if (Numerator_pfIso_nvtx && Denominator_pfIso_nvtx){
00436  
00437     TH1F *h_numerator_pfIso_nvtx   = Numerator_pfIso_nvtx->getTH1F();
00438     TH1F *h_denominator_pfIso_nvtx = Denominator_pfIso_nvtx->getTH1F();
00439 
00440     TH1F *h_eff_pfIso_nvtx = h_eff_vtx_pfIsoTightMu->getTH1F();
00441     
00442     if (h_eff_pfIso_nvtx->GetSumw2N() == 0) h_eff_pfIso_nvtx->Sumw2();  
00443     
00444     h_eff_pfIso_nvtx->Divide(h_numerator_pfIso_nvtx, h_denominator_pfIso_nvtx, 1., 1., "B");
00445 
00446   }
00447 
00448 
00449 
00451   string numpath_detIso_nvtx = "Muons/EfficiencyAnalyzer/passProbes_detIsoTightMu_nVtx";
00452   string denpath_detIso_nvtx = "Muons/EfficiencyAnalyzer/allProbes_TightMu_nVtx";
00453   
00454   MonitorElement *Numerator_detIso_nvtx   = theDbe->get(numpath_detIso_nvtx);
00455   MonitorElement *Denominator_detIso_nvtx = theDbe->get(denpath_detIso_nvtx);
00456   
00457   if (Numerator_detIso_nvtx && Denominator_detIso_nvtx){
00458  
00459     TH1F *h_numerator_detIso_nvtx   = Numerator_detIso_nvtx->getTH1F();
00460     TH1F *h_denominator_detIso_nvtx = Denominator_detIso_nvtx->getTH1F();
00461 
00462     TH1F *h_eff_detIso_nvtx = h_eff_vtx_detIsoTightMu->getTH1F();
00463     
00464     if (h_eff_detIso_nvtx->GetSumw2N() == 0) h_eff_detIso_nvtx->Sumw2();  
00465     
00466     h_eff_detIso_nvtx->Divide(h_numerator_detIso_nvtx, h_denominator_detIso_nvtx, 1., 1., "B");
00467 
00468   }
00469 
00470 
00472   numpath_detIso_nvtx = "Muons/EfficiencyAnalyzer/passProbes_EB_detIsoTightMu_nVtx";
00473   denpath_detIso_nvtx = "Muons/EfficiencyAnalyzer/allProbes_EB_TightMu_nVtx";
00474   
00475   Numerator_detIso_nvtx   = theDbe->get(numpath_detIso_nvtx);
00476   Denominator_detIso_nvtx = theDbe->get(denpath_detIso_nvtx);
00477   
00478   if (Numerator_detIso_nvtx && Denominator_detIso_nvtx){
00479     TH1F *h_numerator_detIso_nvtx   = Numerator_detIso_nvtx->getTH1F();
00480     TH1F *h_denominator_detIso_nvtx = Denominator_detIso_nvtx->getTH1F();
00481     
00482     TH1F *h_eff_detIso_nvtx = h_eff_vtx_EB_detIsoTightMu->getTH1F();
00483     
00484     if (h_eff_detIso_nvtx->GetSumw2N() == 0) h_eff_detIso_nvtx->Sumw2();  
00485     h_eff_detIso_nvtx->Divide(h_numerator_detIso_nvtx, h_denominator_detIso_nvtx, 1., 1., "B");
00486   }
00487   
00489   numpath_detIso_nvtx = "Muons/EfficiencyAnalyzer/passProbes_EE_detIsoTightMu_nVtx";
00490   denpath_detIso_nvtx = "Muons/EfficiencyAnalyzer/allProbes_EE_TightMu_nVtx";
00491   
00492   Numerator_detIso_nvtx   = theDbe->get(numpath_detIso_nvtx);
00493   Denominator_detIso_nvtx = theDbe->get(denpath_detIso_nvtx);
00494   
00495   if (Numerator_detIso_nvtx && Denominator_detIso_nvtx){
00496  
00497     TH1F *h_numerator_detIso_nvtx   = Numerator_detIso_nvtx->getTH1F();
00498     TH1F *h_denominator_detIso_nvtx = Denominator_detIso_nvtx->getTH1F();
00499 
00500     TH1F *h_eff_detIso_nvtx = h_eff_vtx_EE_detIsoTightMu->getTH1F();
00501     
00502     if (h_eff_detIso_nvtx->GetSumw2N() == 0) h_eff_detIso_nvtx->Sumw2();  
00503     
00504     h_eff_detIso_nvtx->Divide(h_numerator_detIso_nvtx, h_denominator_detIso_nvtx, 1., 1., "B");
00505 
00506   }
00507 
00508 
00510   numpath_pfIso_nvtx = "Muons/EfficiencyAnalyzer/passProbes_EB_pfIsoTightMu_nVtx";
00511   denpath_pfIso_nvtx = "Muons/EfficiencyAnalyzer/allProbes_EB_TightMu_nVtx";
00512   
00513   Numerator_pfIso_nvtx   = theDbe->get(numpath_pfIso_nvtx);
00514   Denominator_pfIso_nvtx = theDbe->get(denpath_pfIso_nvtx);
00515   
00516   if (Numerator_pfIso_nvtx && Denominator_pfIso_nvtx){
00517  
00518     TH1F *h_numerator_pfIso_nvtx   = Numerator_pfIso_nvtx->getTH1F();
00519     TH1F *h_denominator_pfIso_nvtx = Denominator_pfIso_nvtx->getTH1F();
00520 
00521     TH1F *h_eff_pfIso_nvtx = h_eff_vtx_EB_pfIsoTightMu->getTH1F();
00522     
00523     if (h_eff_pfIso_nvtx->GetSumw2N() == 0) h_eff_pfIso_nvtx->Sumw2();  
00524     
00525     h_eff_pfIso_nvtx->Divide(h_numerator_pfIso_nvtx, h_denominator_pfIso_nvtx, 1., 1., "B");
00526   }
00527   
00529   numpath_pfIso_nvtx = "Muons/EfficiencyAnalyzer/passProbes_EE_pfIsoTightMu_nVtx";
00530   denpath_pfIso_nvtx = "Muons/EfficiencyAnalyzer/allProbes_EE_TightMu_nVtx";
00531   
00532   Numerator_pfIso_nvtx   = theDbe->get(numpath_pfIso_nvtx);
00533   Denominator_pfIso_nvtx = theDbe->get(denpath_pfIso_nvtx);
00534   
00535   if (Numerator_pfIso_nvtx && Denominator_pfIso_nvtx){
00536  
00537     TH1F *h_numerator_pfIso_nvtx   = Numerator_pfIso_nvtx->getTH1F();
00538     TH1F *h_denominator_pfIso_nvtx = Denominator_pfIso_nvtx->getTH1F();
00539 
00540     TH1F *h_eff_pfIso_nvtx = h_eff_vtx_EE_pfIsoTightMu->getTH1F();
00541     
00542     if (h_eff_pfIso_nvtx->GetSumw2N() == 0) h_eff_pfIso_nvtx->Sumw2();  
00543     
00544     h_eff_pfIso_nvtx->Divide(h_numerator_pfIso_nvtx, h_denominator_pfIso_nvtx, 1., 1., "B");
00545 
00546   }
00547 
00548 
00549 
00551   string numpath_pfIsodB_pt = "Muons/EfficiencyAnalyzer/passProbes_pfIsodBTightMu_pt";
00552   string denpath_pfIsodB_pt = "Muons/EfficiencyAnalyzer/allProbes_TightMu_pt";
00553   
00554   MonitorElement *Numerator_pfIsodB_pt   = theDbe->get(numpath_pfIsodB_pt);
00555   MonitorElement *Denominator_pfIsodB_pt = theDbe->get(denpath_pfIsodB_pt);
00556   
00557   if (Numerator_pfIsodB_pt && Denominator_pfIsodB_pt){
00558  
00559     TH1F *h_numerator_pfIsodB_pt   = Numerator_pfIsodB_pt->getTH1F();
00560     TH1F *h_denominator_pfIsodB_pt = Denominator_pfIsodB_pt->getTH1F();
00561 
00562     TH1F *h_eff_pfIsodB_pt = h_eff_pt_pfIsodBTightMu->getTH1F();
00563     
00564     if (h_eff_pfIsodB_pt->GetSumw2N() == 0) h_eff_pfIsodB_pt->Sumw2();  
00565     
00566     h_eff_pfIsodB_pt->Divide(h_numerator_pfIsodB_pt, h_denominator_pfIsodB_pt, 1., 1., "B");
00567   }
00568 
00569 
00571 
00572   string numpath_pfIsodB_EB_pt = "Muons/EfficiencyAnalyzer/passProbes_EB_pfIsodBTightMu_pt";
00573   string denpath_pfIsodB_EB_pt = "Muons/EfficiencyAnalyzer/allProbes_EB_TightMu_pt";
00574   
00575   MonitorElement *Numerator_pfIsodB_EB_pt   = theDbe->get(numpath_pfIsodB_EB_pt);
00576   MonitorElement *Denominator_pfIsodB_EB_pt = theDbe->get(denpath_pfIsodB_EB_pt);
00577   
00578   if (Numerator_pfIsodB_EB_pt && Denominator_pfIsodB_EB_pt){
00579  
00580     TH1F *h_numerator_pfIsodB_EB_pt   = Numerator_pfIsodB_EB_pt->getTH1F();
00581     TH1F *h_denominator_pfIsodB_EB_pt = Denominator_pfIsodB_EB_pt->getTH1F();
00582 
00583     TH1F *h_eff_pfIsodB_EB_pt = h_eff_pt_EB_pfIsodBTightMu->getTH1F();
00584     
00585     if (h_eff_pfIsodB_EB_pt->GetSumw2N() == 0) h_eff_pfIsodB_EB_pt->Sumw2();  
00586     h_eff_pfIsodB_EB_pt->Divide(h_numerator_pfIsodB_EB_pt, h_denominator_pfIsodB_EB_pt, 1., 1., "B");
00587 
00588   }
00589 
00590 
00592   string numpath_pfIsodB_EE_pt = "Muons/EfficiencyAnalyzer/passProbes_EE_pfIsodBTightMu_pt";
00593   string denpath_pfIsodB_EE_pt = "Muons/EfficiencyAnalyzer/allProbes_EE_TightMu_pt";
00594   
00595   MonitorElement *Numerator_pfIsodB_EE_pt   = theDbe->get(numpath_pfIsodB_EE_pt);
00596   MonitorElement *Denominator_pfIsodB_EE_pt = theDbe->get(denpath_pfIsodB_EE_pt);
00597   
00598   if (Numerator_pfIsodB_EE_pt && Denominator_pfIsodB_EE_pt){
00599  
00600     TH1F *h_numerator_pfIsodB_EE_pt   = Numerator_pfIsodB_EE_pt->getTH1F();
00601     TH1F *h_denominator_pfIsodB_EE_pt = Denominator_pfIsodB_EE_pt->getTH1F();
00602 
00603     TH1F *h_eff_pfIsodB_EE_pt = h_eff_pt_EE_pfIsodBTightMu->getTH1F();
00604     
00605     if (h_eff_pfIsodB_EE_pt->GetSumw2N() == 0) h_eff_pfIsodB_EE_pt->Sumw2();  
00606     
00607     h_eff_pfIsodB_EE_pt->Divide(h_numerator_pfIsodB_EE_pt, h_denominator_pfIsodB_EE_pt, 1., 1., "B");
00608 
00609   }
00610 
00611 
00613 
00614   string numpath_pfIsodB_nvtx = "Muons/EfficiencyAnalyzer/passProbes_pfIsodBTightMu_nVtx";
00615   string denpath_pfIsodB_nvtx = "Muons/EfficiencyAnalyzer/allProbes_TightMu_nVtx";
00616   
00617   MonitorElement *Numerator_pfIsodB_nvtx   = theDbe->get(numpath_pfIsodB_nvtx);
00618   MonitorElement *Denominator_pfIsodB_nvtx = theDbe->get(denpath_pfIsodB_nvtx);
00619   
00620   if (Numerator_pfIsodB_nvtx && Denominator_pfIsodB_nvtx){
00621  
00622     TH1F *h_numerator_pfIsodB_nvtx   = Numerator_pfIsodB_nvtx->getTH1F();
00623     TH1F *h_denominator_pfIsodB_nvtx = Denominator_pfIsodB_nvtx->getTH1F();
00624 
00625     TH1F *h_eff_pfIsodB_nvtx = h_eff_vtx_pfIsodBTightMu->getTH1F();
00626     
00627     if (h_eff_pfIsodB_nvtx->GetSumw2N() == 0) h_eff_pfIsodB_nvtx->Sumw2();  
00628     
00629     h_eff_pfIsodB_nvtx->Divide(h_numerator_pfIsodB_nvtx, h_denominator_pfIsodB_nvtx, 1., 1., "B");
00630 
00631   }
00632 
00633 
00635   numpath_pfIsodB_nvtx = "Muons/EfficiencyAnalyzer/passProbes_EB_pfIsodBTightMu_nVtx";
00636   denpath_pfIsodB_nvtx = "Muons/EfficiencyAnalyzer/allProbes_EB_TightMu_nVtx";
00637   
00638   Numerator_pfIsodB_nvtx   = theDbe->get(numpath_pfIsodB_nvtx);
00639   Denominator_pfIsodB_nvtx = theDbe->get(denpath_pfIsodB_nvtx);
00640   
00641   if (Numerator_pfIsodB_nvtx && Denominator_pfIsodB_nvtx){
00642  
00643     TH1F *h_numerator_pfIsodB_nvtx   = Numerator_pfIsodB_nvtx->getTH1F();
00644     TH1F *h_denominator_pfIsodB_nvtx = Denominator_pfIsodB_nvtx->getTH1F();
00645 
00646     TH1F *h_eff_pfIsodB_nvtx = h_eff_vtx_EB_pfIsodBTightMu->getTH1F();
00647     
00648     if (h_eff_pfIsodB_nvtx->GetSumw2N() == 0) h_eff_pfIsodB_nvtx->Sumw2();  
00649     
00650     h_eff_pfIsodB_nvtx->Divide(h_numerator_pfIsodB_nvtx, h_denominator_pfIsodB_nvtx, 1., 1., "B");
00651   }
00652   
00653 
00655   numpath_pfIsodB_nvtx = "Muons/EfficiencyAnalyzer/passProbes_EE_pfIsodBTightMu_nVtx";
00656   denpath_pfIsodB_nvtx = "Muons/EfficiencyAnalyzer/allProbes_EE_TightMu_nVtx";
00657   
00658   Numerator_pfIsodB_nvtx   = theDbe->get(numpath_pfIsodB_nvtx);
00659   Denominator_pfIsodB_nvtx = theDbe->get(denpath_pfIsodB_nvtx);
00660   
00661   if (Numerator_pfIsodB_nvtx && Denominator_pfIsodB_nvtx){
00662  
00663     TH1F *h_numerator_pfIsodB_nvtx   = Numerator_pfIsodB_nvtx->getTH1F();
00664     TH1F *h_denominator_pfIsodB_nvtx = Denominator_pfIsodB_nvtx->getTH1F();
00665 
00666     TH1F *h_eff_pfIsodB_nvtx = h_eff_vtx_EE_pfIsodBTightMu->getTH1F();
00667     
00668     if (h_eff_pfIsodB_nvtx->GetSumw2N() == 0) h_eff_pfIsodB_nvtx->Sumw2();  
00669     
00670     h_eff_pfIsodB_nvtx->Divide(h_numerator_pfIsodB_nvtx, h_denominator_pfIsodB_nvtx, 1., 1., "B");
00671 
00672   }
00673 
00674 
00675 }
00676 
00677 
00678 void EfficiencyPlotter::endJob(){
00679   LogTrace(metname)<< "[EfficiencyPlotter] endJob called!";
00680   theDbe->rmdir("Muons/EfficiencyAnalyzer");
00681 }
00682