CMS 3D CMS Logo

RecoTauQualityCuts.h
Go to the documentation of this file.
1 #ifndef RecoTauTag_RecoTau_RecoTauQualityCuts_h
2 #define RecoTauTag_RecoTau_RecoTauQualityCuts_h
3 
4 /*
5  * RecoTauQualityCuts
6  *
7  * Author: Evan K. Friis
8  *
9  * Constructs a number of independent requirements on PFCandidates by building
10  * binary predicate functions. These are held in a number of lists of
11  * functions. Each of these lists is mapped to a PFCandidate particle type
12  * (like hadron, gamma, etc). When a PFCandidate is passed to filter(),
13  * the correct list is looked up, and the result is the AND of all the predicate
14  * functions. See the .cc files for the QCut functions.
15  *
16  * Note that for some QCuts, the primary vertex must be updated every event.
17  * Others require the lead track be defined for each tau before filter(..)
18  * is called.
19  *
20  */
21 
28 
29 #include <functional>
30 
31 namespace reco { namespace tau {
32 
34 {
35  public:
36  // Quality cut types
37  typedef std::function<bool (const TrackBaseRef&)> TrackQCutFunc;
38  typedef std::vector<TrackQCutFunc> TrackQCutFuncCollection;
39  typedef std::function<bool (const PFCandidate&)> CandQCutFunc;
40  typedef std::vector<CandQCutFunc> CandQCutFuncCollection;
41  typedef std::map<PFCandidate::ParticleType, CandQCutFuncCollection> CandQCutFuncMap;
42 
43  explicit RecoTauQualityCuts(const edm::ParameterSet& qcuts);
44 
46  void setPV(const reco::VertexRef& vtx) const { pv_ = vtx; }
47 
49  void setLeadTrack(const reco::TrackRef& leadTrack) const;
50  void setLeadTrack(const reco::PFCandidate& leadCand) const;
51 
54  void setLeadTrack(const reco::PFCandidateRef& leadCand) const;
55 
57  bool filterTrack(const reco::TrackBaseRef& track) const;
58  bool filterTrack(const reco::TrackRef& track) const;
59 
61  template<typename Coll>
62  Coll filterTracks(const Coll& coll, bool invert = false) const
63  {
64  Coll output;
65  for(auto const& track : coll ) {
66  if ( filterTrack(track)^invert ) output.push_back(track);
67  }
68  return output;
69  }
70 
72  bool filterCand(const reco::PFCandidate& cand) const;
73 
75  template<typename PFCandRefType>
76  bool filterCandRef(const PFCandRefType& cand) const { return filterCand(*cand); }
77 
79  template<typename Coll>
80  Coll filterCandRefs(const Coll& refcoll, bool invert = false) const
81  {
82  Coll output;
83  for(auto const& cand : refcoll ) {
84  if ( filterCandRef(cand)^invert ) output.push_back(cand);
85  }
86  return output;
87  }
88 
89  private:
90  template <typename T> bool filterTrack_(const T& trackRef) const;
91  bool filterGammaCand(const reco::PFCandidate& cand) const;
92  bool filterNeutralHadronCand(const reco::PFCandidate& cand) const;
93  bool filterCandByType(const reco::PFCandidate& cand) const;
94 
95  // The current primary vertex
97  // The current lead track references
99 
100  double minTrackPt_;
105  double maxDeltaZ_;
108  double minGammaEt_;
111  bool checkPV_;
112 };
113 
114 // Split an input set of quality cuts into those that need to be inverted
115 // to select PU (the first member) and those that are general quality cuts.
116 std::pair<edm::ParameterSet, edm::ParameterSet> factorizePUQCuts(const edm::ParameterSet& inputSet);
117 
118 }} // end reco::tau:: namespace
119 
120 #endif
bool filterCandByType(const reco::PFCandidate &cand) const
RecoTauQualityCuts(const edm::ParameterSet &qcuts)
Coll filterCandRefs(const Coll &refcoll, bool invert=false) const
Filter a ref vector of PFCandidates.
bool filterTrack_(const T &trackRef) const
bool filterNeutralHadronCand(const reco::PFCandidate &cand) const
std::function< bool(const TrackBaseRef &)> TrackQCutFunc
std::vector< CandQCutFunc > CandQCutFuncCollection
bool filterGammaCand(const reco::PFCandidate &cand) const
void setPV(const reco::VertexRef &vtx) const
Update the primary vertex.
std::map< PFCandidate::ParticleType, CandQCutFuncCollection > CandQCutFuncMap
std::pair< edm::ParameterSet, edm::ParameterSet > factorizePUQCuts(const edm::ParameterSet &inputSet)
std::vector< TrackQCutFunc > TrackQCutFuncCollection
JetCorrectorParametersCollection coll
Definition: classes.h:10
bool filterCandRef(const PFCandRefType &cand) const
Filter a PFCandidate held by a smart pointer or Ref.
std::function< bool(const PFCandidate &)> CandQCutFunc
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:40
fixed size matrix
void setLeadTrack(const reco::TrackRef &leadTrack) const
Update the leading track.
bool filterCand(const reco::PFCandidate &cand) const
Filter a single PFCandidate.
Coll filterTracks(const Coll &coll, bool invert=false) const
Filter a collection of Tracks.
long double T
bool filterTrack(const reco::TrackBaseRef &track) const
Filter a single Track.