]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/STEERBase/AliTRDTKDInterpolator.h
HMPID module
[u/mrichter/AliRoot.git] / STEER / STEERBase / AliTRDTKDInterpolator.h
CommitLineData
db0e2c5f 1#ifndef ROOT_ALITRDTKDINTERPOLATOR_H
2#define ROOT_ALITRDTKDINTERPOLATOR_H
3
4#ifndef ROOT_TKDTree
5#include "TKDTree.h"
6#endif
7
8#ifndef ROOT_TObject
9#include "TObject.h"
10#endif
11
12#include "TVectorD.h"
13#include "TMatrixD.h"
14#include "TH2Poly.h"
15class TClonesArray;
16
17class AliTRDTKDInterpolator : public TKDTreeIF
18{
19
db0e2c5f 20public:
21 enum TRDTKDMode{
22 kInterpolation=0,
23 kMinError=1,
24 kNodeVal=2
25 };
26
27 // Bucket Object class
28 class AliTRDTKDNodeInfo : public TObject
29 {
30 friend class AliTRDTKDInterpolator;
31 public:
32
33 AliTRDTKDNodeInfo(Int_t ndim = 0);
34 AliTRDTKDNodeInfo(const AliTRDTKDInterpolator::AliTRDTKDNodeInfo &ref);
35 AliTRDTKDInterpolator::AliTRDTKDNodeInfo& operator=(const AliTRDTKDInterpolator::AliTRDTKDNodeInfo &ref);
36 virtual ~AliTRDTKDNodeInfo();
f2762b1c 37 Bool_t CookPDF(const Double_t *point, Double_t &result, Double_t &error,TRDTKDMode mod=kInterpolation) const;
db0e2c5f 38 Bool_t Has(const Float_t *p) const;
39 void Print(const Option_t * = "") const;
bd58d4b9 40 void Store(TVectorD const *par, TMatrixD const *cov,Bool_t storeCov);
db0e2c5f 41
42 private:
43 Int_t fNDim; // Dimension of Points
44 Int_t fNBounds; // 2* Dimension of Points
45 Int_t fNPar; // Number of Parameters
46 Int_t fNCov; // Size of Cov Matrix
47 Float_t *fData; //[fNDim] Data Point
48 Float_t *fBounds; //[fNBounds] Boundaries
49 Float_t fVal[2]; //measured value for node
50 Double_t *fPar; //[fNPar] interpolator parameters
51 Double_t *fCov; //[fNCov] interpolator covariance matrix
52
53 ClassDef(AliTRDTKDNodeInfo, 1) // node info for interpolator
54 };
55
56public:
57
58 AliTRDTKDInterpolator();
59 AliTRDTKDInterpolator(Int_t npoints, Int_t ndim, UInt_t bsize, Float_t **data);
60 ~AliTRDTKDInterpolator();
61
62 Bool_t Eval(const Double_t *point, Double_t &result, Double_t &error);
63 void Print(const Option_t *opt="") const;
64
65 TH2Poly * Projection(Int_t xdim,Int_t ydim);
66
67 Int_t GetNDIM() const {return fNDim;}
68 Bool_t GetRange(Int_t idim,Float_t range[2]) const;
69
70 void SetNPointsInterpolation(Int_t np){fNPointsI=np;};
71 Int_t GetNPointsInterpolation(){return fNPointsI;};
72
73 void SetUseWeights(Bool_t k=kTRUE){fUseWeights=k;}
74 void SetPDFMode(TRDTKDMode mod){fPDFMode=mod;}
bd58d4b9 75 void SetStoreCov(Bool_t k){fStoreCov=k;}
db0e2c5f 76
77 Bool_t Build();
78
79 void SetUseHelperNodes(Bool_t k){fUseHelperNodes=k;}
80
81private:
82
83 Int_t GetNodeIndex(const Float_t *p);
84 AliTRDTKDInterpolator::AliTRDTKDNodeInfo* GetNodeInfo(Int_t inode) const;
85 Int_t GetNTNodes() const;
86 void BuildInterpolation();
87 void BuildBoundaryNodes();
88 AliTRDTKDInterpolator(const AliTRDTKDInterpolator &ref);
89 AliTRDTKDInterpolator &operator=(const AliTRDTKDInterpolator &ref);
90
91 Int_t fNDataNodes; // Number of filled nodes (total-zero nodes)
92 TClonesArray *fNodes; //interpolation nodes
93 UChar_t fLambda; // number of parameters in polynom
94 Int_t fNPointsI; // number of points for interpolation
95 Bool_t fUseHelperNodes; // Build Helper nodes to ensure boundary conditions
96 Bool_t fUseWeights; // Use tricubic weights
97 TRDTKDMode fPDFMode; // Mode for PDF calculation
bd58d4b9 98 Bool_t fStoreCov;
db0e2c5f 99
bd58d4b9 100 ClassDef(AliTRDTKDInterpolator, 2) // data interpolator based on KD tree
db0e2c5f 101};
102
103#endif