Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef RecoMET_METPUSubtraction_PFMETProducerMVA_h
0002 #define RecoMET_METPUSubtraction_PFMETProducerMVA_h
0003 
0004 /** \class PFMETProducerMVA
0005  *
0006  * Produce PFMET objects computed by MVA 
0007  *
0008  * \authors Phil Harris, CERN
0009  *          Christian Veelken, LLR
0010  *
0011  */
0012 
0013 #include "FWCore/Framework/interface/Frameworkfwd.h"
0014 #include "FWCore/Framework/interface/stream/EDProducer.h"
0015 #include "FWCore/Framework/interface/Event.h"
0016 #include "FWCore/Framework/interface/EventSetup.h"
0017 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0018 
0019 #include "DataFormats/Candidate/interface/Candidate.h"
0020 #include "DataFormats/Candidate/interface/CandidateFwd.h"
0021 #include "DataFormats/JetReco/interface/PFJet.h"
0022 #include "DataFormats/JetReco/interface/PFJetCollection.h"
0023 #include "DataFormats/Math/interface/deltaR.h"
0024 #include "DataFormats/METReco/interface/CommonMETData.h"
0025 #include "DataFormats/METReco/interface/PFMET.h"
0026 #include "DataFormats/METReco/interface/PFMETCollection.h"
0027 #include "DataFormats/MuonReco/interface/Muon.h"
0028 #include "DataFormats/PatCandidates/interface/PackedCandidate.h"
0029 #include "DataFormats/PatCandidates/interface/Tau.h"
0030 #include "DataFormats/VertexReco/interface/Vertex.h"
0031 
0032 #include "JetMETCorrections/JetCorrector/interface/JetCorrector.h"
0033 
0034 #include "RecoMET/METAlgorithms/interface/METAlgo.h"
0035 #include "RecoMET/METAlgorithms/interface/PFSpecificAlgo.h"
0036 #include "RecoMET/METPUSubtraction/interface/PFMETAlgorithmMVA.h"
0037 #include "RecoMET/METPUSubtraction/interface/MvaMEtUtilities.h"
0038 
0039 #include "RecoJets/JetProducers/interface/PileupJetIdAlgo.h"
0040 #include <TLorentzVector.h>
0041 
0042 namespace reco {
0043   class PFMETProducerMVA : public edm::stream::EDProducer<> {
0044   public:
0045     PFMETProducerMVA(const edm::ParameterSet&);
0046     ~PFMETProducerMVA() override;
0047 
0048   private:
0049     void produce(edm::Event&, const edm::EventSetup&) override;
0050 
0051     // auxiliary functions
0052     std::vector<reco::PUSubMETCandInfo> computeLeptonInfo(
0053         const std::vector<edm::EDGetTokenT<reco::CandidateView> >& srcLeptons_,
0054         const reco::CandidateView& pfCandidates,
0055         const reco::Vertex* hardScatterVertex,
0056         int& lId,
0057         bool& lHasPhotons,
0058         edm::Event& iEvent);
0059 
0060     std::vector<reco::PUSubMETCandInfo> computeJetInfo(const reco::PFJetCollection&,
0061                                                        const edm::Handle<reco::PFJetCollection>&,
0062                                                        const edm::ValueMap<float>&,
0063                                                        const reco::VertexCollection&,
0064                                                        const reco::Vertex*,
0065                                                        const reco::JetCorrector& iCorr,
0066                                                        edm::Event& iEvent,
0067                                                        const edm::EventSetup& iSetup,
0068                                                        std::vector<reco::PUSubMETCandInfo>& iLeptons,
0069                                                        std::vector<reco::PUSubMETCandInfo>& iCands);
0070 
0071     std::vector<reco::PUSubMETCandInfo> computePFCandidateInfo(const reco::CandidateView&, const reco::Vertex*);
0072     std::vector<reco::Vertex::Point> computeVertexInfo(const reco::VertexCollection&);
0073     double chargedEnFrac(const reco::Candidate* iCand,
0074                          const reco::CandidateView& pfCandidates,
0075                          const reco::Vertex* hardScatterVertex);
0076 
0077     bool passPFLooseId(const reco::PFJet* iJet);
0078     bool istau(const reco::Candidate* iCand);
0079     double chargedFracInCone(const reco::Candidate* iCand,
0080                              const reco::CandidateView& pfCandidates,
0081                              const reco::Vertex* hardScatterVertex,
0082                              double iDRMax = 0.2);
0083 
0084     // configuration parameter
0085     edm::EDGetTokenT<reco::PFJetCollection> srcCorrJets_;
0086     edm::EDGetTokenT<reco::PFJetCollection> srcUncorrJets_;
0087     edm::EDGetTokenT<edm::ValueMap<float> > srcJetIds_;
0088     //edm::EDGetTokenT<reco::PFCandidateCollection> srcPFCandidates_;
0089     edm::EDGetTokenT<edm::View<reco::Candidate> > srcPFCandidatesView_;
0090     edm::EDGetTokenT<reco::VertexCollection> srcVertices_;
0091     edm::EDGetTokenT<reco::JetCorrector> mJetCorrector_;
0092     typedef std::vector<edm::InputTag> vInputTag;
0093     std::vector<edm::EDGetTokenT<reco::CandidateView> > srcLeptons_;
0094     int minNumLeptons_;  // CV: option to skip MVA MET computation in case there are less than specified number of leptons in the event
0095 
0096     bool useType1_;
0097 
0098     double globalThreshold_;
0099 
0100     double minCorrJetPt_;
0101 
0102     METAlgo metAlgo_;
0103     PFSpecificAlgo pfMEtSpecificAlgo_;
0104     PFMETAlgorithmMVA mvaMEtAlgo_;
0105     bool mvaMEtAlgo_isInitialized_;
0106     // PileupJetIdAlgo mvaJetIdAlgo_;
0107 
0108     int verbosity_;
0109   };
0110 }  // namespace reco
0111 
0112 #endif