]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STAT/TKDInterpolatorBase.h
Updated online raw data QA for the SSD - occupancy calculation per module (Panos)
[u/mrichter/AliRoot.git] / STAT / TKDInterpolatorBase.h
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: 
29         TKDInterpolatorBase(Int_t size = 0);
30         virtual ~TKDInterpolatorBase();
31
32         Double_t   Eval(const Double_t *point, Double_t &result, Double_t &error, Bool_t force = kFALSE);
33         virtual Int_t GetNodeIndex(const Float_t *p) = 0;
34         Float_t    GetAlpha() const {return fAlpha;}
35         Bool_t     GetCOGPoint(Int_t node, Float_t *&coord, Float_t &val, Float_t &error) const;
36         Bool_t     GetInterpolationMethod() const {return fStatus&1;}
37         TKDNodeInfo* GetNodeInfo(Int_t inode) const;
38         Int_t      GetNTNodes() const {return fNTNodes;}
39         void       GetStatus();
40         Bool_t     GetStore() const {return fStatus&2;}
41         Bool_t     GetWeights() const {return fStatus&4;}
42
43         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.);
44         void       SetAlpha(Float_t a){if(a>0.) fAlpha = a;}
45         void       SetInterpolationMethod(Bool_t on = kTRUE);
46         void       SetStore(Bool_t on = kTRUE);
47         void       SetWeights(Bool_t on = kTRUE);
48
49 protected:
50         virtual void      Build(Int_t nnodes);
51
52 private:
53         TKDInterpolatorBase(const TKDInterpolatorBase &);
54         TKDInterpolatorBase& operator=(const TKDInterpolatorBase &);
55
56 protected:
57         Int_t         fNSize;       // data dimension
58         Int_t         fNTNodes;     //Number of evaluation data points
59         TClonesArray  *fTNodes;     //interpolation nodes
60
61 //private:
62         UChar_t       fStatus;      // status of the interpolator
63         UChar_t       fLambda;      // number of parameters in polynom
64         Short_t             fDepth;       //! depth of the KD Tree structure used
65         Float_t       fAlpha;       // alpha parameter
66         Float_t       **fRefPoints; //! temporary storage of COG data
67         Double_t            *fBuffer;     //! working space [2*fLambda]
68         TKDTree<Int_t, Float_t> *fKDhelper;      //! kNN finder
69         TLinearFitter *fFitter;     //! linear fitter   
70
71         ClassDef(TKDInterpolatorBase, 1)   // data interpolator based on KD tree
72 };
73
74
75 #endif
76