]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - STAT/TKDInterpolator.h
Follow the compilation scheme of AliRoot and to fulfill the C++ effic
[u/mrichter/AliRoot.git] / STAT / TKDInterpolator.h
... / ...
CommitLineData
1#ifndef ROOT_TKDInterpolator
2#define ROOT_TKDInterpolator
3
4#ifndef ROOT_TKDTree
5#include "TKDTree.h"
6#endif
7
8class TTree;
9class TLinearFitter;
10class TKDInterpolator : public TKDTreeIF
11{
12public:
13 TKDInterpolator();
14 TKDInterpolator(TTree *t, const Char_t *var, const Char_t *cut = 0, UInt_t bsize = 100);
15 TKDInterpolator(Int_t npoints, Int_t ndim, UInt_t bsize, Float_t **data);
16 ~TKDInterpolator();
17
18 inline Bool_t GetEstimate(Int_t node, Float_t *coord, Float_t &val, Float_t &error) const ;
19 Double_t Eval(Float_t *point);
20 void DrawNodes(Int_t depth = -1, Int_t ax1 = 0, Int_t ax2 = 1);
21 void DrawNode(Int_t node, Int_t ax1 = 0, Int_t ax2 = 1);
22
23private:
24 TKDInterpolator(const TKDInterpolator &);
25 TKDInterpolator& operator=(const TKDInterpolator &);
26 void Build();
27
28protected:
29 Int_t fNTNodes; //Number of evaluation data points
30 Float_t **fRefPoints; //[fNDim][fNTNodes]
31 Float_t *fRefValues; //[fNTNodes]
32
33private:
34 Int_t fDepth; //! depth of the KD Tree structure used
35 Double_t *fTmpPoint; //! temporary storage for one data point
36 TKDTreeIF *fKDhelper; //! kNN finder
37 TLinearFitter *fFitter; //! linear fitter
38
39 ClassDef(TKDInterpolator, 1) // data interpolator based on KD tree
40};
41
42//__________________________________________________________________
43Bool_t TKDInterpolator::GetEstimate(Int_t node, Float_t *coord, Float_t &val, Float_t &error) const
44{
45 if(node < 0 || node > GetNTerminalNodes()) return kFALSE;
46
47 for(int idim=0; idim<fNDim; idim++) coord[idim] = fRefPoints[idim][node];
48 val = fRefValues[node];
49 error = fRefValues[node]; // to be implemented
50 return kTRUE;
51}
52
53#endif
54