1 #ifndef ROOT_TKDNodeInfo
2 #define ROOT_TKDNodeInfo
4 ////////////////////////////////////////////////////////
6 // Bucket representation for TKDInterpolator(Base)
8 // Author Alexandru Bercuci <A.Bercuci@gsi.de>
10 ////////////////////////////////////////////////////////
24 template <typename Value> class TVectorT;
25 typedef struct TVectorT<Double_t> TVectorD;
26 template <typename Value> class TMatrixT;
27 typedef class TMatrixT<Double_t> TMatrixD;
28 class TKDNodeInfo : public TObject
32 friend class TKDInterpolatorBase;
33 class TKDNodeDraw : public TBox {
37 void Draw(Option_t* option = "");
38 void Print(const Option_t* option = "") const; // *MENU*
39 void SetNode(TKDNodeInfo*, UChar_t s, UChar_t ax1=0, UChar_t ax2=1);
41 TKDNodeDraw(const TKDNodeDraw & ref);
42 TKDNodeDraw& operator=(const TKDNodeDraw & ref);
44 TMarker fCOG; // COG of the node
45 TKDNodeInfo *fNode; //! node data
46 ClassDef(TKDNodeDraw, 1) // graphical representation of TKDNodeInfo
49 TKDNodeInfo(Int_t ndim = 0);
50 TKDNodeInfo(const TKDNodeInfo & ref);
51 TKDNodeInfo& operator=(const TKDNodeInfo & ref);
52 virtual ~TKDNodeInfo();
53 Double_t CookPDF(const Double_t *point, Double_t &result, Double_t &error);
54 inline void GetBoundary(Int_t ax, Float_t &min, Float_t &max) const;
55 inline void GetCOG(Float_t* &p) const;
56 Int_t GetDimension() const { return fNDim/3; }
57 void GetPDF(Float_t &pdf, Float_t &error) const {pdf=fVal[0]; error=fVal[1];}
58 Int_t GetSize() const { return fNDim; }
59 inline Bool_t Has(const Float_t *p) const;
60 void Print(const Option_t * = "") const;
61 void Store(const TVectorD &par, const TMatrixD &cov);
63 TMatrixD* Cov() const { return fCov; }
64 TVectorD* Par() const { return fPar; }
66 void SetNode(Int_t ndim, Float_t *data, Float_t *pdf);
68 Float_t* Data() { return fData;}
69 Float_t* Val() { return &fVal[0]; }
70 void Build(Int_t ndim);
73 Int_t fNDim; // 3 times data dimension
74 Float_t *fData; //[fNDim] node's data
75 Float_t fVal[2]; // measured value for node
76 TMatrixD *fCov; // interpolator covariance matrix
77 TVectorD *fPar; // interpolator parameters
79 ClassDef(TKDNodeInfo, 1) // node info for interpolator
82 //_____________________________________________________________________
83 inline Bool_t TKDNodeInfo::Has(const Float_t *p) const
87 Float_t *it = &fData[ndim]; Int_t n(0);
88 for(int id=0; id<ndim; id++, it+=2)
89 if(p[id]>=it[0] && p[id]<it[1]) n++;
90 if(n==ndim) return kTRUE;
94 //_____________________________________________________________________
95 inline void TKDNodeInfo::GetBoundary(Int_t ax, Float_t &min, Float_t &max) const
102 Float_t *it = &fData[ndim+(ax<<1)];
103 min = it[0]; max = it[1];
106 //_____________________________________________________________________
107 inline void TKDNodeInfo::GetCOG(Float_t* &p) const
109 Int_t ndim = fNDim/3;
110 memcpy(p, fData, ndim*sizeof(Float_t));