TKDEFGT.h

Go to the documentation of this file.
00001 // @(#)root/gl:$Id: TKDEFGT.h 29602 2009-07-28 10:23:20Z brun $
00002 // Author: Timur Pocheptsov  2009
00003 /*************************************************************************
00004  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
00005  * All rights reserved.                                                  *
00006  *                                                                       *
00007  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00008  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00009  *************************************************************************/
00010 
00011 #ifndef ROOT_TKDEFGT
00012 #define ROOT_TKDEFGT
00013 
00014 #include <vector>
00015 
00016 #ifndef ROOT_Rtypes
00017 #include "Rtypes.h"
00018 #endif
00019 
00020 //KDE - kenrel density estimator,
00021 //based on fast Gauss transform.
00022 
00023 class TGL5DDataSet;
00024 
00025 class TKDEFGT {
00026 private:
00027    //KDE-related stuff.   
00028    std::vector<Double_t>    fXC;     //Centers.
00029    std::vector<Double_t>    fWeights;//Weights.
00030    std::vector<UInt_t>      fIndxc;  //Internal data.
00031    std::vector<Double_t>    fA_K;    //Polynomial coefficient (pd x K)
00032    std::vector<UInt_t>      fIndx;   //Internal data.
00033    std::vector<UInt_t>      fXhead;  //Internal data.
00034    std::vector<UInt_t>      fXboxsz; //Internal data.
00035    std::vector<Double_t>    fDistC;  //Internal data.
00036    std::vector<Double_t>    fC_K;    //Internal data.
00037    std::vector<UInt_t>      fCinds;  //Internal data.
00038    
00039    mutable std::vector<UInt_t>   fHeads; //Internal data.
00040    mutable std::vector<Double_t> fDx;    //Internal data.
00041    mutable std::vector<Double_t> fProds; //Internal data.
00042    
00043    UInt_t                  fDim;        //Number of dimensions.
00044    UInt_t                  fP;          //Order of trancation.
00045    UInt_t                  fK;          //Number of centers.
00046    Double_t                fSigma;      //Noise Standard deviation of the kernel (default sigma = 1)
00047    UInt_t                  fPD;         //nchoosek(fP + fDim - 1, fDim); 
00048    Bool_t                  fModelValid; //Check, if coefficients are ok.
00049    
00050 public:
00051    TKDEFGT();
00052    
00053    virtual ~TKDEFGT();
00054    
00055    //Generic version.
00056    //"sources" must be a vector of packed coordinates, if you have
00057    //dim == 3, vector will be [xyz|xyz|...].
00058    void BuildModel(const std::vector<Double_t> &sources, Double_t sigma = 1.,
00059                    UInt_t dim = 3, UInt_t p = 8, UInt_t k = 0);
00060    //Special version for data from TTree.
00061    void BuildModel(const TGL5DDataSet *sources, Double_t sigma = 1.,
00062                    UInt_t p = 8, UInt_t k = 0);
00063    //"targets" is a vector of packed coordinates, the same as above in BuildModel:
00064    //[xyz|xyz|xyz...] for dim == 3.
00065    void Predict(const std::vector<Double_t> &targets, std::vector<Double_t> &densities,
00066                 Double_t e)const;
00067 
00068 private:
00069    //Generic version.
00070    void Kcenter(const std::vector<double> &x);
00071    //Special version for data sources from TTree.
00072    void Kcenter(const TGL5DDataSet *sources);
00073 
00074    void Compute_C_k();
00075    //Generic version.
00076    void Compute_A_k(const std::vector<Double_t> &x);
00077    //Version for TTree.
00078    void Compute_A_k(const TGL5DDataSet *sources);
00079 
00080    TKDEFGT(const TKDEFGT &rhs);
00081    TKDEFGT &operator = (const TKDEFGT &rhs);
00082 };
00083 
00084 #endif

Generated on Tue Jul 5 14:16:57 2011 for ROOT_528-00b_version by  doxygen 1.5.1