AliRoot Core  ee782a0 (ee782a0)
TKDInterpolatorBase.h
Go to the documentation of this file.
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 
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 //
20 
21 template <typename Value> class TVectorT;
22 typedef class 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;
30 {
31 public:
33  kdN = 4 // increase in the number of PDF if fit failled
34  ,kNhelper = 30 // bucket size in helper kdTree
35  };
37  kCOG = 0 // COG interpolation method
38  ,kSTORE = 1 // Store interpolation results
39  ,kWEIGHTS = 2 // use weights
40  };
41  TKDInterpolatorBase(Int_t size = 0);
42  virtual ~TKDInterpolatorBase();
43 
44  Bool_t Bootstrap();
45  Double_t Eval(const Double_t *point, Double_t &result, Double_t &error, Bool_t force = kFALSE);
46  virtual Int_t GetNodeIndex(const Float_t *p) = 0;
47  Float_t GetAlpha() const {return fAlpha;}
48  Int_t GetLambda() const {return fLambda;}
49  Int_t GetSize() const {return fNSize;}
50  Bool_t GetCOGPoint(Int_t node, Float_t *&coord, Float_t &val, Float_t &error) const;
51  TKDNodeInfo* GetNodeInfo(Int_t inode) const;
52  Int_t GetNTNodes() const;
53  Bool_t GetRange(Int_t ax, Float_t &min, Float_t &max) const;
54  void GetStatus(Option_t *opt="");
55 
56  Bool_t HasStore() const {return TESTBIT(fStatus, kSTORE);}
57  Bool_t UseCOG() const {return TESTBIT(fStatus, kCOG);}
58  Bool_t UseWeights() const {return TESTBIT(fStatus, kWEIGHTS);}
59 
60  void DrawProjection(UInt_t ax1 = 0, UInt_t ax2 = 1);
61  void SetAlpha(Float_t a);
62  void SetCOG(Bool_t on = kTRUE) {on ? SETBIT(fStatus, kCOG) : CLRBIT(fStatus, kCOG);}
63  void SetStore(Bool_t on = kTRUE) {on ? SETBIT(fStatus, kSTORE) : CLRBIT(fStatus, kSTORE);}
64  void SetWeights(Bool_t on = kTRUE) {on ? SETBIT(fStatus, kWEIGHTS) : CLRBIT(fStatus, kWEIGHTS);}
65 
66 protected:
67  virtual Bool_t Build(Int_t nnodes);
68 
69 
70  Int_t fNSize;
71  TClonesArray *fNodes; //interpolation nodes
73 
74 //private:
75  UChar_t fStatus; // status of the interpolator
76  UChar_t fLambda;
77  Short_t fDepth;
78  Float_t fAlpha; // parameter controlling the size of the region to interpolate n = (1+alpha)*lambda
79  Float_t **fRefPoints;
80  Double_t *fBuffer;
82  TLinearFitter *fFitter;
83 
84 private:
87 
88  ClassDef(TKDInterpolatorBase, 3) // data interpolator based on KD tree
89 };
90 
91 
92 #endif
93 
void DrawProjection(UInt_t ax1=0, UInt_t ax2=1)
void SetWeights(Bool_t on=kTRUE)
virtual Int_t GetNodeIndex(const Float_t *p)=0
Bool_t GetCOGPoint(Int_t node, Float_t *&coord, Float_t &val, Float_t &error) const
Float_t p[]
Definition: kNNTest.C:133
Bool_t UseWeights() const
TKDNodeInfo::TKDNodeDraw * fNodesDraw
Bool_t UseCOG() const
TKDInterpolatorBase & operator=(const TKDInterpolatorBase &)
UChar_t fStatus
graphical representation of interpolation nodes
virtual Bool_t Build(Int_t nnodes)
TKDTree< Int_t, Float_t > * fKDhelper
working space [2*fLambda]
void SetCOG(Bool_t on=kTRUE)
TClonesArray * fNodes
data dimension
TLinearFitter * fFitter
kNN finder
Short_t fDepth
number of parameters in polynom
Bool_t GetRange(Int_t ax, Float_t &min, Float_t &max) const
TKDNodeInfo * GetNodeInfo(Int_t inode) const
void GetStatus(Option_t *opt="")
Float_t fAlpha
depth of the KD Tree structure used
TKDInterpolatorBase(Int_t size=0)
Float_t GetAlpha() const
Bool_t HasStore() const
class TKDTree< Int_t, Float_t > TKDTreeIF
class TVectorT< Double_t > TVectorD
Int_t GetLambda() const
Double_t * fBuffer
temporary storage of COG data
Double_t Eval(const Double_t *point, Double_t &result, Double_t &error, Bool_t force=kFALSE)
class TMatrixT< Double_t > TMatrixD
void SetStore(Bool_t on=kTRUE)