]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STAT/TKDInterpolatorBase.h
sending trigger decisions (true and false) for every event
[u/mrichter/AliRoot.git] / STAT / TKDInterpolatorBase.h
CommitLineData
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
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;
a3408ed3 29class TKDInterpolatorBase
30{
31public:
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 };
36
50c4eb3a 37 TKDInterpolatorBase(Int_t size = 0);
38 virtual ~TKDInterpolatorBase();
a3408ed3 39
50c4eb3a 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;}
a3408ed3 50
50c4eb3a 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.);
53ee3cad 52 void SetAlpha(Float_t a);
50c4eb3a 53 void SetInterpolationMethod(Bool_t on = kTRUE);
54 void SetStore(Bool_t on = kTRUE);
55 void SetWeights(Bool_t on = kTRUE);
a3408ed3 56
57protected:
50c4eb3a 58 virtual void Build(Int_t nnodes);
a3408ed3 59
60private:
50c4eb3a 61 TKDInterpolatorBase(const TKDInterpolatorBase &);
62 TKDInterpolatorBase& operator=(const TKDInterpolatorBase &);
a3408ed3 63
64protected:
50c4eb3a 65 Int_t fNSize; // data dimension
66 Int_t fNTNodes; //Number of evaluation data points
67 TClonesArray *fTNodes; //interpolation nodes
b6f6b31a 68 TKDNodeInfo::TKDNodeDraw *fTNodesDraw; //graphical representation of interpolation nodes
a3408ed3 69
70//private:
50c4eb3a 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
53ee3cad 74 Float_t fAlpha; // parameter controlling the size of the region to interpolate n = (1+alpha)*lambda
50c4eb3a 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
a3408ed3 79
50c4eb3a 80 ClassDef(TKDInterpolatorBase, 1) // data interpolator based on KD tree
a3408ed3 81};
82
83
84#endif
85