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 Candidates 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 Candidate particle type
12  * (like hadron, gamma, etc). When a Candidate 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 {
32  namespace tau {
33 
35  public:
36  // Quality cut types
38  typedef std::vector<TrackQCutFunc> TrackQCutFuncCollection;
40  typedef std::vector<CandQCutFunc> CandQCutFuncCollection;
41  typedef std::map<int, CandQCutFuncCollection> CandQCutFuncMap;
42 
43  explicit RecoTauQualityCuts(const edm::ParameterSet& qcuts);
44 
46  void setPV(const reco::VertexRef& vtx) { pv_ = vtx; }
47 
49  void setLeadTrack(const reco::Track& leadTrack);
51 
55 
57  bool filterTrack(const reco::TrackBaseRef& track) const;
58  bool filterTrack(const reco::TrackRef& track) const;
59  bool filterTrack(const reco::Track& track) const;
61  bool filterChargedCand(const reco::Candidate& cand) const;
62 
64  template <typename Coll>
65  Coll filterTracks(const Coll& coll, bool invert = false) const {
66  Coll output;
67  for (auto const& track : coll) {
68  if (filterTrack(track) ^ invert)
69  output.push_back(track);
70  }
71  return output;
72  }
73 
75  bool filterCand(const reco::Candidate& cand) const;
76 
78  template <typename CandRefType>
79  bool filterCandRef(const CandRefType& cand) const {
80  return filterCand(*cand);
81  }
82 
84  template <typename Coll>
85  Coll filterCandRefs(const Coll& refcoll, bool invert = false) const {
86  Coll output;
87  for (auto const& cand : refcoll) {
88  if (filterCandRef(cand) ^ invert)
89  output.push_back(cand);
90  }
91  return output;
92  }
93 
94  private:
95  bool filterTrack_(const reco::Track* track) const;
96  bool filterGammaCand(const reco::Candidate& cand) const;
97  bool filterNeutralHadronCand(const reco::Candidate& cand) const;
98  bool filterCandByType(const reco::Candidate& cand) const;
99 
100  // The current primary vertex
102  // The current lead track references
104 
105  double minTrackPt_;
110  double maxDeltaZ_;
113  double minGammaEt_;
116  bool checkPV_;
117  };
118 
119  // Split an input set of quality cuts into those that need to be inverted
120  // to select PU (the first member) and those that are general quality cuts.
121  std::pair<edm::ParameterSet, edm::ParameterSet> factorizePUQCuts(const edm::ParameterSet& inputSet);
122 
123  } // namespace tau
124 } // namespace reco
125 
126 #endif
reco::tau::RecoTauQualityCuts::filterNeutralHadronCand
bool filterNeutralHadronCand(const reco::Candidate &cand) const
Definition: RecoTauQualityCuts.cc:504
electrons_cff.bool
bool
Definition: electrons_cff.py:372
reco::tau::RecoTauQualityCuts::maxDeltaZToLeadTrack_
double maxDeltaZToLeadTrack_
Definition: RecoTauQualityCuts.h:111
reco::tau::RecoTauQualityCuts::filterCandRef
bool filterCandRef(const CandRefType &cand) const
Filter a Candidate held by a smart pointer or Ref.
Definition: RecoTauQualityCuts.h:79
reco::tau::RecoTauQualityCuts
Definition: RecoTauQualityCuts.h:34
metsig::tau
Definition: SignAlgoResolutions.h:49
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:32
reco::tau::RecoTauQualityCuts::filterTrack_
bool filterTrack_(const reco::Track *track) const
Definition: RecoTauQualityCuts.cc:417
reco::tau::RecoTauQualityCuts::checkPV_
bool checkPV_
Definition: RecoTauQualityCuts.h:116
reco::tau::leadCand
InputIterator leadCand(InputIterator begin, InputIterator end)
Definition: RecoTauCommonUtilities.h:138
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
reco::tau::RecoTauQualityCuts::CandQCutFuncCollection
std::vector< CandQCutFunc > CandQCutFuncCollection
Definition: RecoTauQualityCuts.h:40
reco::tau::RecoTauQualityCuts::maxTrackChi2_
double maxTrackChi2_
Definition: RecoTauQualityCuts.h:106
reco::tau::RecoTauQualityCuts::maxDeltaZ_
double maxDeltaZ_
Definition: RecoTauQualityCuts.h:110
edm::Ref< VertexCollection >
reco::tau::RecoTauQualityCuts::filterCand
bool filterCand(const reco::Candidate &cand) const
Filter a single Candidate.
Definition: RecoTauQualityCuts.cc:529
CandidateFwd.h
reco::tau::RecoTauQualityCuts::leadTrack_
const reco::Track * leadTrack_
Definition: RecoTauQualityCuts.h:103
reco::tau::RecoTauQualityCuts::TrackQCutFuncCollection
std::vector< TrackQCutFunc > TrackQCutFuncCollection
Definition: RecoTauQualityCuts.h:38
singlePfTauSkim_cff.leadTrack
leadTrack
Definition: singlePfTauSkim_cff.py:22
Track.h
TrackFwd.h
pat::eventhypothesis::CandRefType
reco::CandidatePtr CandRefType
Definition: EventHypothesis.h:22
reco::tau::RecoTauQualityCuts::minTrackPixelHits_
int minTrackPixelHits_
Definition: RecoTauQualityCuts.h:107
reco::Track
Definition: Track.h:27
reco::tau::RecoTauQualityCuts::filterTracks
Coll filterTracks(const Coll &coll, bool invert=false) const
Filter a collection of Tracks.
Definition: RecoTauQualityCuts.h:65
reco::tau::RecoTauQualityCuts::setPV
void setPV(const reco::VertexRef &vtx)
Update the primary vertex.
Definition: RecoTauQualityCuts.h:46
reco::tau::RecoTauQualityCuts::minTrackHits_
int minTrackHits_
Definition: RecoTauQualityCuts.h:108
reco::tau::RecoTauQualityCuts::CandQCutFunc
std::function< bool(const Candidate &)> CandQCutFunc
Definition: RecoTauQualityCuts.h:39
badGlobalMuonTaggersAOD_cff.vtx
vtx
Definition: badGlobalMuonTaggersAOD_cff.py:5
reco::tau::RecoTauQualityCuts::filterChargedCand
bool filterChargedCand(const reco::Candidate &cand) const
or a single charged candidate
Definition: RecoTauQualityCuts.cc:454
reco::tau::RecoTauQualityCuts::TrackQCutFunc
std::function< bool(const TrackBaseRef &)> TrackQCutFunc
Definition: RecoTauQualityCuts.h:37
reco::tau::RecoTauQualityCuts::filterCandRefs
Coll filterCandRefs(const Coll &refcoll, bool invert=false) const
Filter a ref vector of Candidates.
Definition: RecoTauQualityCuts.h:85
edm::ParameterSet
Definition: ParameterSet.h:36
reco::tau::RecoTauQualityCuts::checkHitPattern_
bool checkHitPattern_
Definition: RecoTauQualityCuts.h:115
cand
Definition: decayParser.h:34
reco::tau::RecoTauQualityCuts::filterTrack
bool filterTrack(const reco::TrackBaseRef &track) const
Filter a single Track.
Definition: RecoTauQualityCuts.cc:399
reco::tau::factorizePUQCuts
std::pair< edm::ParameterSet, edm::ParameterSet > factorizePUQCuts(const edm::ParameterSet &inputSet)
Definition: RecoTauQualityCuts.cc:384
reco::tau::RecoTauQualityCuts::maxTransverseImpactParameter_
double maxTransverseImpactParameter_
Definition: RecoTauQualityCuts.h:109
reco::Candidate
Definition: Candidate.h:27
VertexFwd.h
reco::tau::RecoTauQualityCuts::minGammaEt_
double minGammaEt_
Definition: RecoTauQualityCuts.h:113
reco::tau::RecoTauQualityCuts::minTrackPt_
double minTrackPt_
Definition: RecoTauQualityCuts.h:105
reco::tau::RecoTauQualityCuts::RecoTauQualityCuts
RecoTauQualityCuts(const edm::ParameterSet &qcuts)
Definition: RecoTauQualityCuts.cc:296
l1tstage2_dqm_sourceclient-live_cfg.invert
invert
Definition: l1tstage2_dqm_sourceclient-live_cfg.py:79
reco::tau::RecoTauQualityCuts::setLeadTrack
void setLeadTrack(const reco::Track &leadTrack)
Update the leading track.
Definition: RecoTauQualityCuts.cc:550
reco::tau::RecoTauQualityCuts::filterGammaCand
bool filterGammaCand(const reco::Candidate &cand) const
Definition: RecoTauQualityCuts.cc:498
HiBiasedCentrality_cfi.function
function
Definition: HiBiasedCentrality_cfi.py:4
edm::RefToBase< reco::Track >
reco::tau::RecoTauQualityCuts::pv_
reco::VertexRef pv_
Definition: RecoTauQualityCuts.h:101
HLT_2018_cff.track
track
Definition: HLT_2018_cff.py:10352
Candidate.h
ParameterSet.h
reco::tau::RecoTauQualityCuts::filterCandByType
bool filterCandByType(const reco::Candidate &cand) const
Definition: RecoTauQualityCuts.cc:510
reco::tau::RecoTauQualityCuts::CandQCutFuncMap
std::map< int, CandQCutFuncCollection > CandQCutFuncMap
Definition: RecoTauQualityCuts.h:41
reco::tau::RecoTauQualityCuts::minNeutralHadronEt_
double minNeutralHadronEt_
Definition: RecoTauQualityCuts.h:114
reco::tau::RecoTauQualityCuts::minTrackVertexWeight_
double minTrackVertexWeight_
Definition: RecoTauQualityCuts.h:112