]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STAT/TKDNodeInfo.h
Changing fabs into TMath::Abs
[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 template <typename Value> class TVectorT;
9 typedef struct TVectorT<Double_t> TVectorD;
10 template <typename Value> class TMatrixT;
11 typedef class TMatrixT<Double_t> TMatrixD;
12 //class TKDInterpolatorBase;
13 class TKDNodeInfo : public TObject
14 {
15   //friend class TKDInterpolatorBase;
16 public:
17         TKDNodeInfo(Int_t ndim = 0);
18         TKDNodeInfo(const TKDNodeInfo & ref);
19         TKDNodeInfo& operator=(const TKDNodeInfo & ref);
20         virtual  ~TKDNodeInfo();
21         Double_t  CookPDF(const Double_t *point, Double_t &result, Double_t &error);
22         inline Bool_t    Has(const Float_t *p) const;
23         void      Print(const Option_t * = "") const;
24         void      Store(const TVectorD &par, const TMatrixD &cov);
25
26         Int_t GetSize() const { return fNDim; }
27         Float_t *  Data() { return fData; } 
28         Float_t *  Val() { return fVal; } 
29         TMatrixD * Cov() { return fCov; }
30         TVectorD * Par() { return fPar; }
31
32 protected:
33         void      Build(Int_t ndim);
34
35 private:
36         Int_t     fNDim;          // 3 times data dimension
37         Float_t   *fData;         //[fNDim] node's data
38         Float_t   fVal[2];        // measured value for node
39         TMatrixD  *fCov;          // interpolator covariance matrix
40         TVectorD  *fPar;          // interpolator parameters
41
42         ClassDef(TKDNodeInfo, 1)  // node info for interpolator
43 };
44
45 //_____________________________________________________________________
46 Bool_t TKDNodeInfo::Has(const Float_t *p) const
47 {
48         Int_t n = 0;
49         Int_t ndim = fNDim/3;
50         for(int id=0; id<ndim; id++) if(p[id]>=fData[ndim+2*id] && p[id]<fData[ndim+2*id+1]) n++;
51         if(n==ndim) return kTRUE;
52         return kFALSE;
53 }
54
55
56 #endif
57