Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

Anp::FitPoint Class Reference

#include <FitPoint.h>

List of all members.

Public Member Functions

 FitPoint ()
 FitPoint (int index, double x, double y)
 ~FitPoint ()
int Index () const
double X () const
double Y () const
double FitY () const
double FitY (double x) const
bool Pass () const
short Degree () const
double A () const
double B () const
double C () const
double Weight () const
double Residual () const
double Derivative (double x) const
void Print (std::ostream &os=std::cout) const

Private Member Functions

void SetWeight (double weight)
bool SetWeight (unsigned int position, double weight)
void SetL (double a, double b, bool pass)
void SetQ (double a, double b, double c, bool pass)
const std::map< unsigned int,
double > & 
GetWeightMap () const

Private Attributes

Int_t fIndex
Double_t fX
Double_t fY
Double_t fA
Double_t fB
Double_t fC
Bool_t fPass
Short_t fDegree
Double_t fWeight
std::map< unsigned int, double > fMap

Friends

class LocalFit


Constructor & Destructor Documentation

Anp::FitPoint::FitPoint  ) 
 

Definition at line 12 of file FitPoint.cxx.

00013    :fIndex(-1),
00014     fX(0.0),
00015     fY(0.0),
00016     fA(0.0),
00017     fB(0.0),
00018     fC(0.0),
00019     fPass(false),
00020     fDegree(0),
00021     fWeight(-1.0),
00022     fMap()
00023 {
00024 }

Anp::FitPoint::FitPoint int  index,
double  x,
double  y
 

Definition at line 27 of file FitPoint.cxx.

00030    :fIndex(index),
00031     fX(x),
00032     fY(y),
00033     fA(0.0),
00034     fB(0.0),
00035     fC(0.0),
00036     fPass(false),
00037     fDegree(0),
00038     fWeight(1.0),
00039     fMap()
00040 {
00041 }

Anp::FitPoint::~FitPoint  ) 
 

Definition at line 44 of file FitPoint.cxx.

00045 {
00046 }


Member Function Documentation

double Anp::FitPoint::A  )  const [inline]
 

Definition at line 119 of file FitPoint.h.

00120    {
00121       return fA;
00122    }      

double Anp::FitPoint::B  )  const [inline]
 

Definition at line 123 of file FitPoint.h.

00124    {
00125       return fB;
00126    }

double Anp::FitPoint::C  )  const [inline]
 

Definition at line 127 of file FitPoint.h.

00128    {
00129       return fC;
00130    }

short Anp::FitPoint::Degree  )  const [inline]
 

Definition at line 115 of file FitPoint.h.

00116    {
00117       return fDegree;
00118    }

double Anp::FitPoint::Derivative double  x  )  const
 

Definition at line 153 of file FitPoint.cxx.

References fA, and fDegree.

00154 {
00155    if(!fPass)
00156    {
00157       cerr << "FitPoint::Derivative - this point failed local fit" << endl;
00158       return 0.0;
00159    }
00160 
00161    if(fDegree == 1)
00162    {
00163       return fA;
00164    }
00165    else if(fDegree == 2)
00166    {
00167       return 2.0 * fA * x + fB;
00168    }
00169 
00170    cerr << "FitPoint::Derivative - unknown degree: " << fDegree << endl;
00171 
00172    return 0.0;
00173 }

double Anp::FitPoint::FitY double  x  )  const
 

Definition at line 108 of file FitPoint.cxx.

References fA, fB, and fDegree.

00109 {
00110    if(!fPass)
00111    {
00112       return fY;
00113    }
00114 
00115    if(fDegree == 1)
00116    {
00117       return fA*x + fB;
00118    }
00119    else if(fDegree == 2)
00120    {
00121       return fA*x*x + fB*x + fC;
00122    }
00123 
00124    cerr << "FitPoint::FitY - unknown degree: " << fDegree << endl;
00125 
00126    return 0.0;
00127 }

double Anp::FitPoint::FitY  )  const
 

Definition at line 102 of file FitPoint.cxx.

References fX.

Referenced by Print().

00103 {
00104    return FitY(fX);
00105 }

const std::map< unsigned int, double > & Anp::FitPoint::GetWeightMap  )  const [inline, private]
 

Definition at line 95 of file FitPoint.h.

Referenced by Anp::LocalFit::RunLFit(), and Anp::LocalFit::RunQFit().

00096    {
00097       return fMap;
00098    }

int Anp::FitPoint::Index  )  const [inline]
 

Definition at line 99 of file FitPoint.h.

Referenced by Anp::operator==(), and Print().

00100    {
00101       return fIndex;
00102    }

bool Anp::FitPoint::Pass  )  const [inline]
 

Definition at line 111 of file FitPoint.h.

00112    {
00113       return fPass;
00114    }

void Anp::FitPoint::Print std::ostream &  os = std::cout  )  const
 

Definition at line 176 of file FitPoint.cxx.

References FitY(), Index(), Weight(), X(), and Y().

Referenced by Anp::LocalFit::GetList().

00177 {
00178    os << "FitPoint (i, x, y, best y, weight) = (" 
00179       << Index() << ", " 
00180       << X() << ", "    
00181       << Y() << ", " 
00182       << FitY() << ", " 
00183       << Weight() << ")" 
00184       << endl;
00185 }

double Anp::FitPoint::Residual  )  const
 

Definition at line 130 of file FitPoint.cxx.

References fA, fB, fDegree, fX, and fY.

00131 {
00132    if(!fPass)
00133    {
00134       cerr << "FitPoint::Residual - this point failed local fit" << endl;
00135       return 0.0;
00136    }
00137 
00138    if(fDegree == 1)
00139    {
00140       return fY - fA * fX - fB;
00141    }
00142    else if(fDegree == 2)
00143    {
00144       return fY - fA * fX * fX - fB * fX - fC;
00145    }
00146 
00147    cerr << "FitPoint::Residual - unknown degree: " << fDegree << endl;
00148 
00149    return 0.0;
00150 }

void Anp::FitPoint::SetL double  a,
double  b,
bool  pass
[private]
 

Definition at line 83 of file FitPoint.cxx.

References fA, fB, fDegree, and fPass.

Referenced by Anp::LocalFit::RunLFit().

00084 {
00085    fA = a;
00086    fB = b;
00087    fPass = pass;
00088    fDegree = 1;
00089 }

void Anp::FitPoint::SetQ double  a,
double  b,
double  c,
bool  pass
[private]
 

Definition at line 92 of file FitPoint.cxx.

References fA, fB, fC, fDegree, and fPass.

Referenced by Anp::LocalFit::RunQFit().

00093 {
00094    fA = a;
00095    fB = b;
00096    fC = c;
00097    fPass = pass;
00098    fDegree = 2;
00099 }

bool Anp::FitPoint::SetWeight unsigned int  position,
double  weight
[private]
 

Definition at line 61 of file FitPoint.cxx.

References fMap.

00062 {
00063    //
00064    // Set initial weight at position (position is index in fit vector)
00065    //
00066 
00067    if(weight < 0.0)
00068    {
00069       cerr << "FitPoint::SetWeight - negative weight at " << position << endl;
00070       return false;      
00071    }
00072 
00073    if(!fMap.insert(map<unsigned int, double>::value_type(position, weight)).second)
00074    {
00075       cerr << "FitPoint::SetWeight - failed to insert weight at " << position << endl;
00076       return false;
00077    }
00078 
00079    return true;
00080 }

void Anp::FitPoint::SetWeight double  weight  )  [private]
 

Definition at line 49 of file FitPoint.cxx.

References fWeight.

Referenced by Anp::LocalFit::RunFit().

00050 {
00051    if(weight < 0.0)
00052    {
00053       cerr << "FitPoint::SetWeight - negative global weight" << endl;
00054       return;
00055    }
00056 
00057    fWeight = weight;
00058 }

double Anp::FitPoint::Weight  )  const [inline]
 

Definition at line 131 of file FitPoint.h.

Referenced by Print(), Anp::LocalFit::RunLFit(), and Anp::LocalFit::RunQFit().

00132    {
00133       return fWeight;
00134    }

double Anp::FitPoint::X  )  const [inline]
 

Definition at line 103 of file FitPoint.h.

Referenced by Anp::LocalFit::FitY(), Anp::LocalFit::GetList(), Anp::operator<(), Print(), Anp::LocalFit::RunLFit(), and Anp::LocalFit::RunQFit().

00104    {
00105       return fX;
00106    }

double Anp::FitPoint::Y  )  const [inline]
 

Definition at line 107 of file FitPoint.h.

Referenced by Print(), Anp::LocalFit::RunLFit(), and Anp::LocalFit::RunQFit().

00108    {
00109       return fY;
00110    }


Friends And Related Function Documentation

friend class LocalFit [friend]
 

Definition at line 53 of file FitPoint.h.


Member Data Documentation

Double_t Anp::FitPoint::fA [private]
 

Definition at line 70 of file FitPoint.h.

Referenced by Derivative(), FitY(), Residual(), SetL(), and SetQ().

Double_t Anp::FitPoint::fB [private]
 

Definition at line 71 of file FitPoint.h.

Referenced by FitY(), Residual(), SetL(), and SetQ().

Double_t Anp::FitPoint::fC [private]
 

Definition at line 72 of file FitPoint.h.

Referenced by SetQ().

Short_t Anp::FitPoint::fDegree [private]
 

Definition at line 76 of file FitPoint.h.

Referenced by Derivative(), FitY(), Residual(), SetL(), and SetQ().

Int_t Anp::FitPoint::fIndex [private]
 

Definition at line 65 of file FitPoint.h.

std::map<unsigned int, double> Anp::FitPoint::fMap [private]
 

Definition at line 80 of file FitPoint.h.

Referenced by SetWeight().

Bool_t Anp::FitPoint::fPass [private]
 

Definition at line 74 of file FitPoint.h.

Referenced by SetL(), and SetQ().

Double_t Anp::FitPoint::fWeight [private]
 

Definition at line 78 of file FitPoint.h.

Referenced by SetWeight().

Double_t Anp::FitPoint::fX [private]
 

Definition at line 67 of file FitPoint.h.

Referenced by FitY(), and Residual().

Double_t Anp::FitPoint::fY [private]
 

Definition at line 68 of file FitPoint.h.

Referenced by Residual().


The documentation for this class was generated from the following files:
Generated on Mon Feb 15 11:10:32 2010 for loon by  doxygen 1.3.9.1