CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_8_patch3/src/RecoMET/METAlgorithms/interface/SignAlgoResolutions.h

Go to the documentation of this file.
00001 #ifndef RECOMET_METALGORITHMS_SIGNALGORESOLUTIONS_H
00002 #define RECOMET_METALGORITHMS_SIGNALGORESOLUTIONS_H
00003 
00004 // -*- C++ -*-
00005 //
00006 // Package:    METAlgorithms
00007 // Class:      SignAlgoResolutions
00008 // 
00016 //
00017 // Original Author:  Kyle Story, Freya Blekman (Cornell University)
00018 //         Created:  Fri Apr 18 11:58:33 CEST 2008
00019 // $Id: SignAlgoResolutions.h,v 1.5 2011/08/15 12:31:49 akhukhun Exp $
00020 //
00021 //
00022 
00023 #include "DataFormats/Math/interface/LorentzVector.h"
00024 #include "FWCore/Framework/interface/Event.h"
00025 #include "DataFormats/Common/interface/Handle.h"
00026 #include "FWCore/Framework/interface/EventSetup.h"
00027 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00028 #include "RecoMET/METAlgorithms/interface/SigInputObj.h"
00029 #include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h"
00030 #include "DataFormats/Candidate/interface/Candidate.h"
00031 #include "DataFormats/JetReco/interface/PFJet.h"
00032 #include "CondFormats/JetMETObjects/interface/JetResolution.h"
00033 #include "RecoParticleFlow/PFClusterTools/interface/PFEnergyResolution.h"
00034 
00035 #include <map>
00036 #include <iostream>
00037 #include <vector>
00038 
00039 namespace metsig {
00040 
00041   enum resolutionType { caloEE, caloEB, caloHE, caloHO, caloHF, caloHB, jet, electron, tau, muon,PFtype1,PFtype2, PFtype3, PFtype4, PFtype5, PFtype6, PFtype7 };
00042   enum resolutionFunc { ET, PHI,TRACKP,CONSTPHI };
00043 
00044   class SignAlgoResolutions{
00045     
00046   public:
00047     SignAlgoResolutions():functionmap_(){;}
00048     SignAlgoResolutions(const edm::ParameterSet &iConfig);
00049 
00050     void addResolutions(const edm::ParameterSet &iConfig);
00051     double eval(const resolutionType & type, const resolutionFunc & func, const double & et, const double & phi, const double & eta, const double &p) const; // for example getvalue(caloHF,ET,et,phi,eta,p);
00052     double eval(const resolutionType & type, const resolutionFunc & func, const double & et, const double & phi, const double & eta) const; // for example getvalue(caloHF,ET,et,phi,eta,p);
00053     metsig::SigInputObj evalPF(const reco::PFCandidate* candidate) const;
00054     metsig::SigInputObj evalPFJet(const reco::PFJet *jet) const;
00055     bool isFilled() const {return functionmap_.size()>0;}
00056     
00057   private:
00058     double getfunc(const resolutionType & type,const resolutionFunc & func,  std::vector<double> & x) const;
00059     void addfunction(const resolutionType type, const resolutionFunc func, std::vector<double> parameters);
00060     void initializeJetResolutions( const edm::ParameterSet &iConfig );
00061     
00062     typedef std::pair<metsig::resolutionType, metsig::resolutionFunc> functionCombo;
00063     typedef std::vector<double> functionPars;
00064     std::map<functionCombo,functionPars> functionmap_;
00065  
00066     double EtFunction( const functionPars &x,  const functionPars &  par) const;
00067     double PhiFunction( const functionPars &x,  const functionPars & par) const;
00068     double PFunction( const functionPars &x, const functionPars &par) const;
00069     double PhiConstFunction(const functionPars &x, const functionPars &par) const;
00070     double ElectronPtResolution(const reco::PFCandidate *c) const;
00071 
00072     double ptResolThreshold_;
00073     //temporary fix for low pT jet resolutions
00074     //First index, eta bins, from 0 to 5;
00075     //Second index, pt bins, from 3 to 23 GeV;
00076     std::vector<double> jdpt[10];
00077     std::vector<double> jdphi[10];
00078      
00079     JetResolution *ptResol_;
00080     JetResolution *phiResol_;
00081     PFEnergyResolution *pfresol_;
00082   };
00083 }
00084 #endif