00001 #ifndef RecoAlgos_RangeSelector_h 00002 #define RecoAlgos_RangeSelector_h 00003 /* \class RangeSelector 00004 * 00005 * \author Luca Lista, INFN 00006 * 00007 * $Id: RangeSelector.h,v 1.3 2007/06/18 18:33:54 llista Exp $ 00008 */ 00009 #include <string> 00010 00011 template<typename T, double (T::*fun)() const> 00012 struct RangeSelector { 00013 RangeSelector( double min, double max ) : 00014 min_( min ), max_( max ) { } 00015 bool operator()( const T & t ) const { 00016 double x = (t.*fun)(); 00017 return min_ <= x && x <= max_; 00018 } 00019 private: 00020 double min_, max_; 00021 }; 00022 00023 #endif