RangeSelector

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
#ifndef RecoAlgos_RangeSelector_h
#define RecoAlgos_RangeSelector_h
/* \class RangeSelector
 *
 * \author Luca Lista, INFN
 *
 * $Id: RangeSelector.h,v 1.1 2009/02/24 14:40:26 llista Exp $
 */
#include <string>

template <typename T, double (T::*fun)() const>
struct RangeSelector {
  RangeSelector(double min, double max) : min_(min), max_(max) {}
  bool operator()(const T& t) const {
    double x = (t.*fun)();
    return min_ <= x && x <= max_;
  }

private:
  double min_, max_;
};

#endif