Go to the documentation of this file.00001 #include <vector>
00002 #include <algorithm>
00003 struct RooAbsData;
00004
00005 class QuantileCalculator {
00006 public:
00007 enum Method { Simple, Sectioning, Jacknife };
00008
00009 QuantileCalculator();
00010 ~QuantileCalculator();
00011 QuantileCalculator(const std::vector<double> &values, const std::vector<double> &weights = std::vector<double>());
00012 QuantileCalculator(const std::vector<float> &values, const std::vector<float> &weights = std::vector<float>());
00013 QuantileCalculator(const RooAbsData &data, const char *varName, int firstEntry=0, int lastEntry=-1);
00015 void randomizePoints() ;
00016 std::pair<double,double> quantileAndError(double quantile, Method method);
00017 private:
00018 struct point {
00019 float x, w;
00020 int set;
00021 inline bool operator<(const point &other) const { return x < other.x; }
00022 };
00023 std::vector<point> points_;
00024 std::vector<double> sumw_;
00025 std::vector<float> quantiles_;
00026
00027 int guessPartitions(int size, double quantile) ;
00028 template<typename T> void import(const std::vector<T> &values, const std::vector<T> &weights) ;
00029 void partition(int m, bool doJacknife) ;
00030 void quantiles(double quantile, bool doJacknife);
00031
00032 };
00033