CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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>
8 #include <functional>
9 
10 namespace reco { namespace tau { namespace 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 : public std::unary_function<CandType, bool> {
16  public:
18  double min, double max): axis_(axis), min_(min), max_(max) {}
19  bool operator()(const CandType& b) const {
20  double deltaR = reco::deltaR<reco::Candidate::LorentzVector>
21  (axis_, b.p4());
22  return(deltaR >= min_ && deltaR < max_);
23  }
24  private:
26  const double min_;
27  const double max_;
28 };
29 
30 // Wrapper around DeltaRFilter to support reference types like Ptr<>
31 template<class CandType>
32 class DeltaRPtrFilter : public std::unary_function<CandType, bool> {
33  public:
35  double min, double max): filter_(axis, min, max) {}
36  bool operator()(const CandType& b) const { return filter_(*b); }
37  private:
39 };
40 
41 /* Define our filters */
43 typedef boost::filter_iterator< PFCandPtrDRFilter,
44  std::vector<PFCandidatePtr>::const_iterator> PFCandPtrDRFilterIter;
45 
47 typedef boost::filter_iterator< PiZeroDRFilter,
48  std::vector<RecoTauPiZero>::const_iterator> PiZeroDRFilterIter;
49 
50 }}} // end namespace reco::tau::cone
51 
52 #endif
reco::Candidate::LorentzVector axis_
Definition: ConeTools.h:25
boost::filter_iterator< PiZeroDRFilter, std::vector< RecoTauPiZero >::const_iterator > PiZeroDRFilterIter
Definition: ConeTools.h:48
#define min(a, b)
Definition: mlp_lapack.h:161
double deltaR(double eta1, double phi1, double eta2, double phi2)
Definition: deltaR.h:19
bool operator()(const CandType &b) const
Definition: ConeTools.h:36
const T & max(const T &a, const T &b)
DeltaRPtrFilter(const reco::Candidate::LorentzVector &axis, double min, double max)
Definition: ConeTools.h:34
DeltaRFilter(const reco::Candidate::LorentzVector &axis, double min, double max)
Definition: ConeTools.h:17
bool operator()(const CandType &b) const
Definition: ConeTools.h:19
double b
Definition: hdecay.h:120
DeltaRFilter< RecoTauPiZero > PiZeroDRFilter
Definition: ConeTools.h:46
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:38
boost::filter_iterator< PFCandPtrDRFilter, std::vector< PFCandidatePtr >::const_iterator > PFCandPtrDRFilterIter
Definition: ConeTools.h:44
DeltaRPtrFilter< PFCandidatePtr > PFCandPtrDRFilter
Definition: ConeTools.h:42
DeltaRFilter< typename CandType::value_type > filter_
Definition: ConeTools.h:38