]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STAT/TKDNodeInfo.h
Added two missing includes to allow macro compilation (thanks to Laurent for remarkin...
[u/mrichter/AliRoot.git] / STAT / TKDNodeInfo.h
1 #ifndef ROOT_TKDNodeInfo
2 #define ROOT_TKDNodeInfo
3
4 #ifndef ROOT_TObject
5 #include "TObject.h"
6 #endif
7
8 #ifndef ROOT_TBox
9 #include "TBox.h"
10 #endif
11
12 #ifndef ROOT_TMarker
13 #include "TMarker.h"
14 #endif
15
16 template <typename Value> class TVectorT;
17 typedef struct TVectorT<Double_t> TVectorD;
18 template <typename Value> class TMatrixT;
19 typedef class TMatrixT<Double_t> TMatrixD;
20 class TKDNodeInfo : public TObject
21 {
22   //friend class TKDInterpolatorBase;
23 public:
24   class TKDNodeDraw : public TBox {
25   public:
26     TKDNodeDraw();
27     ~TKDNodeDraw() {;}
28     void  Draw(Option_t* option = "");
29     void  SetNode(TKDNodeInfo*, UChar_t s, UChar_t ax1=0, UChar_t ax2=1);
30   private:
31     TKDNodeDraw(const TKDNodeDraw & ref);
32     TKDNodeDraw& operator=(const TKDNodeDraw & ref);
33
34     TMarker  fCOG;      // COG of the node
35
36     ClassDef(TKDNodeDraw, 1)   // graphical representation of TKDNodeInfo
37   };
38
39   TKDNodeInfo(Int_t ndim = 0);
40   TKDNodeInfo(const TKDNodeInfo & ref);
41   TKDNodeInfo& operator=(const TKDNodeInfo & ref);
42   virtual  ~TKDNodeInfo();
43   Double_t  CookPDF(const Double_t *point, Double_t &result, Double_t &error);
44   inline Bool_t    Has(const Float_t *p) const;
45   void      Print(const Option_t * = "") const;
46   void      Store(const TVectorD &par, const TMatrixD &cov);
47
48   Int_t GetSize() const { return fNDim; }
49   Float_t *  Data() { return fData; } 
50   Float_t *  Val() { return fVal; } 
51   TMatrixD * Cov() { return fCov; }
52   TVectorD * Par() { return fPar; }
53
54 protected:
55   void      Build(Int_t ndim);
56
57 private:
58   Int_t     fNDim;          // 3 times data dimension
59   Float_t   *fData;         //[fNDim] node's data
60   Float_t   fVal[2];        // measured value for node
61   TMatrixD  *fCov;          // interpolator covariance matrix
62   TVectorD  *fPar;          // interpolator parameters
63
64   ClassDef(TKDNodeInfo, 1)  // node info for interpolator
65 };
66
67 //_____________________________________________________________________
68 Bool_t TKDNodeInfo::Has(const Float_t *p) const
69 {
70   Int_t n = 0;
71   Int_t ndim = fNDim/3;
72   for(int id=0; id<ndim; id++) if(p[id]>=fData[ndim+2*id] && p[id]<fData[ndim+2*id+1]) n++;
73   if(n==ndim) return kTRUE;
74   return kFALSE;
75 }
76
77
78 #endif
79