CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2_patch1/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   // This prevents this ME to be normalized when drawn into the GUI
00085   h_eff_eta_TightMu         ->setEfficiencyFlag();
00086   h_eff_hp_eta_TightMu      ->setEfficiencyFlag();
00087   h_eff_phi_TightMu         ->setEfficiencyFlag();
00088   h_eff_pt_TightMu          ->setEfficiencyFlag();
00089   h_eff_pt_EB_TightMu       ->setEfficiencyFlag();
00090   h_eff_pt_EE_TightMu       ->setEfficiencyFlag();
00091   h_eff_pt_detIsoTightMu    ->setEfficiencyFlag();
00092   h_eff_pt_EB_detIsoTightMu ->setEfficiencyFlag();
00093   h_eff_pt_EE_detIsoTightMu ->setEfficiencyFlag();
00094   h_eff_pt_pfIsoTightMu     ->setEfficiencyFlag();
00095   h_eff_pt_EB_pfIsoTightMu  ->setEfficiencyFlag();
00096   h_eff_pt_EE_pfIsoTightMu  ->setEfficiencyFlag();
00097   h_eff_vtx_detIsoTightMu   ->setEfficiencyFlag();
00098   h_eff_vtx_pfIsoTightMu    ->setEfficiencyFlag();
00099   h_eff_vtx_EB_detIsoTightMu->setEfficiencyFlag();
00100   h_eff_vtx_EB_pfIsoTightMu ->setEfficiencyFlag();
00101   h_eff_vtx_EE_detIsoTightMu->setEfficiencyFlag();
00102   h_eff_vtx_EE_pfIsoTightMu ->setEfficiencyFlag();
00103 
00104   // AXIS TITLES....
00105   h_eff_hp_eta_TightMu      ->setAxisTitle("#eta",         1);  
00106   h_eff_eta_TightMu         ->setAxisTitle("#eta",         1);  
00107   h_eff_phi_TightMu         ->setAxisTitle("#phi",         1);  
00108   h_eff_pt_TightMu          ->setAxisTitle("p_{T} (GeV)",  1);  
00109   h_eff_pt_EB_TightMu       ->setAxisTitle("p_{T} (GeV)",  1);  
00110   h_eff_pt_EE_TightMu       ->setAxisTitle("p_{T} (GeV)",  1);  
00111   h_eff_pt_detIsoTightMu    ->setAxisTitle("p_{T} (GeV)",  1);  
00112   h_eff_pt_EB_detIsoTightMu ->setAxisTitle("p_{T} (GeV)",  1);  
00113   h_eff_pt_EE_detIsoTightMu ->setAxisTitle("p_{T} (GeV)",  1);  
00114   h_eff_pt_pfIsoTightMu     ->setAxisTitle("p_{T} (GeV)",  1);  
00115   h_eff_pt_EB_pfIsoTightMu  ->setAxisTitle("p_{T} (GeV)",  1);  
00116   h_eff_pt_EE_pfIsoTightMu  ->setAxisTitle("p_{T} (GeV)",  1);  
00117   h_eff_vtx_detIsoTightMu   ->setAxisTitle("Number of PV", 1);
00118   h_eff_vtx_pfIsoTightMu    ->setAxisTitle("Number of PV", 1);
00119   h_eff_vtx_EB_detIsoTightMu->setAxisTitle("Number of PV", 1);
00120   h_eff_vtx_EB_pfIsoTightMu ->setAxisTitle("Number of PV", 1);
00121   h_eff_vtx_EE_detIsoTightMu->setAxisTitle("Number of PV", 1);
00122   h_eff_vtx_EE_pfIsoTightMu ->setAxisTitle("Number of PV", 1);
00123   
00124 //   h_eff_eta_TightMu         ->setAxisTitle("Tight Mu Eff.",      2);  
00125 //   h_eff_hp_eta_TightMu      ->setAxisTitle("High p_{T} Mu Eff.", 2);  
00126 //   h_eff_phi_TightMu         ->setAxisTitle("Tight Mu Eff.",      2);  
00127 //   h_eff_pt_TightMu          ->setAxisTitle("Tight Mu Eff.",      2);  
00128 //   h_eff_pt_EB_TightMu       ->setAxisTitle("Tight Mu Eff.",      2);  
00129 //   h_eff_pt_EE_TightMu       ->setAxisTitle("Tight Mu Eff.",      2);  
00130 //   h_eff_pt_detIsoTightMu    ->setAxisTitle("Tight Mu Eff.",      2);  
00131 //   h_eff_pt_EB_detIsoTightMu ->setAxisTitle("Tight Mu Eff.",      2);  
00132 //   h_eff_pt_EE_detIsoTightMu ->setAxisTitle("Tight Mu Eff.",      2);  
00133 //   h_eff_pt_pfIsoTightMu     ->setAxisTitle("Tight Mu Eff.",      2);  
00134 //   h_eff_pt_EB_pfIsoTightMu  ->setAxisTitle("Tight Mu Eff.",      2);  
00135 //   h_eff_pt_EE_pfIsoTightMu  ->setAxisTitle("Tight Mu Eff.",      2);  
00136 //   h_eff_vtx_detIsoTightMu   ->setAxisTitle("Tight Mu Eff.",      2);
00137 //   h_eff_vtx_pfIsoTightMu    ->setAxisTitle("Tight Mu Eff.",      2);
00138 //   h_eff_vtx_EB_detIsoTightMu->setAxisTitle("Tight Mu Eff.",      2);
00139 //   h_eff_vtx_EB_pfIsoTightMu ->setAxisTitle("Tight Mu Eff.",      2);
00140 //   h_eff_vtx_EE_detIsoTightMu->setAxisTitle("Tight Mu Eff.",      2);
00141 //   h_eff_vtx_EE_pfIsoTightMu ->setAxisTitle("Tight Mu Eff.",      2);
00142 }
00143 
00144 
00145 void EfficiencyPlotter::beginRun(Run const& run, EventSetup const& eSetup) {
00146   LogTrace(metname)<<"[EfficiencyPlotter]: beginRun";
00147 }
00148 void EfficiencyPlotter::beginLuminosityBlock(LuminosityBlock const& lumiSeg, EventSetup const& context) {
00149   LogTrace(metname)<<"[EfficiencyPlotter]: beginLuminosityBlock";
00150   // Get the run number
00151   run = lumiSeg.run();
00152 }
00153 void EfficiencyPlotter::analyze(const edm::Event& e, const edm::EventSetup& context){
00154   nevents++;
00155   LogTrace(metname)<< "[EfficiencyPlotter]: "<<nevents<<" events";
00156 }
00157 void EfficiencyPlotter::endLuminosityBlock(LuminosityBlock const& lumiSeg, EventSetup const& context) {
00158   //  LogTrace(metname)<<"[EfficiencyPlotter]: endLuminosityBlock, performing the DQM LS client operation";
00159   // counts number of lumiSegs 
00160   nLumiSegs = lumiSeg.id().luminosityBlock();
00161 }
00162 void EfficiencyPlotter::endRun(Run const& run, EventSetup const& eSetup) {
00163   LogTrace(metname)<<"[EfficiencyPlotter]: endRun, performing the DQM end of run client operation";
00164   
00165   
00167   string numpath_pt = "Muons/EfficiencyAnalyzer/passProbes_TightMu_pt";
00168   string denpath_pt = "Muons/EfficiencyAnalyzer/allProbes_pt";
00169   
00170   MonitorElement *Numerator_pt   = theDbe->get(numpath_pt);
00171   MonitorElement *Denominator_pt = theDbe->get(denpath_pt);
00172   
00173   if (Numerator_pt && Denominator_pt){
00174     TH1F *h_numerator_pt   = Numerator_pt->getTH1F();
00175     TH1F *h_denominator_pt = Denominator_pt->getTH1F();
00176     TH1F *h_eff_pt         = h_eff_pt_TightMu->getTH1F();
00177     
00178     if (h_eff_pt->GetSumw2N() == 0) h_eff_pt->Sumw2();  
00179     h_eff_pt->Divide(h_numerator_pt, h_denominator_pt, 1., 1., "B");
00180   }
00181   
00183   string numpath_EB_pt = "Muons/EfficiencyAnalyzer/passProbes_TightMu_EB_pt";
00184   string denpath_EB_pt = "Muons/EfficiencyAnalyzer/allProbes_EB_pt";
00185   
00186   MonitorElement *Numerator_EB_pt   = theDbe->get(numpath_EB_pt);
00187   MonitorElement *Denominator_EB_pt = theDbe->get(denpath_EB_pt);
00188   
00189   if (Numerator_EB_pt && Denominator_EB_pt){
00190     TH1F *h_numerator_EB_pt   = Numerator_EB_pt->getTH1F();
00191     TH1F *h_denominator_EB_pt = Denominator_EB_pt->getTH1F();
00192     TH1F *h_eff_EB_pt         = h_eff_pt_EB_TightMu->getTH1F();
00193     
00194     if (h_eff_EB_pt->GetSumw2N() == 0) h_eff_EB_pt->Sumw2();  
00195     h_eff_EB_pt->Divide(h_numerator_EB_pt, h_denominator_EB_pt, 1., 1., "B");
00196   }
00197 
00199   string numpath_EE_pt = "Muons/EfficiencyAnalyzer/passProbes_TightMu_EE_pt";
00200   string denpath_EE_pt = "Muons/EfficiencyAnalyzer/allProbes_EE_pt";
00201   
00202   MonitorElement *Numerator_EE_pt   = theDbe->get(numpath_EE_pt);
00203   MonitorElement *Denominator_EE_pt = theDbe->get(denpath_EE_pt);
00204   
00205   if (Numerator_EE_pt && Denominator_EE_pt){
00206     TH1F *h_numerator_EE_pt   = Numerator_EE_pt->getTH1F();
00207     TH1F *h_denominator_EE_pt = Denominator_EE_pt->getTH1F();
00208     TH1F *h_eff_EE_pt         = h_eff_pt_EE_TightMu->getTH1F();
00209     
00210     if (h_eff_EE_pt->GetSumw2N() == 0) h_eff_EE_pt->Sumw2();  
00211     h_eff_EE_pt->Divide(h_numerator_EE_pt, h_denominator_EE_pt, 1., 1., "B");
00212   }
00213 
00215   string numpath_eta = "Muons/EfficiencyAnalyzer/passProbes_TightMu_eta";
00216   string denpath_eta = "Muons/EfficiencyAnalyzer/allProbes_eta";
00217   
00218   MonitorElement *Numerator_eta   = theDbe->get(numpath_eta);
00219   MonitorElement *Denominator_eta = theDbe->get(denpath_eta);
00220   
00221   if (Numerator_eta && Denominator_eta){
00222  
00223     TH1F *h_numerator_eta   = Numerator_eta->getTH1F();
00224     TH1F *h_denominator_eta = Denominator_eta->getTH1F();
00225 
00226     TH1F *h_eff_eta = h_eff_eta_TightMu->getTH1F();
00227     
00228     if (h_eff_eta->GetSumw2N() == 0) h_eff_eta->Sumw2();  
00229     
00230     h_eff_eta->Divide(h_numerator_eta, h_denominator_eta, 1., 1., "B");
00231 
00232   }
00233 
00235 
00236   string numpath_hp_eta = "Muons/EfficiencyAnalyzer/passProbes_TightMu_hp_eta";
00237   string denpath_hp_eta = "Muons/EfficiencyAnalyzer/allProbes_hp_eta";
00238   
00239   MonitorElement *Numerator_hp_eta   = theDbe->get(numpath_hp_eta);
00240   MonitorElement *Denominator_hp_eta = theDbe->get(denpath_hp_eta);
00241   
00242   if (Numerator_hp_eta && Denominator_hp_eta){
00243  
00244     TH1F *h_numerator_hp_eta   = Numerator_hp_eta->getTH1F();
00245     TH1F *h_denominator_hp_eta = Denominator_hp_eta->getTH1F();
00246 
00247     TH1F *h_eff_hp_eta = h_eff_hp_eta_TightMu->getTH1F();
00248     
00249     if (h_eff_hp_eta->GetSumw2N() == 0) h_eff_hp_eta->Sumw2();  
00250     
00251     h_eff_hp_eta->Divide(h_numerator_hp_eta, h_denominator_hp_eta, 1., 1., "B");
00252 
00253   }
00254 
00256 
00257   string numpath_phi = "Muons/EfficiencyAnalyzer/passProbes_TightMu_phi";
00258   string denpath_phi = "Muons/EfficiencyAnalyzer/allProbes_phi";
00259   
00260   MonitorElement *Numerator_phi   = theDbe->get(numpath_phi);
00261   MonitorElement *Denominator_phi = theDbe->get(denpath_phi);
00262   
00263   if (Numerator_phi && Denominator_phi){
00264  
00265     TH1F *h_numerator_phi   = Numerator_phi->getTH1F();
00266     TH1F *h_denominator_phi = Denominator_phi->getTH1F();
00267 
00268     TH1F *h_eff_phi = h_eff_phi_TightMu->getTH1F();
00269     
00270     if (h_eff_phi->GetSumw2N() == 0) h_eff_phi->Sumw2();  
00271     
00272     h_eff_phi->Divide(h_numerator_phi, h_denominator_phi, 1., 1., "B");
00273 
00274   }
00275 
00276 
00278   string numpath_detIso_pt = "Muons/EfficiencyAnalyzer/passProbes_detIsoTightMu_pt";
00279   string denpath_detIso_pt = "Muons/EfficiencyAnalyzer/allProbes_TightMu_pt";
00280   
00281   MonitorElement *Numerator_detIso_pt   = theDbe->get(numpath_detIso_pt);
00282   MonitorElement *Denominator_detIso_pt = theDbe->get(denpath_detIso_pt);
00283   
00284   if (Numerator_detIso_pt && Denominator_detIso_pt){
00285  
00286     TH1F *h_numerator_detIso_pt   = Numerator_detIso_pt->getTH1F();
00287     TH1F *h_denominator_detIso_pt = Denominator_detIso_pt->getTH1F();
00288 
00289     TH1F *h_eff_detIso_pt = h_eff_pt_detIsoTightMu->getTH1F();
00290     
00291     if (h_eff_detIso_pt->GetSumw2N() == 0) h_eff_detIso_pt->Sumw2();  
00292     h_eff_detIso_pt->Divide(h_numerator_detIso_pt, h_denominator_detIso_pt, 1., 1., "B");
00293     
00294   }
00295 
00296 
00298   string numpath_detIso_EB_pt = "Muons/EfficiencyAnalyzer/passProbes_EB_detIsoTightMu_pt";
00299   string denpath_detIso_EB_pt = "Muons/EfficiencyAnalyzer/allProbes_EB_TightMu_pt";
00300   
00301   MonitorElement *Numerator_detIso_EB_pt   = theDbe->get(numpath_detIso_EB_pt);
00302   MonitorElement *Denominator_detIso_EB_pt = theDbe->get(denpath_detIso_EB_pt);
00303   
00304   if (Numerator_detIso_EB_pt && Denominator_detIso_EB_pt){
00305  
00306     TH1F *h_numerator_detIso_EB_pt   = Numerator_detIso_EB_pt->getTH1F();
00307     TH1F *h_denominator_detIso_EB_pt = Denominator_detIso_EB_pt->getTH1F();
00308 
00309     TH1F *h_eff_detIso_EB_pt = h_eff_pt_EB_detIsoTightMu->getTH1F();
00310     
00311     if (h_eff_detIso_EB_pt->GetSumw2N() == 0) h_eff_detIso_EB_pt->Sumw2();  
00312     
00313     h_eff_detIso_EB_pt->Divide(h_numerator_detIso_EB_pt, h_denominator_detIso_EB_pt, 1., 1., "B");
00314 
00315   }
00316 
00317 
00319   string numpath_detIso_EE_pt = "Muons/EfficiencyAnalyzer/passProbes_EE_detIsoTightMu_pt";
00320   string denpath_detIso_EE_pt = "Muons/EfficiencyAnalyzer/allProbes_EE_TightMu_pt";
00321   
00322   MonitorElement *Numerator_detIso_EE_pt   = theDbe->get(numpath_detIso_EE_pt);
00323   MonitorElement *Denominator_detIso_EE_pt = theDbe->get(denpath_detIso_EE_pt);
00324   
00325   if (Numerator_detIso_EE_pt && Denominator_detIso_EE_pt){
00326  
00327     TH1F *h_numerator_detIso_EE_pt   = Numerator_detIso_EE_pt->getTH1F();
00328     TH1F *h_denominator_detIso_EE_pt = Denominator_detIso_EE_pt->getTH1F();
00329 
00330     TH1F *h_eff_detIso_EE_pt = h_eff_pt_EE_detIsoTightMu->getTH1F();
00331     
00332     if (h_eff_detIso_EE_pt->GetSumw2N() == 0) h_eff_detIso_EE_pt->Sumw2();  
00333     
00334     h_eff_detIso_EE_pt->Divide(h_numerator_detIso_EE_pt, h_denominator_detIso_EE_pt, 1., 1., "B");
00335 
00336   }
00337 
00338 
00340   string numpath_pfIso_pt = "Muons/EfficiencyAnalyzer/passProbes_pfIsoTightMu_pt";
00341   string denpath_pfIso_pt = "Muons/EfficiencyAnalyzer/allProbes_TightMu_pt";
00342   
00343   MonitorElement *Numerator_pfIso_pt   = theDbe->get(numpath_pfIso_pt);
00344   MonitorElement *Denominator_pfIso_pt = theDbe->get(denpath_pfIso_pt);
00345   
00346   if (Numerator_pfIso_pt && Denominator_pfIso_pt){
00347  
00348     TH1F *h_numerator_pfIso_pt   = Numerator_pfIso_pt->getTH1F();
00349     TH1F *h_denominator_pfIso_pt = Denominator_pfIso_pt->getTH1F();
00350 
00351     TH1F *h_eff_pfIso_pt = h_eff_pt_pfIsoTightMu->getTH1F();
00352     
00353     if (h_eff_pfIso_pt->GetSumw2N() == 0) h_eff_pfIso_pt->Sumw2();  
00354     
00355     h_eff_pfIso_pt->Divide(h_numerator_pfIso_pt, h_denominator_pfIso_pt, 1., 1., "B");
00356   }
00357 
00358 
00360 
00361   string numpath_pfIso_EB_pt = "Muons/EfficiencyAnalyzer/passProbes_EB_pfIsoTightMu_pt";
00362   string denpath_pfIso_EB_pt = "Muons/EfficiencyAnalyzer/allProbes_EB_TightMu_pt";
00363   
00364   MonitorElement *Numerator_pfIso_EB_pt   = theDbe->get(numpath_pfIso_EB_pt);
00365   MonitorElement *Denominator_pfIso_EB_pt = theDbe->get(denpath_pfIso_EB_pt);
00366   
00367   if (Numerator_pfIso_EB_pt && Denominator_pfIso_EB_pt){
00368  
00369     TH1F *h_numerator_pfIso_EB_pt   = Numerator_pfIso_EB_pt->getTH1F();
00370     TH1F *h_denominator_pfIso_EB_pt = Denominator_pfIso_EB_pt->getTH1F();
00371 
00372     TH1F *h_eff_pfIso_EB_pt = h_eff_pt_EB_pfIsoTightMu->getTH1F();
00373     
00374     if (h_eff_pfIso_EB_pt->GetSumw2N() == 0) h_eff_pfIso_EB_pt->Sumw2();  
00375     h_eff_pfIso_EB_pt->Divide(h_numerator_pfIso_EB_pt, h_denominator_pfIso_EB_pt, 1., 1., "B");
00376 
00377   }
00378 
00379 
00381   string numpath_pfIso_EE_pt = "Muons/EfficiencyAnalyzer/passProbes_EE_pfIsoTightMu_pt";
00382   string denpath_pfIso_EE_pt = "Muons/EfficiencyAnalyzer/allProbes_EE_TightMu_pt";
00383   
00384   MonitorElement *Numerator_pfIso_EE_pt   = theDbe->get(numpath_pfIso_EE_pt);
00385   MonitorElement *Denominator_pfIso_EE_pt = theDbe->get(denpath_pfIso_EE_pt);
00386   
00387   if (Numerator_pfIso_EE_pt && Denominator_pfIso_EE_pt){
00388  
00389     TH1F *h_numerator_pfIso_EE_pt   = Numerator_pfIso_EE_pt->getTH1F();
00390     TH1F *h_denominator_pfIso_EE_pt = Denominator_pfIso_EE_pt->getTH1F();
00391 
00392     TH1F *h_eff_pfIso_EE_pt = h_eff_pt_EE_pfIsoTightMu->getTH1F();
00393     
00394     if (h_eff_pfIso_EE_pt->GetSumw2N() == 0) h_eff_pfIso_EE_pt->Sumw2();  
00395     
00396     h_eff_pfIso_EE_pt->Divide(h_numerator_pfIso_EE_pt, h_denominator_pfIso_EE_pt, 1., 1., "B");
00397 
00398   }
00399 
00400 
00402 
00403   string numpath_pfIso_nvtx = "Muons/EfficiencyAnalyzer/passProbes_pfIsoTightMu_nVtx";
00404   string denpath_pfIso_nvtx = "Muons/EfficiencyAnalyzer/allProbes_TightMu_nVtx";
00405   
00406   MonitorElement *Numerator_pfIso_nvtx   = theDbe->get(numpath_pfIso_nvtx);
00407   MonitorElement *Denominator_pfIso_nvtx = theDbe->get(denpath_pfIso_nvtx);
00408   
00409   if (Numerator_pfIso_nvtx && Denominator_pfIso_nvtx){
00410  
00411     TH1F *h_numerator_pfIso_nvtx   = Numerator_pfIso_nvtx->getTH1F();
00412     TH1F *h_denominator_pfIso_nvtx = Denominator_pfIso_nvtx->getTH1F();
00413 
00414     TH1F *h_eff_pfIso_nvtx = h_eff_vtx_pfIsoTightMu->getTH1F();
00415     
00416     if (h_eff_pfIso_nvtx->GetSumw2N() == 0) h_eff_pfIso_nvtx->Sumw2();  
00417     
00418     h_eff_pfIso_nvtx->Divide(h_numerator_pfIso_nvtx, h_denominator_pfIso_nvtx, 1., 1., "B");
00419 
00420   }
00421 
00422 
00423 
00425   string numpath_detIso_nvtx = "Muons/EfficiencyAnalyzer/passProbes_detIsoTightMu_nVtx";
00426   string denpath_detIso_nvtx = "Muons/EfficiencyAnalyzer/allProbes_TightMu_nVtx";
00427   
00428   MonitorElement *Numerator_detIso_nvtx   = theDbe->get(numpath_detIso_nvtx);
00429   MonitorElement *Denominator_detIso_nvtx = theDbe->get(denpath_detIso_nvtx);
00430   
00431   if (Numerator_detIso_nvtx && Denominator_detIso_nvtx){
00432  
00433     TH1F *h_numerator_detIso_nvtx   = Numerator_detIso_nvtx->getTH1F();
00434     TH1F *h_denominator_detIso_nvtx = Denominator_detIso_nvtx->getTH1F();
00435 
00436     TH1F *h_eff_detIso_nvtx = h_eff_vtx_detIsoTightMu->getTH1F();
00437     
00438     if (h_eff_detIso_nvtx->GetSumw2N() == 0) h_eff_detIso_nvtx->Sumw2();  
00439     
00440     h_eff_detIso_nvtx->Divide(h_numerator_detIso_nvtx, h_denominator_detIso_nvtx, 1., 1., "B");
00441 
00442   }
00443 
00444 
00446   numpath_detIso_nvtx = "Muons/EfficiencyAnalyzer/passProbes_EB_detIsoTightMu_nVtx";
00447   denpath_detIso_nvtx = "Muons/EfficiencyAnalyzer/allProbes_EB_TightMu_nVtx";
00448   
00449   Numerator_detIso_nvtx   = theDbe->get(numpath_detIso_nvtx);
00450   Denominator_detIso_nvtx = theDbe->get(denpath_detIso_nvtx);
00451   
00452   if (Numerator_detIso_nvtx && Denominator_detIso_nvtx){
00453     TH1F *h_numerator_detIso_nvtx   = Numerator_detIso_nvtx->getTH1F();
00454     TH1F *h_denominator_detIso_nvtx = Denominator_detIso_nvtx->getTH1F();
00455     
00456     TH1F *h_eff_detIso_nvtx = h_eff_vtx_EB_detIsoTightMu->getTH1F();
00457     
00458     if (h_eff_detIso_nvtx->GetSumw2N() == 0) h_eff_detIso_nvtx->Sumw2();  
00459     h_eff_detIso_nvtx->Divide(h_numerator_detIso_nvtx, h_denominator_detIso_nvtx, 1., 1., "B");
00460   }
00461   
00463   numpath_detIso_nvtx = "Muons/EfficiencyAnalyzer/passProbes_EE_detIsoTightMu_nVtx";
00464   denpath_detIso_nvtx = "Muons/EfficiencyAnalyzer/allProbes_EE_TightMu_nVtx";
00465   
00466   Numerator_detIso_nvtx   = theDbe->get(numpath_detIso_nvtx);
00467   Denominator_detIso_nvtx = theDbe->get(denpath_detIso_nvtx);
00468   
00469   if (Numerator_detIso_nvtx && Denominator_detIso_nvtx){
00470  
00471     TH1F *h_numerator_detIso_nvtx   = Numerator_detIso_nvtx->getTH1F();
00472     TH1F *h_denominator_detIso_nvtx = Denominator_detIso_nvtx->getTH1F();
00473 
00474     TH1F *h_eff_detIso_nvtx = h_eff_vtx_EE_detIsoTightMu->getTH1F();
00475     
00476     if (h_eff_detIso_nvtx->GetSumw2N() == 0) h_eff_detIso_nvtx->Sumw2();  
00477     
00478     h_eff_detIso_nvtx->Divide(h_numerator_detIso_nvtx, h_denominator_detIso_nvtx, 1., 1., "B");
00479 
00480   }
00481 
00482 
00484   numpath_pfIso_nvtx = "Muons/EfficiencyAnalyzer/passProbes_EB_pfIsoTightMu_nVtx";
00485   denpath_pfIso_nvtx = "Muons/EfficiencyAnalyzer/allProbes_EB_TightMu_nVtx";
00486   
00487   Numerator_pfIso_nvtx   = theDbe->get(numpath_pfIso_nvtx);
00488   Denominator_pfIso_nvtx = theDbe->get(denpath_pfIso_nvtx);
00489   
00490   if (Numerator_pfIso_nvtx && Denominator_pfIso_nvtx){
00491  
00492     TH1F *h_numerator_pfIso_nvtx   = Numerator_pfIso_nvtx->getTH1F();
00493     TH1F *h_denominator_pfIso_nvtx = Denominator_pfIso_nvtx->getTH1F();
00494 
00495     TH1F *h_eff_pfIso_nvtx = h_eff_vtx_EB_pfIsoTightMu->getTH1F();
00496     
00497     if (h_eff_pfIso_nvtx->GetSumw2N() == 0) h_eff_pfIso_nvtx->Sumw2();  
00498     
00499     h_eff_pfIso_nvtx->Divide(h_numerator_pfIso_nvtx, h_denominator_pfIso_nvtx, 1., 1., "B");
00500   }
00501   
00503   numpath_pfIso_nvtx = "Muons/EfficiencyAnalyzer/passProbes_EE_pfIsoTightMu_nVtx";
00504   denpath_pfIso_nvtx = "Muons/EfficiencyAnalyzer/allProbes_EE_TightMu_nVtx";
00505   
00506   Numerator_pfIso_nvtx   = theDbe->get(numpath_pfIso_nvtx);
00507   Denominator_pfIso_nvtx = theDbe->get(denpath_pfIso_nvtx);
00508   
00509   if (Numerator_pfIso_nvtx && Denominator_pfIso_nvtx){
00510  
00511     TH1F *h_numerator_pfIso_nvtx   = Numerator_pfIso_nvtx->getTH1F();
00512     TH1F *h_denominator_pfIso_nvtx = Denominator_pfIso_nvtx->getTH1F();
00513 
00514     TH1F *h_eff_pfIso_nvtx = h_eff_vtx_EE_pfIsoTightMu->getTH1F();
00515     
00516     if (h_eff_pfIso_nvtx->GetSumw2N() == 0) h_eff_pfIso_nvtx->Sumw2();  
00517     
00518     h_eff_pfIso_nvtx->Divide(h_numerator_pfIso_nvtx, h_denominator_pfIso_nvtx, 1., 1., "B");
00519 
00520   }
00521 
00522 
00523 
00524 
00525 
00526 }
00527 
00528 
00529 void EfficiencyPlotter::endJob(){
00530   LogTrace(metname)<< "[EfficiencyPlotter] endJob called!";
00531   theDbe->rmdir("Muons/EfficiencyAnalyzer");
00532 }
00533