]>
Commit | Line | Data |
---|---|---|
a3408ed3 | 1 | #ifndef ROOT_TKDInterpolatorBase |
2 | #define ROOT_TKDInterpolatorBase | |
3 | ||
4 | #ifndef ROOT_Rtypes | |
5 | #include "Rtypes.h" | |
6 | #endif | |
7 | ||
b6f6b31a | 8 | #ifndef ROOT_TKDNodeInfo |
9 | #include "TKDNodeInfo.h" | |
10 | #endif | |
11 | ||
a3408ed3 | 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 | ||
21 | template <typename Value> class TVectorT; | |
22 | typedef struct TVectorT<Double_t> TVectorD; | |
23 | template <typename Value> class TMatrixT; | |
24 | typedef class TMatrixT<Double_t> TMatrixD; | |
25 | template <typename Index, typename Value> class TKDTree; | |
26 | typedef class TKDTree<Int_t, Float_t> TKDTreeIF; | |
27 | class TLinearFitter; | |
28 | class TClonesArray; | |
a3408ed3 | 29 | class TKDInterpolatorBase |
30 | { | |
31 | public: | |
53ee3cad | 32 | enum EKDInterpolatorBase { |
33 | kdN = 4 // increase in the number of PDF if fit failled | |
34 | ,kNhelper = 30 // bucket size in helper kdTree | |
35 | }; | |
b273c7cb | 36 | enum EKDInterpolatorBaseBits { |
37 | kCOG = 0 // COG interpolation method | |
38 | ,kSTORE = 1 // Store interpolation results | |
39 | ,kWEIGHTS = 2 // use weights | |
40 | }; | |
50c4eb3a | 41 | TKDInterpolatorBase(Int_t size = 0); |
42 | virtual ~TKDInterpolatorBase(); | |
a3408ed3 | 43 | |
50c4eb3a | 44 | Double_t Eval(const Double_t *point, Double_t &result, Double_t &error, Bool_t force = kFALSE); |
45 | virtual Int_t GetNodeIndex(const Float_t *p) = 0; | |
46 | Float_t GetAlpha() const {return fAlpha;} | |
47 | Bool_t GetCOGPoint(Int_t node, Float_t *&coord, Float_t &val, Float_t &error) const; | |
50c4eb3a | 48 | TKDNodeInfo* GetNodeInfo(Int_t inode) const; |
49 | Int_t GetNTNodes() const {return fNTNodes;} | |
b273c7cb | 50 | Bool_t GetRange(Int_t ax, Float_t &min, Float_t &max) const; |
51 | void GetStatus(Option_t *opt=""); | |
52 | ||
53 | Bool_t HasStore() const {return TESTBIT(fStatus, kSTORE);} | |
54 | Bool_t UseCOG() const {return TESTBIT(fStatus, kCOG);} | |
55 | Bool_t UseWeights() const {return TESTBIT(fStatus, kWEIGHTS);} | |
a3408ed3 | 56 | |
b273c7cb | 57 | void DrawProjection(UInt_t ax1 = 0, UInt_t ax2 = 1); |
53ee3cad | 58 | void SetAlpha(Float_t a); |
b273c7cb | 59 | void SetCOG(Bool_t on = kTRUE) {on ? SETBIT(fStatus, kCOG) : CLRBIT(fStatus, kCOG);} |
60 | void SetStore(Bool_t on = kTRUE) {on ? SETBIT(fStatus, kSTORE) : CLRBIT(fStatus, kSTORE);} | |
61 | void SetWeights(Bool_t on = kTRUE) {on ? SETBIT(fStatus, kWEIGHTS) : CLRBIT(fStatus, kWEIGHTS);} | |
a3408ed3 | 62 | |
63 | protected: | |
50c4eb3a | 64 | virtual void Build(Int_t nnodes); |
a3408ed3 | 65 | |
66 | private: | |
50c4eb3a | 67 | TKDInterpolatorBase(const TKDInterpolatorBase &); |
68 | TKDInterpolatorBase& operator=(const TKDInterpolatorBase &); | |
a3408ed3 | 69 | |
70 | protected: | |
50c4eb3a | 71 | Int_t fNSize; // data dimension |
72 | Int_t fNTNodes; //Number of evaluation data points | |
73 | TClonesArray *fTNodes; //interpolation nodes | |
b6f6b31a | 74 | TKDNodeInfo::TKDNodeDraw *fTNodesDraw; //graphical representation of interpolation nodes |
a3408ed3 | 75 | |
76 | //private: | |
50c4eb3a | 77 | UChar_t fStatus; // status of the interpolator |
78 | UChar_t fLambda; // number of parameters in polynom | |
79 | Short_t fDepth; //! depth of the KD Tree structure used | |
53ee3cad | 80 | Float_t fAlpha; // parameter controlling the size of the region to interpolate n = (1+alpha)*lambda |
50c4eb3a | 81 | Float_t **fRefPoints; //! temporary storage of COG data |
82 | Double_t *fBuffer; //! working space [2*fLambda] | |
83 | TKDTree<Int_t, Float_t> *fKDhelper; //! kNN finder | |
84 | TLinearFitter *fFitter; //! linear fitter | |
a3408ed3 | 85 | |
50c4eb3a | 86 | ClassDef(TKDInterpolatorBase, 1) // data interpolator based on KD tree |
a3408ed3 | 87 | }; |
88 | ||
89 | ||
90 | #endif | |
91 |