CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch12/src/L1TriggerOffline/L1Analyzer/src/EfficiencyHistograms.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:     L1Analyzer
00004 // Class  :     EfficiencyHistograms
00005 // 
00006 // Implementation:
00007 //     <Notes on implementation>
00008 //
00009 // Original Author:  Alex Tapper
00010 //         Created:  Tue Dec  5 14:02:46 CET 2006
00011 // $Id: EfficiencyHistograms.cc,v 1.4 2007/11/19 16:45:51 tapper Exp $
00012 //
00013 
00014 #include "L1TriggerOffline/L1Analyzer/interface/EfficiencyHistograms.h"
00015 
00016 EfficiencyHistograms::EfficiencyHistograms(const std::string name, const edm::ParameterSet & cfg): 
00017   m_dirName(name),
00018   m_etNBins(cfg.getUntrackedParameter<int>("etNBins")),
00019   m_etaNBins(cfg.getUntrackedParameter<int>("etaNBins")),
00020   m_phiNBins(cfg.getUntrackedParameter<int>("phiNBins")),
00021   m_etMin(cfg.getUntrackedParameter<double>("etMin")),
00022   m_etaMin(cfg.getUntrackedParameter<double>("etaMin")),
00023   m_phiMin(cfg.getUntrackedParameter<double>("phiMin")),
00024   m_etMax(cfg.getUntrackedParameter<double>("etMax")),
00025   m_etaMax(cfg.getUntrackedParameter<double>("etaMax")),
00026   m_phiMax(cfg.getUntrackedParameter<double>("phiMax"))
00027 {
00028   
00029   edm::Service<TFileService> fs;
00030 
00031   TFileDirectory dir = fs->mkdir(m_dirName);
00032 
00033   m_EtEff  = dir.make<TH1F>("EtEff", "E_{T} Efficiency",m_etNBins,m_etMin,m_etMax); 
00034   m_EtaEff = dir.make<TH1F>("EtaEff","#eta Efficiency", m_etaNBins,m_etaMin,m_etaMax);
00035   m_PhiEff = dir.make<TH1F>("PhiEff","#phi Efficiency", m_phiNBins,m_phiMin,m_phiMax);
00036 
00037   m_L1EtEff  = dir.make<TH1F>("L1EtEff", "E_{T}",m_etNBins,m_etMin,m_etMax);    m_L1EtEff->Sumw2();
00038   m_L1EtaEff = dir.make<TH1F>("L1EtaEff","#eta", m_etaNBins,m_etaMin,m_etaMax); m_L1EtaEff->Sumw2();
00039   m_L1PhiEff = dir.make<TH1F>("L1PhiEff","#phi", m_phiNBins,m_phiMin,m_phiMax); m_L1PhiEff->Sumw2();
00040 
00041   m_RefEtEff  = dir.make<TH1F>("RefEtEff", "E_{T}",m_etNBins,m_etMin,m_etMax);    m_RefEtEff->Sumw2();
00042   m_RefEtaEff = dir.make<TH1F>("RefEtaEff","#eta", m_etaNBins,m_etaMin,m_etaMax); m_RefEtaEff->Sumw2();
00043   m_RefPhiEff = dir.make<TH1F>("RefPhiEff","#phi", m_phiNBins,m_phiMin,m_phiMax); m_RefPhiEff->Sumw2();
00044 
00045 }
00046 
00047 EfficiencyHistograms::~EfficiencyHistograms()
00048 {
00049   // Divide histograms to get efficiencies 
00050   // When supported will use Bayes method.
00051 
00052   m_EtEff->Divide(m_L1EtEff,m_RefEtEff,1.,1.,"B");
00053   m_EtaEff->Divide(m_L1EtaEff,m_RefEtaEff,1.,1.,"B");
00054   m_PhiEff->Divide(m_L1PhiEff,m_RefPhiEff,1.,1.,"B");
00055 }
00056 
00057 void EfficiencyHistograms::FillL1(const reco::CandidateRef &ref)
00058 {
00059   m_L1EtEff->Fill(ref->et());
00060   m_L1EtaEff->Fill(ref->eta());
00061   m_L1PhiEff->Fill(ref->phi());
00062 }
00063 
00064 void EfficiencyHistograms::FillReference(const reco::CandidateRef &ref)
00065 {
00066   m_RefEtEff->Fill(ref->et());
00067   m_RefEtaEff->Fill(ref->eta());
00068   m_RefPhiEff->Fill(ref->phi());
00069 }