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 
29 
30 #include <functional>
31 
32 namespace reco {
33  namespace tau {
34 
36  public:
37  // Quality cut types
39  typedef std::vector<TrackQCutFunc> TrackQCutFuncCollection;
41  typedef std::vector<CandQCutFunc> CandQCutFuncCollection;
42  typedef std::map<int, CandQCutFuncCollection> CandQCutFuncMap;
43 
44  explicit RecoTauQualityCuts(const edm::ParameterSet& qcuts);
45 
47  void setPV(const reco::VertexRef& vtx) { pv_ = vtx; }
48 
50  void setLeadTrack(const reco::Track& leadTrack);
52 
56 
58  bool filterTrack(const reco::TrackBaseRef& track) const;
59  bool filterTrack(const reco::TrackRef& track) const;
60  bool filterTrack(const reco::Track& track) const;
62  bool filterChargedCand(const reco::Candidate& cand) const;
63 
65  template <typename Coll>
66  Coll filterTracks(const Coll& coll, bool invert = false) const {
67  Coll output;
68  for (auto const& track : coll) {
69  if (filterTrack(track) ^ invert)
70  output.push_back(track);
71  }
72  return output;
73  }
74 
76  bool filterCand(const reco::Candidate& cand) const;
77 
79  template <typename CandRefType>
80  bool filterCandRef(const CandRefType& cand) const {
81  return filterCand(*cand);
82  }
83 
85  template <typename Coll>
86  Coll filterCandRefs(const Coll& refcoll, bool invert = false) const {
87  Coll output;
88  for (auto const& cand : refcoll) {
89  if (filterCandRef(cand) ^ invert)
90  output.push_back(cand);
91  }
92  return output;
93  }
94 
96  static void fillDescriptions(edm::ParameterSetDescription& descriptions);
97 
98  private:
99  bool filterTrack_(const reco::Track* track) const;
100  bool filterGammaCand(const reco::Candidate& cand) const;
101  bool filterNeutralHadronCand(const reco::Candidate& cand) const;
102  bool filterCandByType(const reco::Candidate& cand) const;
103 
104  // The current primary vertex
106  // The current lead track references
108 
109  double minTrackPt_;
114  double maxDeltaZ_;
117  double minGammaEt_;
120  bool checkPV_;
121  };
122 
123  // Split an input set of quality cuts into those that need to be inverted
124  // to select PU (the first member) and those that are general quality cuts.
125  std::pair<edm::ParameterSet, edm::ParameterSet> factorizePUQCuts(const edm::ParameterSet& inputSet);
126 
127  } // namespace tau
128 } // namespace reco
129 
130 #endif
reco::tau::RecoTauQualityCuts::filterNeutralHadronCand
bool filterNeutralHadronCand(const reco::Candidate &cand) const
Definition: RecoTauQualityCuts.cc:287
electrons_cff.bool
bool
Definition: electrons_cff.py:393
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11713
reco::tau::RecoTauQualityCuts::maxDeltaZToLeadTrack_
double maxDeltaZToLeadTrack_
Definition: RecoTauQualityCuts.h:115
reco::tau::RecoTauQualityCuts::filterCandRef
bool filterCandRef(const CandRefType &cand) const
Filter a Candidate held by a smart pointer or Ref.
Definition: RecoTauQualityCuts.h:80
reco::tau::RecoTauQualityCuts
Definition: RecoTauQualityCuts.h:35
metsig::tau
Definition: SignAlgoResolutions.h:49
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:72
reco::tau::RecoTauQualityCuts::filterTrack_
bool filterTrack_(const reco::Track *track) const
Definition: RecoTauQualityCuts.cc:200
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
reco::tau::RecoTauQualityCuts::checkPV_
bool checkPV_
Definition: RecoTauQualityCuts.h:120
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:41
reco::tau::RecoTauQualityCuts::maxTrackChi2_
double maxTrackChi2_
Definition: RecoTauQualityCuts.h:110
reco::tau::RecoTauQualityCuts::maxDeltaZ_
double maxDeltaZ_
Definition: RecoTauQualityCuts.h:114
edm::Ref< VertexCollection >
reco::tau::RecoTauQualityCuts::filterCand
bool filterCand(const reco::Candidate &cand) const
Filter a single Candidate.
Definition: RecoTauQualityCuts.cc:312
CandidateFwd.h
reco::tau::RecoTauQualityCuts::leadTrack_
const reco::Track * leadTrack_
Definition: RecoTauQualityCuts.h:107
reco::tau::RecoTauQualityCuts::TrackQCutFuncCollection
std::vector< TrackQCutFunc > TrackQCutFuncCollection
Definition: RecoTauQualityCuts.h:39
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:111
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:66
reco::tau::RecoTauQualityCuts::setPV
void setPV(const reco::VertexRef &vtx)
Update the primary vertex.
Definition: RecoTauQualityCuts.h:47
ParameterSetDescription.h
reco::tau::RecoTauQualityCuts::minTrackHits_
int minTrackHits_
Definition: RecoTauQualityCuts.h:112
reco::tau::RecoTauQualityCuts::CandQCutFunc
std::function< bool(const Candidate &)> CandQCutFunc
Definition: RecoTauQualityCuts.h:40
reco::tau::RecoTauQualityCuts::filterChargedCand
bool filterChargedCand(const reco::Candidate &cand) const
or a single charged candidate
Definition: RecoTauQualityCuts.cc:237
reco::tau::RecoTauQualityCuts::TrackQCutFunc
std::function< bool(const TrackBaseRef &)> TrackQCutFunc
Definition: RecoTauQualityCuts.h:38
reco::tau::RecoTauQualityCuts::filterCandRefs
Coll filterCandRefs(const Coll &refcoll, bool invert=false) const
Filter a ref vector of Candidates.
Definition: RecoTauQualityCuts.h:86
edm::ParameterSet
Definition: ParameterSet.h:47
reco::tau::RecoTauQualityCuts::checkHitPattern_
bool checkHitPattern_
Definition: RecoTauQualityCuts.h:119
cand
Definition: decayParser.h:32
reco::tau::RecoTauQualityCuts::fillDescriptions
static void fillDescriptions(edm::ParameterSetDescription &descriptions)
Declare all parameters read from python config file.
Definition: RecoTauQualityCuts.cc:346
reco::tau::RecoTauQualityCuts::filterTrack
bool filterTrack(const reco::TrackBaseRef &track) const
Filter a single Track.
Definition: RecoTauQualityCuts.cc:182
reco::tau::factorizePUQCuts
std::pair< edm::ParameterSet, edm::ParameterSet > factorizePUQCuts(const edm::ParameterSet &inputSet)
Definition: RecoTauQualityCuts.cc:167
reco::tau::RecoTauQualityCuts::maxTransverseImpactParameter_
double maxTransverseImpactParameter_
Definition: RecoTauQualityCuts.h:113
reco::Candidate
Definition: Candidate.h:27
VertexFwd.h
reco::tau::RecoTauQualityCuts::minGammaEt_
double minGammaEt_
Definition: RecoTauQualityCuts.h:117
reco::tau::RecoTauQualityCuts::minTrackPt_
double minTrackPt_
Definition: RecoTauQualityCuts.h:109
reco::tau::RecoTauQualityCuts::RecoTauQualityCuts
RecoTauQualityCuts(const edm::ParameterSet &qcuts)
Definition: RecoTauQualityCuts.cc:79
extraflags_cff.vtx
vtx
Definition: extraflags_cff.py:18
l1tstage2_dqm_sourceclient-live_cfg.invert
invert
Definition: l1tstage2_dqm_sourceclient-live_cfg.py:85
reco::tau::RecoTauQualityCuts::setLeadTrack
void setLeadTrack(const reco::Track &leadTrack)
Update the leading track.
Definition: RecoTauQualityCuts.cc:333
reco::tau::RecoTauQualityCuts::filterGammaCand
bool filterGammaCand(const reco::Candidate &cand) const
Definition: RecoTauQualityCuts.cc:281
HiBiasedCentrality_cfi.function
function
Definition: HiBiasedCentrality_cfi.py:4
edm::RefToBase< reco::Track >
reco::tau::RecoTauQualityCuts::pv_
reco::VertexRef pv_
Definition: RecoTauQualityCuts.h:105
Candidate.h
ParameterSet.h
reco::tau::RecoTauQualityCuts::filterCandByType
bool filterCandByType(const reco::Candidate &cand) const
Definition: RecoTauQualityCuts.cc:293
reco::tau::RecoTauQualityCuts::CandQCutFuncMap
std::map< int, CandQCutFuncCollection > CandQCutFuncMap
Definition: RecoTauQualityCuts.h:42
reco::tau::RecoTauQualityCuts::minNeutralHadronEt_
double minNeutralHadronEt_
Definition: RecoTauQualityCuts.h:118
reco::tau::RecoTauQualityCuts::minTrackVertexWeight_
double minTrackVertexWeight_
Definition: RecoTauQualityCuts.h:116