MethodHMatrix.h

Go to the documentation of this file.
00001 // @(#)root/tmva $Id: MethodHMatrix.h 36966 2010-11-26 09:50:13Z evt $    
00002 // Author: Andreas Hoecker, Joerg Stelzer, Helge Voss, Kai Voss 
00003 
00004 /**********************************************************************************
00005  * Project: TMVA - a Root-integrated toolkit for multivariate data analysis       *
00006  * Package: TMVA                                                                  *
00007  * Class  : MethodHMatrix                                                         *
00008  * Web    : http://tmva.sourceforge.net                                           *
00009  *                                                                                *
00010  * Description:                                                                   *
00011  *      H-Matrix method, which is implemented as a simple comparison of           *
00012  *      chi-squared estimators for signal and background, taking into account     *
00013  *      the linear correlations between the input variables.                      *
00014  *      Method is (also) used by D0 Collaboration (FNAL) for electron             *
00015  *      identification; for more information, see, eg,                            *
00016  *      http://www-d0.fnal.gov/d0dist/dist/packages/tau_hmchisq/devel/doc/        *
00017  *                                                                                *
00018  * Authors (alphabetical):                                                        *
00019  *      Andreas Hoecker <Andreas.Hocker@cern.ch> - CERN, Switzerland              *
00020  *      Helge Voss      <Helge.Voss@cern.ch>     - MPI-K Heidelberg, Germany      *
00021  *      Kai Voss        <Kai.Voss@cern.ch>       - U. of Victoria, Canada         *
00022  *                                                                                *
00023  * Copyright (c) 2005:                                                            *
00024  *      CERN, Switzerland                                                         * 
00025  *      U. of Victoria, Canada                                                    * 
00026  *      MPI-K Heidelberg, Germany                                                 * 
00027  *                                                                                *
00028  * Redistribution and use in source and binary forms, with or without             *
00029  * modification, are permitted according to the terms listed in LICENSE           *
00030  * (http://tmva.sourceforge.net/LICENSE)                                          *
00031  **********************************************************************************/
00032 
00033 #ifndef ROOT_TMVA_MethodHMatrix
00034 #define ROOT_TMVA_MethodHMatrix
00035 
00036 //////////////////////////////////////////////////////////////////////////
00037 //                                                                      //
00038 // MethodHMatrix                                                        //
00039 //                                                                      //
00040 // H-Matrix method, which is implemented as a simple comparison of      // 
00041 // chi-squared estimators for signal and background, taking into        //
00042 // account the linear correlations between the input variables          //
00043 //                                                                      //
00044 //////////////////////////////////////////////////////////////////////////
00045 
00046 #ifndef ROOT_TMVA_MethodBase
00047 #include "TMVA/MethodBase.h"
00048 #endif
00049 #ifndef ROOT_TMVA_TMatrixDfwd
00050 #ifndef ROOT_TMatrixDfwd
00051 #include "TMatrixDfwd.h"
00052 #endif
00053 #endif
00054 #ifndef ROOT_TMVA_TVectorD
00055 #ifndef ROOT_TVectorD
00056 #include "TVectorD.h"
00057 #endif
00058 #endif
00059 
00060 namespace TMVA {
00061 
00062    class MethodHMatrix : public MethodBase {
00063 
00064    public:
00065 
00066       MethodHMatrix( const TString& jobName, 
00067                      const TString& methodTitle, 
00068                      DataSetInfo& theData,
00069                      const TString& theOption = "",
00070                      TDirectory* theTargetDir = 0 );
00071 
00072       MethodHMatrix( DataSetInfo& theData, 
00073                      const TString& theWeightFile,  
00074                      TDirectory* theTargetDir = NULL );
00075 
00076       virtual ~MethodHMatrix();
00077     
00078       virtual Bool_t HasAnalysisType( Types::EAnalysisType type, UInt_t numberClasses, UInt_t numberTargets );
00079 
00080       // training method
00081       void Train();
00082 
00083       using MethodBase::ReadWeightsFromStream;
00084 
00085       // write weights to file
00086       void AddWeightsXMLTo( void* parent ) const;
00087 
00088       // read weights from file
00089       void ReadWeightsFromStream( istream& istr );
00090       void ReadWeightsFromXML( void* wghtnode );
00091       // calculate the MVA value
00092       Double_t GetMvaValue( Double_t* err = 0, Double_t* errUpper = 0 );
00093 
00094       // ranking of input variables
00095       const Ranking* CreateRanking() { return 0; }
00096 
00097    protected:
00098 
00099       // make ROOT-independent C++ class for classifier response (classifier-specific implementation)
00100       void MakeClassSpecific( std::ostream&, const TString& ) const;
00101 
00102       // get help message text
00103       void GetHelpMessage() const;
00104 
00105    private:
00106 
00107       // the option handling methods
00108       void DeclareOptions();
00109       void ProcessOptions();
00110 
00111       // returns chi2 estimator for given type (signal or background)
00112       Double_t GetChi2( Event* e, Types::ESBType ) const;
00113       Double_t GetChi2( Types::ESBType ) const;
00114 
00115       // compute correlation matrices
00116       void     ComputeCovariance( Bool_t, TMatrixD* );
00117 
00118       // arrays of input evt vs. variable 
00119       TMatrixD* fInvHMatrixS; // inverse H-matrix (signal)
00120       TMatrixD* fInvHMatrixB; // inverse H-matrix (background)
00121       TVectorD* fVecMeanS;    // vector of mean values (signal)
00122       TVectorD* fVecMeanB;    // vector of mean values (background)
00123 
00124       // default initialisation method called by all constructors
00125       void Init(); 
00126 
00127       ClassDef(MethodHMatrix,0) // H-Matrix method, a simple comparison of chi-squared estimators for signal and background
00128    }; 
00129 
00130 } // namespace TMVA
00131 
00132 #endif

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