Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // @(#)root/tmva $Id$
0002 // Author: Andreas Hoecker, Joerg Stelzer, Helge Voss
0003 
0004 /**********************************************************************************
0005  * Project: TMVA - a Root-integrated toolkit for multivariate data analysis       *
0006  * Package: TMVA                                                                  *
0007  * Class  : VariablePCATransform                                                  *
0008  *                                             *
0009  *                                                                                *
0010  * Description:                                                                   *
0011  *      Principal value composition of input variables                            *
0012  *                                                                                *
0013  * Authors (alphabetical):                                                        *
0014  *      Andreas Hoecker <Andreas.Hocker@cern.ch> - CERN, Switzerland              *
0015  *      Peter Speckmayer <Peter.Speckmayer@cern.ch> - CERN, Switzerland           *
0016  *      Joerg Stelzer   <Joerg.Stelzer@cern.ch>  - CERN, Switzerland              *
0017  *      Helge Voss      <Helge.Voss@cern.ch>     - MPI-K Heidelberg, Germany      *
0018  *                                                                                *
0019  * Copyright (c) 2005:                                                            *
0020  *      CERN, Switzerland                                                         *
0021  *      U. of Victoria, Canada                                                    *
0022  *      MPI-K Heidelberg, Germany                                                 *
0023  *                                                                                *
0024  * Redistribution and use in source and binary forms, with or without             *
0025  * modification, are permitted according to the terms listed in LICENSE           *
0026  * (see tmva/doc/LICENSE)                                          *
0027  **********************************************************************************/
0028 
0029 #ifndef ROOT_TMVA_VariablePCATransform
0030 #define ROOT_TMVA_VariablePCATransform
0031 
0032 //////////////////////////////////////////////////////////////////////////
0033 //                                                                      //
0034 // VariablePCATransform                                                 //
0035 //                                                                      //
0036 // Linear interpolation class                                           //
0037 //                                                                      //
0038 //////////////////////////////////////////////////////////////////////////
0039 
0040 #include "TPrincipal.h"
0041 
0042 #include "TMVA/VariableTransformBase.h"
0043 
0044 #include <vector>
0045 
0046 namespace TMVA {
0047 
0048    class VariablePCATransform : public VariableTransformBase {
0049 
0050    public:
0051 
0052       VariablePCATransform( DataSetInfo& dsi );
0053       virtual ~VariablePCATransform( void );
0054 
0055       void   Initialize();
0056       Bool_t PrepareTransformation (const std::vector<Event*>&);
0057 
0058       virtual const Event* Transform(const Event* const, Int_t cls ) const;
0059       virtual const Event* InverseTransform(const Event* const, Int_t cls ) const;
0060 
0061       void WriteTransformationToStream ( std::ostream& ) const;
0062       void ReadTransformationFromStream( std::istream&, const TString& );
0063 
0064       virtual void AttachXMLTo(void* parent);
0065       virtual void ReadFromXML( void* trfnode );
0066 
0067       // writer of function code
0068       virtual void MakeFunction( std::ostream& fout, const TString& fncName, Int_t part, UInt_t trCounter, Int_t cls );
0069 
0070    private:
0071 
0072       void CalculatePrincipalComponents( const std::vector< Event*>& );
0073       void X2P( std::vector<Float_t>&, const std::vector<Float_t>&, Int_t cls ) const;
0074       void P2X( std::vector<Float_t>&, const std::vector<Float_t>&, Int_t cls ) const;
0075 
0076       // store relevant parts of PCA locally
0077       std::vector<TVectorD*> fMeanValues;   ///< mean values
0078       std::vector<TMatrixD*> fEigenVectors; ///< eigenvectors
0079 
0080       ClassDef(VariablePCATransform,0); // Variable transformation: Principal Value Composition
0081    };
0082 
0083 } // namespace TMVA
0084 
0085 #endif
0086