rename Interpolator to PDF, add new class TKDInterpolator and
[u/mrichter/AliRoot.git] / STAT / TKDInterpolatorBase.h
CommitLineData
a3408ed3 1#ifndef ROOT_TKDInterpolatorBase
2#define ROOT_TKDInterpolatorBase
3
4#ifndef ROOT_Rtypes
5#include "Rtypes.h"
6#endif
7
8///////////////////////////////////////////////////////////////
9//
10// Base non parametric interpolation algorithm.
11// The class implements local polynomial regression (LOWESS).
12// The user will work with daughter classes which implements
13// particular data configurations.
14//
15///////////////////////////////////////////////////////////////
16
17template <typename Value> class TVectorT;
18typedef struct TVectorT<Double_t> TVectorD;
19template <typename Value> class TMatrixT;
20typedef class TMatrixT<Double_t> TMatrixD;
21template <typename Index, typename Value> class TKDTree;
22typedef class TKDTree<Int_t, Float_t> TKDTreeIF;
23class TLinearFitter;
24class TClonesArray;
25class TKDNodeInfo;
26class TKDInterpolatorBase
27{
28public:
29 TKDInterpolatorBase(const Int_t size = 0);
30 virtual ~TKDInterpolatorBase();
31
32 Double_t Eval(const Double_t *point, Double_t &result, Double_t &error, Bool_t force = kFALSE);
33 virtual Int_t GetNodeIndex(const Float_t *p) = 0;
34 Float_t GetAlpha() const {return fAlpha;}
35 Bool_t GetCOGPoint(Int_t node, Float_t *&coord, Float_t &val, Float_t &error) const;
36 Bool_t GetInterpolationMethod() const {return fStatus&1;}
37 TKDNodeInfo* GetNodeInfo(const Int_t inode) const;
38 Int_t GetNTNodes() const {return fNTNodes;}
39 void GetStatus();
40 Bool_t GetStore() const {return fStatus&2;}
41 Bool_t GetWeights() const {return fStatus&4;}
42
43 void DrawBins(UInt_t ax1 = 0, UInt_t ax2 = 1, Float_t ax1min=-1., Float_t ax1max=1., Float_t ax2min=-1., Float_t ax2max=1.);
44 void SetAlpha(const Float_t a){if(a>0.) fAlpha = a;}
45 void SetInterpolationMethod(const Bool_t on = kTRUE);
46 void SetStore(const Bool_t on = kTRUE);
47 void SetWeights(const Bool_t on = kTRUE);
48
49protected:
50 virtual void Build(const Int_t nnodes);
51
52private:
53 TKDInterpolatorBase(const TKDInterpolatorBase &);
54 TKDInterpolatorBase& operator=(const TKDInterpolatorBase &);
55
56protected:
57 Int_t fNSize; // data dimension
58 Int_t fNTNodes; //Number of evaluation data points
59 TClonesArray *fTNodes; //interpolation nodes
60
61//private:
62 UChar_t fStatus; // status of the interpolator
63 UChar_t fLambda; // number of parameters in polynom
64 Short_t fDepth; //! depth of the KD Tree structure used
65 Float_t fAlpha; // alpha parameter
66 Float_t **fRefPoints; //! temporary storage of COG data
67 Double_t *fBuffer; //! working space [2*fLambda]
68 TKDTree<Int_t, Float_t> *fKDhelper; //! kNN finder
69 TLinearFitter *fFitter; //! linear fitter
70
71 ClassDef(TKDInterpolatorBase, 1) // data interpolator based on KD tree
72};
73
74
75#endif
76