00001 #ifndef ANP_FITPOINT_H
00002 #define ANP_FITPOINT_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include <iostream>
00013 #include <map>
00014
00015
00016 #include "Rtypes.h"
00017
00018 namespace Anp
00019 {
00020 class FitPoint
00021 {
00022 public:
00023
00024 FitPoint();
00025 FitPoint(int index, double x, double y);
00026 ~FitPoint();
00027
00028 int Index() const;
00029
00030 double X() const;
00031 double Y() const;
00032
00033 double FitY() const;
00034 double FitY(double x) const;
00035
00036 bool Pass() const;
00037
00038 short Degree() const;
00039
00040 double A() const;
00041 double B() const;
00042 double C() const;
00043
00044 double Weight() const;
00045
00046 double Residual() const;
00047 double Derivative(double x) const;
00048
00049 void Print(std::ostream &os = std::cout) const;
00050
00051 private:
00052
00053 friend class LocalFit;
00054
00055 void SetWeight(double weight);
00056 bool SetWeight(unsigned int position, double weight);
00057
00058 void SetL(double a, double b, bool pass);
00059 void SetQ(double a, double b, double c, bool pass);
00060
00061 const std::map<unsigned int, double>& GetWeightMap() const;
00062
00063 private:
00064
00065 Int_t fIndex;
00066
00067 Double_t fX;
00068 Double_t fY;
00069
00070 Double_t fA;
00071 Double_t fB;
00072 Double_t fC;
00073
00074 Bool_t fPass;
00075
00076 Short_t fDegree;
00077
00078 Double_t fWeight;
00079
00080 std::map<unsigned int, double> fMap;
00081 };
00082
00083
00084 bool operator==(const FitPoint &lhs, const FitPoint &rhs);
00085 bool operator <(const FitPoint &lhs, const FitPoint &rhs);
00086 bool operator <(double value, const FitPoint &fit);
00087 bool operator <(const FitPoint &rhs, double value);
00088
00089 bool operator==(int index, const FitPoint &fit);
00090 bool operator==(const FitPoint &fit, int index);
00091
00092
00093
00094
00095 inline const std::map<unsigned int, double>& FitPoint::GetWeightMap() const
00096 {
00097 return fMap;
00098 }
00099 inline int FitPoint::Index() const
00100 {
00101 return fIndex;
00102 }
00103 inline double FitPoint::X() const
00104 {
00105 return fX;
00106 }
00107 inline double FitPoint::Y() const
00108 {
00109 return fY;
00110 }
00111 inline bool FitPoint::Pass() const
00112 {
00113 return fPass;
00114 }
00115 inline short FitPoint::Degree() const
00116 {
00117 return fDegree;
00118 }
00119 inline double FitPoint::A() const
00120 {
00121 return fA;
00122 }
00123 inline double FitPoint::B() const
00124 {
00125 return fB;
00126 }
00127 inline double FitPoint::C() const
00128 {
00129 return fC;
00130 }
00131 inline double FitPoint::Weight() const
00132 {
00133 return fWeight;
00134 }
00135 }
00136
00137 #endif