QBruteForceTrendFinder.hh

Go to the documentation of this file.
00001 #ifndef _Q_BRUTE_FORCE_TREND_FINDER_HH_
00002 #define _Q_BRUTE_FORCE_TREND_FINDER_HH_
00003 
00016 #include <map>
00017 #include <string>
00018 #include <vector>
00019 
00020 class QBruteForceTrendFinder {
00021 
00022 public:
00023     class Line {
00024     public:
00025         double intercept;
00026         double slope;
00027     };
00028     
00029     QBruteForceTrendFinder();
00030     
00031     virtual ~QBruteForceTrendFinder();
00032     
00033     void FindTrends(int minPointsInInterval = 3);
00034     
00035     const std::vector<Line>& GetBestFitLines()
00036     {
00037         return fBestFitLines;
00038     }
00039     
00040     const std::vector<double>& GetBreakTimes()
00041     {
00042         return fBreakTimes;
00043     }
00044     
00045     void RemoveOutliers(const double nMAD = 5.0 * 1.4826);
00046     
00047     void SetMinProbability(const double minProbability)
00048     {
00049         fMinProbability = minProbability;
00050     }
00051     
00052     void SetPoint(const double time,
00053                   const double baseline,
00054                   const double amplitude);
00055     
00056 protected:
00057     double GetDeviation(const int start, const int stop);
00058     double GetDeviation(const int start, const int stop,
00059                         double& intercept, double& slope);
00060     double GetDeviation(const std::vector<int>& breakPoints);
00061     bool Next(std::vector<int>& breakPoints, int minPointsInInterval,
00062               int numPoints);
00063 
00064     class Point {
00065     public:
00066         double time;
00067         double baseline;
00068         double amplitude;
00069         
00070         bool operator<(const Point& other) const
00071         {
00072             return time < other.time;
00073         }
00074     };
00075     
00076     double* fAmplitudes;
00077     double* fBaselines;
00078     std::vector<Line> fBestFitLines;
00079     std::vector<double> fBreakTimes;
00080     std::map< int, std::map<int, double> > fDeviationCache;
00081     double fMinProbability;
00082     std::vector<Point> fPoints;
00083     
00084 };
00085 
00086 #endif

Generated on Fri Mar 6 13:40:39 2009 for CUORE Software by  doxygen 1.5.1