Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:01:18

0001 #ifndef RecoAlgos_RangeObjectPairSelector_h
0002 #define RecoAlgos_RangeObjectPairSelector_h
0003 /* \class RangeObjectPairSelector
0004  *
0005  * \author Luca Lista, INFN
0006  *
0007  * $Id: RangeObjectPairSelector.h,v 1.4 2007/06/18 18:33:54 llista Exp $
0008  */
0009 
0010 template <typename F>
0011 struct RangeObjectPairSelector {
0012   typedef F function;
0013   RangeObjectPairSelector(double min, double max, const F& fun) : min_(min), max_(max), fun_(fun) {}
0014   RangeObjectPairSelector(double min, double max) : min_(min), max_(max), fun_() {}
0015   template <typename T1, typename T2>
0016   bool operator()(const T1& t1, const T2& t2) const {
0017     double x = fun_(t1, t2);
0018     return (min_ <= x && x <= max_);
0019   }
0020 
0021 private:
0022   double min_, max_;
0023   F fun_;
0024 };
0025 
0026 #endif