CMS 3D CMS Logo

ConeTools.h
Go to the documentation of this file.
1 #ifndef RecoTauTag_RecoTau_ConeTools_h
2 #define RecoTauTag_RecoTau_ConeTools_h
3 
5 #include <boost/iterator/filter_iterator.hpp>
9 
10 namespace reco::tau::cone {
11 
12  // Predicate class that tests if a candidate lies within some deltaR (min,
13  // max) about a supplied axis
14  template <class CandType>
15  class DeltaRFilter {
16  public:
17  DeltaRFilter(const reco::Candidate::LorentzVector& axis, double min, double max)
18  : eta_(axis.eta()), phi_(axis.phi()), min2_(min < 0. ? -min * min : min * min), max2_(max * max) {}
19  bool operator()(const CandType& b) const {
20  double dR2 = deltaR2(b.eta(), b.phi(), eta_, phi_);
21  return (dR2 >= min2_ && dR2 < max2_);
22  }
23 
24  private:
25  double eta_;
26  double phi_;
27  const double min2_;
28  const double max2_;
29  };
30 
31  // Wrapper around DeltaRFilter to support reference types like Ptr<>
32  template <class CandType>
34  public:
35  DeltaRPtrFilter(const reco::Candidate::LorentzVector& axis, double min, double max) : filter_(axis, min, max) {}
36  bool operator()(const CandType& b) const { return filter_(*b); }
37 
38  private:
40  };
41 
42  /* Define our filters */
44  typedef boost::filter_iterator<PFCandPtrDRFilter, std::vector<PFCandidatePtr>::const_iterator> PFCandPtrDRFilterIter;
45 
47  typedef boost::filter_iterator<CandPtrDRFilter, std::vector<CandidatePtr>::const_iterator> CandPtrDRFilterIter;
48 
50  typedef boost::filter_iterator<ChargedHadronDRFilter, std::vector<PFRecoTauChargedHadron>::const_iterator>
52 
54  typedef boost::filter_iterator<PiZeroDRFilter, std::vector<RecoTauPiZero>::const_iterator> PiZeroDRFilterIter;
55 
56 } // end namespace reco::tau::cone
57 
58 #endif
reco::tau::cone::DeltaRPtrFilter::DeltaRPtrFilter
DeltaRPtrFilter(const reco::Candidate::LorentzVector &axis, double min, double max)
Definition: ConeTools.h:35
reco::tau::cone::DeltaRPtrFilter::operator()
bool operator()(const CandType &b) const
Definition: ConeTools.h:36
reco::tau::cone::ChargedHadronDRFilter
DeltaRFilter< PFRecoTauChargedHadron > ChargedHadronDRFilter
Definition: ConeTools.h:49
min
T min(T a, T b)
Definition: MathUtil.h:58
reco::tau::cone::DeltaRPtrFilter::filter_
DeltaRFilter< typename CandType::value_type > filter_
Definition: ConeTools.h:39
RecoTauPiZero.h
PVValHelper::eta
Definition: PVValidationHelpers.h:70
reco::tau::cone::DeltaRFilter::DeltaRFilter
DeltaRFilter(const reco::Candidate::LorentzVector &axis, double min, double max)
Definition: ConeTools.h:17
reco::tau::cone::DeltaRFilter::max2_
const double max2_
Definition: ConeTools.h:28
b
double b
Definition: hdecay.h:118
reco::tau::cone
Definition: ConeTools.h:10
reco::tau::cone::CandPtrDRFilterIter
boost::filter_iterator< CandPtrDRFilter, std::vector< CandidatePtr >::const_iterator > CandPtrDRFilterIter
Definition: ConeTools.h:47
reco::tau::cone::PiZeroDRFilterIter
boost::filter_iterator< PiZeroDRFilter, std::vector< RecoTauPiZero >::const_iterator > PiZeroDRFilterIter
Definition: ConeTools.h:54
reco::tau::cone::DeltaRPtrFilter
Definition: ConeTools.h:33
deltaR.h
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
reco::deltaR2
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:16
reco::tau::cone::DeltaRFilter
Definition: ConeTools.h:15
reco::tau::cone::PFCandPtrDRFilterIter
boost::filter_iterator< PFCandPtrDRFilter, std::vector< PFCandidatePtr >::const_iterator > PFCandPtrDRFilterIter
Definition: ConeTools.h:44
reco::tau::cone::DeltaRFilter::eta_
double eta_
Definition: ConeTools.h:25
reco::tau::cone::CandPtrDRFilter
DeltaRPtrFilter< CandidatePtr > CandPtrDRFilter
Definition: ConeTools.h:46
reco::tau::cone::DeltaRFilter::phi_
double phi_
Definition: ConeTools.h:26
reco::tau::cone::DeltaRFilter::min2_
const double min2_
Definition: ConeTools.h:27
PFTau.h
PFRecoTauChargedHadron.h
reco::tau::cone::PiZeroDRFilter
DeltaRFilter< RecoTauPiZero > PiZeroDRFilter
Definition: ConeTools.h:53
reco::tau::cone::PFCandPtrDRFilter
DeltaRPtrFilter< PFCandidatePtr > PFCandPtrDRFilter
Definition: ConeTools.h:43
reco::Candidate::LorentzVector
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:36
reco::tau::cone::DeltaRFilter::operator()
bool operator()(const CandType &b) const
Definition: ConeTools.h:19
pfCandidateDQMConfig_cfi.CandType
CandType
Definition: pfCandidateDQMConfig_cfi.py:11
reco::tau::cone::ChargedHadronDRFilterIter
boost::filter_iterator< ChargedHadronDRFilter, std::vector< PFRecoTauChargedHadron >::const_iterator > ChargedHadronDRFilterIter
Definition: ConeTools.h:51