Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:12:11

0001 // @(#)root/gl:$Id$
0002 // Author: Timur Pocheptsov  2009
0003 /*************************************************************************
0004  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
0005  * All rights reserved.                                                  *
0006  *                                                                       *
0007  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0008  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0009  *************************************************************************/
0010 
0011 #ifndef ROOT_TKDEFGT
0012 #define ROOT_TKDEFGT
0013 
0014 #include <vector>
0015 
0016 #include "RtypesCore.h"
0017 
0018 //KDE - kenrel density estimator,
0019 //based on fast Gauss transform.
0020 
0021 class TGL5DDataSet;
0022 
0023 class TKDEFGT {
0024 private:
0025    //KDE-related stuff.
0026    std::vector<Double_t>    fXC;     //Centers.
0027    std::vector<Double_t>    fWeights;//Weights.
0028    std::vector<UInt_t>      fIndxc;  //Internal data.
0029    std::vector<Double_t>    fA_K;    //Polynomial coefficient (pd x K)
0030    std::vector<UInt_t>      fIndx;   //Internal data.
0031    std::vector<UInt_t>      fXhead;  //Internal data.
0032    std::vector<UInt_t>      fXboxsz; //Internal data.
0033    std::vector<Double_t>    fDistC;  //Internal data.
0034    std::vector<Double_t>    fC_K;    //Internal data.
0035    std::vector<UInt_t>      fCinds;  //Internal data.
0036 
0037    mutable std::vector<UInt_t>   fHeads; //Internal data.
0038    mutable std::vector<Double_t> fDx;    //Internal data.
0039    mutable std::vector<Double_t> fProds; //Internal data.
0040 
0041    UInt_t                  fDim;        //Number of dimensions.
0042    UInt_t                  fP;          //Order of trancation.
0043    UInt_t                  fK;          //Number of centers.
0044    Double_t                fSigma;      //Noise Standard deviation of the kernel (default sigma = 1)
0045    UInt_t                  fPD;         //nchoosek(fP + fDim - 1, fDim);
0046    Bool_t                  fModelValid; //Check, if coefficients are ok.
0047 
0048 public:
0049    TKDEFGT();
0050 
0051    virtual ~TKDEFGT();
0052 
0053    //Generic version.
0054    //"sources" must be a vector of packed coordinates, if you have
0055    //dim == 3, vector will be [xyz|xyz|...].
0056    void BuildModel(const std::vector<Double_t> &sources, Double_t sigma = 1.,
0057                    UInt_t dim = 3, UInt_t p = 8, UInt_t k = 0);
0058    //Special version for data from TTree.
0059    void BuildModel(const TGL5DDataSet *sources, Double_t sigma = 1.,
0060                    UInt_t p = 8, UInt_t k = 0);
0061    //"targets" is a vector of packed coordinates, the same as above in BuildModel:
0062    //[xyz|xyz|xyz...] for dim == 3.
0063    void Predict(const std::vector<Double_t> &targets, std::vector<Double_t> &densities,
0064                 Double_t e)const;
0065 
0066 private:
0067    //Generic version.
0068    void Kcenter(const std::vector<double> &x);
0069    //Special version for data sources from TTree.
0070    void Kcenter(const TGL5DDataSet *sources);
0071 
0072    void Compute_C_k();
0073    //Generic version.
0074    void Compute_A_k(const std::vector<Double_t> &x);
0075    //Version for TTree.
0076    void Compute_A_k(const TGL5DDataSet *sources);
0077 
0078    TKDEFGT(const TKDEFGT &rhs);
0079    TKDEFGT &operator = (const TKDEFGT &rhs);
0080 };
0081 
0082 #endif