Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2025-02-05 23:51:44

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 "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0028 #include "DataFormats/METReco/interface/SigInputObj.h"
0029 #include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h"
0030 #include "DataFormats/Candidate/interface/Candidate.h"
0031 #include "DataFormats/JetReco/interface/PFJet.h"
0032 #include "CondFormats/JetMETObjects/interface/JetResolution.h"
0033 #include "RecoParticleFlow/PFClusterTools/interface/PFEnergyResolution.h"
0034 
0035 #include <map>
0036 #include <iostream>
0037 #include <vector>
0038 
0039 namespace metsig {
0040 
0041   enum resolutionType {
0042     caloEE,
0043     caloEB,
0044     caloHE,
0045     caloHO,
0046     caloHF,
0047     caloHB,
0048     jet,
0049     electron,
0050     tau,
0051     muon,
0052     PFtype1,
0053     PFtype2,
0054     PFtype3,
0055     PFtype4,
0056     PFtype5,
0057     PFtype6,
0058     PFtype7
0059   };
0060   enum resolutionFunc { ET, PHI, TRACKP, CONSTPHI };
0061 
0062   class SignAlgoResolutions {
0063   public:
0064     SignAlgoResolutions() : functionmap_() { ; }
0065     SignAlgoResolutions(const edm::ParameterSet &iConfig);
0066 
0067     void addResolutions(const edm::ParameterSet &iConfig);
0068     double eval(const resolutionType &type,
0069                 const resolutionFunc &func,
0070                 const double &et,
0071                 const double &phi,
0072                 const double &eta,
0073                 const double &p) const;  // for example getvalue(caloHF,ET,et,phi,eta,p);
0074     double eval(const resolutionType &type,
0075                 const resolutionFunc &func,
0076                 const double &et,
0077                 const double &phi,
0078                 const double &eta) const;  // for example getvalue(caloHF,ET,et,phi,eta,p);
0079     metsig::SigInputObj evalPF(const reco::PFCandidate *candidate) const;
0080     metsig::SigInputObj evalPFJet(const reco::Jet *jet) const;
0081     bool isFilled() const { return !functionmap_.empty(); }
0082 
0083     static void fillPSetDescription(edm::ParameterSetDescription &desc);
0084 
0085   private:
0086     double getfunc(const resolutionType &type, const resolutionFunc &func, std::vector<double> &x) const;
0087     void addfunction(const resolutionType type, const resolutionFunc func, const std::vector<double> &parameters);
0088     void initializeJetResolutions(const edm::ParameterSet &iConfig);
0089 
0090     typedef std::pair<metsig::resolutionType, metsig::resolutionFunc> functionCombo;
0091     typedef std::vector<double> functionPars;
0092     std::map<functionCombo, functionPars> functionmap_;
0093 
0094     double EtFunction(const functionPars &x, const functionPars &par) const;
0095     double PhiFunction(const functionPars &x, const functionPars &par) const;
0096     double PFunction(const functionPars &x, const functionPars &par) const;
0097     double PhiConstFunction(const functionPars &x, const functionPars &par) const;
0098     double ElectronPtResolution(const reco::PFCandidate *c) const;
0099 
0100     double ptResolThreshold_;
0101     //temporary fix for low pT jet resolutions
0102     //First index, eta bins, from 0 to 5;
0103     //Second index, pt bins, from 3 to 23 GeV;
0104     std::vector<double> jdpt[10];
0105     std::vector<double> jdphi[10];
0106 
0107     JetResolution *ptResol_;
0108     JetResolution *phiResol_;
0109     PFEnergyResolution *pfresol_;
0110   };
0111 }  // namespace metsig
0112 #endif