]>
Commit | Line | Data |
---|---|---|
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 | ||
17 | template <typename Value> class TVectorT; | |
18 | typedef struct TVectorT<Double_t> TVectorD; | |
19 | template <typename Value> class TMatrixT; | |
20 | typedef class TMatrixT<Double_t> TMatrixD; | |
21 | template <typename Index, typename Value> class TKDTree; | |
22 | typedef class TKDTree<Int_t, Float_t> TKDTreeIF; | |
23 | class TLinearFitter; | |
24 | class TClonesArray; | |
25 | class TKDNodeInfo; | |
26 | class TKDInterpolatorBase | |
27 | { | |
28 | public: | |
53ee3cad | 29 | enum EKDInterpolatorBase { |
30 | kdN = 4 // increase in the number of PDF if fit failled | |
31 | ,kNhelper = 30 // bucket size in helper kdTree | |
32 | }; | |
33 | ||
50c4eb3a | 34 | TKDInterpolatorBase(Int_t size = 0); |
35 | virtual ~TKDInterpolatorBase(); | |
a3408ed3 | 36 | |
50c4eb3a | 37 | Double_t Eval(const Double_t *point, Double_t &result, Double_t &error, Bool_t force = kFALSE); |
38 | virtual Int_t GetNodeIndex(const Float_t *p) = 0; | |
39 | Float_t GetAlpha() const {return fAlpha;} | |
40 | Bool_t GetCOGPoint(Int_t node, Float_t *&coord, Float_t &val, Float_t &error) const; | |
41 | Bool_t GetInterpolationMethod() const {return fStatus&1;} | |
42 | TKDNodeInfo* GetNodeInfo(Int_t inode) const; | |
43 | Int_t GetNTNodes() const {return fNTNodes;} | |
44 | void GetStatus(); | |
45 | Bool_t GetStore() const {return fStatus&2;} | |
46 | Bool_t GetWeights() const {return fStatus&4;} | |
a3408ed3 | 47 | |
50c4eb3a | 48 | 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.); |
53ee3cad | 49 | void SetAlpha(Float_t a); |
50c4eb3a | 50 | void SetInterpolationMethod(Bool_t on = kTRUE); |
51 | void SetStore(Bool_t on = kTRUE); | |
52 | void SetWeights(Bool_t on = kTRUE); | |
a3408ed3 | 53 | |
54 | protected: | |
50c4eb3a | 55 | virtual void Build(Int_t nnodes); |
a3408ed3 | 56 | |
57 | private: | |
50c4eb3a | 58 | TKDInterpolatorBase(const TKDInterpolatorBase &); |
59 | TKDInterpolatorBase& operator=(const TKDInterpolatorBase &); | |
a3408ed3 | 60 | |
61 | protected: | |
50c4eb3a | 62 | Int_t fNSize; // data dimension |
63 | Int_t fNTNodes; //Number of evaluation data points | |
64 | TClonesArray *fTNodes; //interpolation nodes | |
a3408ed3 | 65 | |
66 | //private: | |
50c4eb3a | 67 | UChar_t fStatus; // status of the interpolator |
68 | UChar_t fLambda; // number of parameters in polynom | |
69 | Short_t fDepth; //! depth of the KD Tree structure used | |
53ee3cad | 70 | Float_t fAlpha; // parameter controlling the size of the region to interpolate n = (1+alpha)*lambda |
50c4eb3a | 71 | Float_t **fRefPoints; //! temporary storage of COG data |
72 | Double_t *fBuffer; //! working space [2*fLambda] | |
73 | TKDTree<Int_t, Float_t> *fKDhelper; //! kNN finder | |
74 | TLinearFitter *fFitter; //! linear fitter | |
a3408ed3 | 75 | |
50c4eb3a | 76 | ClassDef(TKDInterpolatorBase, 1) // data interpolator based on KD tree |
a3408ed3 | 77 | }; |
78 | ||
79 | ||
80 | #endif | |
81 |