Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:27:02

0001 #ifndef RecoTauTag_RecoTau_RecoTauVertexAssociator_h
0002 #define RecoTauTag_RecoTau_RecoTauVertexAssociator_h
0003 
0004 /* RecoTauVertexAssociator
0005  *
0006  * Authors: Evan K. Friis, Christian Veelken, UC Davis
0007  *          Michalis Bachtis, UW Madison
0008  *
0009  * The associatedVertex member function retrieves the vertex from the event
0010  * associated to a given tau.  This class is configured using a cms.PSet.
0011  *
0012  * The required arguments are:
0013  *  o primaryVertexSrc - InputTag with the vertex collection
0014  *  o useClosestPV - Use the "closest to lead track in z" to find the vertex.
0015  *
0016  * The setEvent method must be called at least once per event.
0017  *
0018  */
0019 
0020 #include "FWCore/Framework/interface/ConsumesCollector.h"
0021 #include "FWCore/Framework/interface/EDConsumerBase.h"
0022 #include "FWCore/Utilities/interface/InputTag.h"
0023 #include "DataFormats/VertexReco/interface/VertexFwd.h"
0024 #include "DataFormats/Common/interface/Handle.h"
0025 #include "RecoTauTag/RecoTau/interface/RecoTauQualityCuts.h"
0026 
0027 #include "DataFormats/Common/interface/AssociationMap.h"
0028 #include "DataFormats/JetReco/interface/JetCollection.h"
0029 
0030 #include "CommonTools/Utils/interface/StringCutObjectSelector.h"
0031 
0032 #include "DataFormats/Provenance/interface/RunLumiEventNumber.h"
0033 
0034 #include <map>
0035 
0036 // Forward declarations
0037 namespace edm {
0038   class ParameterSet;
0039   class Event;
0040 }  // namespace edm
0041 
0042 namespace reco {
0043   class PFTau;
0044   class Jet;
0045 }  // namespace reco
0046 
0047 namespace reco {
0048   namespace tau {
0049 
0050     class RecoTauVertexAssociator {
0051     public:
0052       enum Algorithm { kHighestPtInEvent, kClosestDeltaZ, kHighestWeigtForLeadTrack, kCombined };
0053 
0054       RecoTauVertexAssociator(const edm::ParameterSet& pset, edm::ConsumesCollector&& iC);
0055       virtual ~RecoTauVertexAssociator();
0056       /// Get the primary vertex associated to a given jet.
0057       /// Returns a null Ref if no vertex is found.
0058       reco::VertexRef associatedVertex(const Jet& jet) const;
0059       /// Convenience function to get the PV associated to the jet that
0060       /// seeded this tau (useJet=true, old behaviour)
0061       /// or leaging charged hadron if set (useJet=false).
0062       reco::VertexRef associatedVertex(const PFTau& tau, bool useJet = false) const;
0063       reco::VertexRef associatedVertex(const TrackBaseRef& track) const;
0064       reco::VertexRef associatedVertex(const Track* track) const;
0065 
0066       /// Load the vertices from the event.
0067       void setEvent(const edm::Event& evt);
0068       const Track* getLeadTrack(const Jet&) const;
0069       const TrackBaseRef getLeadTrackRef(const Jet&) const;
0070       const CandidatePtr getLeadCand(const Jet&) const;
0071 
0072     private:
0073       edm::InputTag vertexTag_;
0074       bool vxTrkFiltering_;
0075       StringCutObjectSelector<reco::Vertex>* vertexSelector_;
0076       std::vector<reco::VertexRef> selectedVertices_;
0077       std::string algorithm_;
0078       Algorithm algo_;
0079       //PJ adding quality cuts
0080       RecoTauQualityCuts* qcuts_;
0081       bool recoverLeadingTrk_;
0082       enum { kLeadTrack, kLeadPFCand, kMinLeadTrackOrPFCand, kFirstTrack };
0083       int leadingTrkOrPFCandOption_;
0084       edm::EDGetTokenT<reco::VertexCollection> vxToken_;
0085       // containers for holding vertices associated to jets
0086       std::map<const reco::Jet*, reco::VertexRef>* jetToVertexAssociation_;
0087       edm::EventNumber_t lastEvent_;
0088       int verbosity_;
0089     };
0090 
0091   }  // namespace tau
0092 }  // namespace reco
0093 
0094 #endif /* end of include guard: RecoTauTag_RecoTau_RecoTauVertexAssociator_h */