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