Logo ROOT   6.08/07
Reference Guide
TKDEFGT.h
Go to the documentation of this file.
1 // @(#)root/gl:$Id$
2 // Author: Timur Pocheptsov 2009
3 /*************************************************************************
4  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
5  * All rights reserved. *
6  * *
7  * For the licensing terms see $ROOTSYS/LICENSE. *
8  * For the list of contributors see $ROOTSYS/README/CREDITS. *
9  *************************************************************************/
10 
11 #ifndef ROOT_TKDEFGT
12 #define ROOT_TKDEFGT
13 
14 #include <vector>
15 
16 #ifndef ROOT_Rtypes
17 #include "Rtypes.h"
18 #endif
19 
20 //KDE - kenrel density estimator,
21 //based on fast Gauss transform.
22 
23 class TGL5DDataSet;
24 
25 class TKDEFGT {
26 private:
27  //KDE-related stuff.
28  std::vector<Double_t> fXC; //Centers.
29  std::vector<Double_t> fWeights;//Weights.
30  std::vector<UInt_t> fIndxc; //Internal data.
31  std::vector<Double_t> fA_K; //Polynomial coefficient (pd x K)
32  std::vector<UInt_t> fIndx; //Internal data.
33  std::vector<UInt_t> fXhead; //Internal data.
34  std::vector<UInt_t> fXboxsz; //Internal data.
35  std::vector<Double_t> fDistC; //Internal data.
36  std::vector<Double_t> fC_K; //Internal data.
37  std::vector<UInt_t> fCinds; //Internal data.
38 
39  mutable std::vector<UInt_t> fHeads; //Internal data.
40  mutable std::vector<Double_t> fDx; //Internal data.
41  mutable std::vector<Double_t> fProds; //Internal data.
42 
43  UInt_t fDim; //Number of dimensions.
44  UInt_t fP; //Order of trancation.
45  UInt_t fK; //Number of centers.
46  Double_t fSigma; //Noise Standard deviation of the kernel (default sigma = 1)
47  UInt_t fPD; //nchoosek(fP + fDim - 1, fDim);
48  Bool_t fModelValid; //Check, if coefficients are ok.
49 
50 public:
51  TKDEFGT();
52 
53  virtual ~TKDEFGT();
54 
55  //Generic version.
56  //"sources" must be a vector of packed coordinates, if you have
57  //dim == 3, vector will be [xyz|xyz|...].
58  void BuildModel(const std::vector<Double_t> &sources, Double_t sigma = 1.,
59  UInt_t dim = 3, UInt_t p = 8, UInt_t k = 0);
60  //Special version for data from TTree.
61  void BuildModel(const TGL5DDataSet *sources, Double_t sigma = 1.,
62  UInt_t p = 8, UInt_t k = 0);
63  //"targets" is a vector of packed coordinates, the same as above in BuildModel:
64  //[xyz|xyz|xyz...] for dim == 3.
65  void Predict(const std::vector<Double_t> &targets, std::vector<Double_t> &densities,
66  Double_t e)const;
67 
68 private:
69  //Generic version.
70  void Kcenter(const std::vector<double> &x);
71  //Special version for data sources from TTree.
72  void Kcenter(const TGL5DDataSet *sources);
73 
74  void Compute_C_k();
75  //Generic version.
76  void Compute_A_k(const std::vector<Double_t> &x);
77  //Version for TTree.
78  void Compute_A_k(const TGL5DDataSet *sources);
79 
80  TKDEFGT(const TKDEFGT &rhs);
81  TKDEFGT &operator = (const TKDEFGT &rhs);
82 };
83 
84 #endif
std::vector< Double_t > fC_K
Definition: TKDEFGT.h:36
std::vector< UInt_t > fXboxsz
Definition: TKDEFGT.h:34
std::vector< Double_t > fProds
Definition: TKDEFGT.h:41
void Compute_C_k()
Coefficients C_K.
Definition: TKDEFGT.cxx:270
std::vector< Double_t > fWeights
Definition: TKDEFGT.h:29
void Kcenter(const std::vector< double > &x)
Solve kcenter task.
Definition: TKDEFGT.cxx:160
bool Bool_t
Definition: RtypesCore.h:59
std::vector< UInt_t > fIndx
Definition: TKDEFGT.h:32
UInt_t fK
Definition: TKDEFGT.h:45
void Compute_A_k(const std::vector< Double_t > &x)
Coefficients A_K.
Definition: TKDEFGT.cxx:292
std::vector< Double_t > fXC
Definition: TKDEFGT.h:28
Double_t x[n]
Definition: legend1.C:17
TKDEFGT & operator=(const TKDEFGT &rhs)
Bool_t fModelValid
Definition: TKDEFGT.h:48
std::vector< Double_t > fA_K
Definition: TKDEFGT.h:31
std::vector< Double_t > fDistC
Definition: TKDEFGT.h:35
const Double_t sigma
UInt_t fDim
Definition: TKDEFGT.h:43
virtual ~TKDEFGT()
Destructor.
Definition: TKDEFGT.cxx:48
std::vector< UInt_t > fXhead
Definition: TKDEFGT.h:33
std::vector< UInt_t > fCinds
Definition: TKDEFGT.h:37
unsigned int UInt_t
Definition: RtypesCore.h:42
UInt_t fP
Definition: TKDEFGT.h:44
Double_t fSigma
Definition: TKDEFGT.h:46
TKDEFGT()
Constructor.
Definition: TKDEFGT.cxx:29
std::vector< Double_t > fDx
Definition: TKDEFGT.h:40
void BuildModel(const std::vector< Double_t > &sources, Double_t sigma=1., UInt_t dim=3, UInt_t p=8, UInt_t k=0)
Calculate coefficients for FGT.
Definition: TKDEFGT.cxx:55
double Double_t
Definition: RtypesCore.h:55
std::vector< UInt_t > fHeads
Definition: TKDEFGT.h:39
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
Definition: TRolke.cxx:630
UInt_t fPD
Definition: TKDEFGT.h:47
void Predict(const std::vector< Double_t > &targets, std::vector< Double_t > &densities, Double_t e) const
Calculate densities.
Definition: TKDEFGT.cxx:388
std::vector< UInt_t > fIndxc
Definition: TKDEFGT.h:30