Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 10:45:40

0001 #ifndef RecoAlgos_RangeSelector_h
0002 #define RecoAlgos_RangeSelector_h
0003 /* \class RangeSelector
0004  *
0005  * \author Luca Lista, INFN
0006  *
0007  * $Id: RangeSelector.h,v 1.1 2009/02/24 14:40:26 llista Exp $
0008  */
0009 #include <string>
0010 
0011 template <typename T, double (T::*fun)() const>
0012 struct RangeSelector {
0013   RangeSelector(double min, double max) : min_(min), max_(max) {}
0014   bool operator()(const T& t) const {
0015     double x = (t.*fun)();
0016     return min_ <= x && x <= max_;
0017   }
0018 
0019 private:
0020   double min_, max_;
0021 };
0022 
0023 #endif