Logo ROOT  
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#include "RtypesCore.h"
17
18//KDE - kenrel density estimator,
19//based on fast Gauss transform.
20
21class TGL5DDataSet;
22
23class TKDEFGT {
24private:
25 //KDE-related stuff.
26 std::vector<Double_t> fXC; //Centers.
27 std::vector<Double_t> fWeights;//Weights.
28 std::vector<UInt_t> fIndxc; //Internal data.
29 std::vector<Double_t> fA_K; //Polynomial coefficient (pd x K)
30 std::vector<UInt_t> fIndx; //Internal data.
31 std::vector<UInt_t> fXhead; //Internal data.
32 std::vector<UInt_t> fXboxsz; //Internal data.
33 std::vector<Double_t> fDistC; //Internal data.
34 std::vector<Double_t> fC_K; //Internal data.
35 std::vector<UInt_t> fCinds; //Internal data.
36
37 mutable std::vector<UInt_t> fHeads; //Internal data.
38 mutable std::vector<Double_t> fDx; //Internal data.
39 mutable std::vector<Double_t> fProds; //Internal data.
40
41 UInt_t fDim; //Number of dimensions.
42 UInt_t fP; //Order of trancation.
43 UInt_t fK; //Number of centers.
44 Double_t fSigma; //Noise Standard deviation of the kernel (default sigma = 1)
45 UInt_t fPD; //nchoosek(fP + fDim - 1, fDim);
46 Bool_t fModelValid; //Check, if coefficients are ok.
47
48public:
49 TKDEFGT();
50
51 virtual ~TKDEFGT();
52
53 //Generic version.
54 //"sources" must be a vector of packed coordinates, if you have
55 //dim == 3, vector will be [xyz|xyz|...].
56 void BuildModel(const std::vector<Double_t> &sources, Double_t sigma = 1.,
57 UInt_t dim = 3, UInt_t p = 8, UInt_t k = 0);
58 //Special version for data from TTree.
59 void BuildModel(const TGL5DDataSet *sources, Double_t sigma = 1.,
60 UInt_t p = 8, UInt_t k = 0);
61 //"targets" is a vector of packed coordinates, the same as above in BuildModel:
62 //[xyz|xyz|xyz...] for dim == 3.
63 void Predict(const std::vector<Double_t> &targets, std::vector<Double_t> &densities,
64 Double_t e)const;
65
66private:
67 //Generic version.
68 void Kcenter(const std::vector<double> &x);
69 //Special version for data sources from TTree.
70 void Kcenter(const TGL5DDataSet *sources);
71
72 void Compute_C_k();
73 //Generic version.
74 void Compute_A_k(const std::vector<Double_t> &x);
75 //Version for TTree.
76 void Compute_A_k(const TGL5DDataSet *sources);
77
78 TKDEFGT(const TKDEFGT &rhs);
80};
81
82#endif
#define e(i)
Definition: RSha256.hxx:103
unsigned int UInt_t
Definition: RtypesCore.h:46
bool Bool_t
Definition: RtypesCore.h:63
double Double_t
Definition: RtypesCore.h:59
TKDEFGT()
Constructor.
Definition: TKDEFGT.cxx:29
std::vector< UInt_t > fHeads
Definition: TKDEFGT.h:37
UInt_t fPD
Definition: TKDEFGT.h:45
void Compute_C_k()
Coefficients C_K.
Definition: TKDEFGT.cxx:270
std::vector< UInt_t > fIndxc
Definition: TKDEFGT.h:28
virtual ~TKDEFGT()
Destructor.
Definition: TKDEFGT.cxx:48
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 > fCinds
Definition: TKDEFGT.h:35
std::vector< UInt_t > fXhead
Definition: TKDEFGT.h:31
std::vector< Double_t > fC_K
Definition: TKDEFGT.h:34
UInt_t fDim
Definition: TKDEFGT.h:41
std::vector< Double_t > fDistC
Definition: TKDEFGT.h:33
void Kcenter(const std::vector< double > &x)
Solve kcenter task.
Definition: TKDEFGT.cxx:160
UInt_t fK
Definition: TKDEFGT.h:43
std::vector< Double_t > fXC
Definition: TKDEFGT.h:26
std::vector< Double_t > fProds
Definition: TKDEFGT.h:39
std::vector< UInt_t > fIndx
Definition: TKDEFGT.h:30
std::vector< Double_t > fDx
Definition: TKDEFGT.h:38
void Compute_A_k(const std::vector< Double_t > &x)
Coefficients A_K.
Definition: TKDEFGT.cxx:292
std::vector< UInt_t > fXboxsz
Definition: TKDEFGT.h:32
Bool_t fModelValid
Definition: TKDEFGT.h:46
TKDEFGT(const TKDEFGT &rhs)
std::vector< Double_t > fA_K
Definition: TKDEFGT.h:29
Double_t fSigma
Definition: TKDEFGT.h:44
TKDEFGT & operator=(const TKDEFGT &rhs)
std::vector< Double_t > fWeights
Definition: TKDEFGT.h:27
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
UInt_t fP
Definition: TKDEFGT.h:42
const Double_t sigma
Double_t x[n]
Definition: legend1.C:17