Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:25:26

0001 #ifndef RECOMET_METALGORITHMS_SIGNALGORESOLUTIONS_H
0002 #define RECOMET_METALGORITHMS_SIGNALGORESOLUTIONS_H
0003 
0004 // -*- C++ -*-
0005 //
0006 // Package:    METAlgorithms
0007 // Class:      SignAlgoResolutions
0008 //
0009 /**\class METSignificance SignAlgoResolutions.h RecoMET/METAlgorithms/include/SignAlgoResolutions.h
0010 
0011  Description: <one line class summary>
0012 
0013  Implementation:
0014      <Notes on implementation>
0015 */
0016 //
0017 // Original Author:  Kyle Story, Freya Blekman (Cornell University)
0018 //         Created:  Fri Apr 18 11:58:33 CEST 2008
0019 //
0020 //
0021 
0022 #include "DataFormats/Math/interface/LorentzVector.h"
0023 #include "FWCore/Framework/interface/Event.h"
0024 #include "DataFormats/Common/interface/Handle.h"
0025 #include "FWCore/Framework/interface/EventSetup.h"
0026 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0027 #include "DataFormats/METReco/interface/SigInputObj.h"
0028 #include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h"
0029 #include "DataFormats/Candidate/interface/Candidate.h"
0030 #include "DataFormats/JetReco/interface/PFJet.h"
0031 #include "CondFormats/JetMETObjects/interface/JetResolution.h"
0032 #include "RecoParticleFlow/PFClusterTools/interface/PFEnergyResolution.h"
0033 
0034 #include <map>
0035 #include <iostream>
0036 #include <vector>
0037 
0038 namespace metsig {
0039 
0040   enum resolutionType {
0041     caloEE,
0042     caloEB,
0043     caloHE,
0044     caloHO,
0045     caloHF,
0046     caloHB,
0047     jet,
0048     electron,
0049     tau,
0050     muon,
0051     PFtype1,
0052     PFtype2,
0053     PFtype3,
0054     PFtype4,
0055     PFtype5,
0056     PFtype6,
0057     PFtype7
0058   };
0059   enum resolutionFunc { ET, PHI, TRACKP, CONSTPHI };
0060 
0061   class SignAlgoResolutions {
0062   public:
0063     SignAlgoResolutions() : functionmap_() { ; }
0064     SignAlgoResolutions(const edm::ParameterSet &iConfig);
0065 
0066     void addResolutions(const edm::ParameterSet &iConfig);
0067     double eval(const resolutionType &type,
0068                 const resolutionFunc &func,
0069                 const double &et,
0070                 const double &phi,
0071                 const double &eta,
0072                 const double &p) const;  // for example getvalue(caloHF,ET,et,phi,eta,p);
0073     double eval(const resolutionType &type,
0074                 const resolutionFunc &func,
0075                 const double &et,
0076                 const double &phi,
0077                 const double &eta) const;  // for example getvalue(caloHF,ET,et,phi,eta,p);
0078     metsig::SigInputObj evalPF(const reco::PFCandidate *candidate) const;
0079     metsig::SigInputObj evalPFJet(const reco::Jet *jet) const;
0080     bool isFilled() const { return !functionmap_.empty(); }
0081 
0082   private:
0083     double getfunc(const resolutionType &type, const resolutionFunc &func, std::vector<double> &x) const;
0084     void addfunction(const resolutionType type, const resolutionFunc func, const std::vector<double> &parameters);
0085     void initializeJetResolutions(const edm::ParameterSet &iConfig);
0086 
0087     typedef std::pair<metsig::resolutionType, metsig::resolutionFunc> functionCombo;
0088     typedef std::vector<double> functionPars;
0089     std::map<functionCombo, functionPars> functionmap_;
0090 
0091     double EtFunction(const functionPars &x, const functionPars &par) const;
0092     double PhiFunction(const functionPars &x, const functionPars &par) const;
0093     double PFunction(const functionPars &x, const functionPars &par) const;
0094     double PhiConstFunction(const functionPars &x, const functionPars &par) const;
0095     double ElectronPtResolution(const reco::PFCandidate *c) const;
0096 
0097     double ptResolThreshold_;
0098     //temporary fix for low pT jet resolutions
0099     //First index, eta bins, from 0 to 5;
0100     //Second index, pt bins, from 3 to 23 GeV;
0101     std::vector<double> jdpt[10];
0102     std::vector<double> jdphi[10];
0103 
0104     JetResolution *ptResol_;
0105     JetResolution *phiResol_;
0106     PFEnergyResolution *pfresol_;
0107   };
0108 }  // namespace metsig
0109 #endif