Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:10:59

0001 // $Id$
0002 /**********************************************************************************
0003  * Project: TMVA - a Root-integrated toolkit for multivariate data analysis       *
0004  * Package: TMVA                                                                  *
0005  * Class  : LDA                                                                   *
0006  *                                             *
0007  *                                                                                *
0008  * Description:                                                                   *
0009  *      Local LDA method used by MethodKNN to compute MVA value.                  *
0010  *      This is experimental code under development. This class computes          *
0011  *      parameters of signal and background PDFs using Gaussian approximation.    *
0012  *                                                                                *
0013  * Author:                                                                        *
0014  *      John Alison John.Alison@cern.ch - University of Pennsylvania, USA         *
0015  *                                                                                *
0016  * Copyright (c) 2007:                                                            *
0017  *      CERN, Switzerland                                                         *
0018  *      MPI-K Heidelberg, Germany                                                 *
0019  *      University of Pennsylvania, USA                                           *
0020  *                                                                                *
0021  * Redistribution and use in source and binary forms, with or without             *
0022  * modification, are permitted according to the terms listed in LICENSE           *
0023  * (see tmva/doc/LICENSE)                                          *
0024  **********************************************************************************/
0025 
0026 #ifndef ROOT_TMVA_LDA
0027 #define ROOT_TMVA_LDA
0028 
0029 
0030 // C/C++
0031 #include <map>
0032 #include <vector>
0033 
0034 // ROOT
0035 #include "RtypesCore.h"
0036 #include "TMatrixFfwd.h"
0037 
0038 typedef std::vector<std::vector<Float_t> >  LDAEvents;
0039 
0040 namespace TMVA {
0041 
0042    class MsgLogger;
0043 
0044    class LDA {
0045 
0046    public:
0047 
0048       LDA(Float_t tolerence = 1.0e-5, Bool_t debug = false);
0049       ~LDA();
0050 
0051       // Signal probability with Gaussian approximation
0052       Float_t GetProb(const std::vector<Float_t>& x, Int_t k);
0053 
0054       // Log likelihood function with Gaussian approximation
0055       Float_t GetLogLikelihood(const std::vector<Float_t>& x, Int_t k);
0056 
0057       // Create LDA matrix using local events found by knn method
0058       void Initialize(const LDAEvents& inputSignal, const LDAEvents& inputBackground);
0059 
0060    private:
0061 
0062       // Probability value using Gaussian approximation
0063       Float_t FSub(const std::vector<Float_t>& x, Int_t k);
0064 
0065       MsgLogger& Log() const { return *fLogger; }
0066 
0067    private:
0068 
0069       // data members
0070       Float_t       fTolerence;                    ///< documentation!
0071       UInt_t        fNumParams;                    ///< documentation!
0072       std::map<Int_t, std::vector<Float_t> > fMu;  ///< documentation!
0073       TMatrixF*     fSigma;                        ///< documentation!
0074       TMatrixF*     fSigmaInverse;                 ///< documentation!
0075       std::map<Int_t, Float_t> fEventFraction;     ///< documentation!
0076       Bool_t        fDebug;                        ///< documentation!
0077 
0078       mutable MsgLogger *fLogger;                  ///<! message logging service
0079    };
0080 }
0081 #endif