VariableInfo.h

Go to the documentation of this file.
00001 // @(#)root/tmva $Id: VariableInfo.h 29122 2009-06-22 06:51:30Z brun $   
00002 // Author: Andreas Hoecker, Joerg Stelzer, Helge Voss
00003 
00004 /**********************************************************************************
00005  * Project: TMVA - a Root-integrated toolkit for multivariate data analysis       *
00006  * Package: TMVA                                                                  *
00007  * Class  : Option                                                                *
00008  * Web    : http://tmva.sourceforge.net                                           *
00009  *                                                                                *
00010  * Description:                                                                   *
00011  *      Variable type info                                                        *
00012  *                                                                                *
00013  * Authors (alphabetical):                                                        *
00014  *      Andreas Hoecker <Andreas.Hocker@cern.ch> - CERN, Switzerland              *
00015  *      Joerg Stelzer   <Joerg.Stelzer@cern.ch>  - CERN, Switzerland              *
00016  *      Helge Voss      <Helge.Voss@cern.ch>     - MPI-K Heidelberg, Germany      *
00017  *                                                                                *
00018  * Copyright (c) 2006:                                                            *
00019  *      CERN, Switzerland                                                         * 
00020  *      U. of Victoria, Canada                                                    * 
00021  *      MPI-K Heidelberg, Germany                                                 * 
00022  *      LAPP, Annecy, France                                                      *
00023  *                                                                                *
00024  * Redistribution and use in source and binary forms, with or without             *
00025  * modification, are permitted according to the terms listed in LICENSE           *
00026  * (http://mva.sourceforge.net/license.txt)                                       *
00027  **********************************************************************************/
00028 
00029 #ifndef ROOT_TMVA_VariableInfo
00030 #define ROOT_TMVA_VariableInfo
00031 
00032 //////////////////////////////////////////////////////////////////////////
00033 //                                                                      //
00034 // VariableInfo                                                         //
00035 //                                                                      //
00036 // Class for type info of MVA input variable                            //
00037 //                                                                      //
00038 //////////////////////////////////////////////////////////////////////////
00039 
00040 #ifndef ROOT_Rtypes
00041 #include "Rtypes.h"
00042 #endif
00043 #ifndef ROOT_TString
00044 #include "TString.h"
00045 #endif
00046 #ifndef ROOT_TMVA_Types
00047 #include "TMVA/Types.h"
00048 #endif
00049 
00050 namespace TMVA {
00051 
00052    class VariableInfo {
00053       
00054    public:
00055       
00056       VariableInfo( const TString& expression, const TString& title, const TString& unit, 
00057                     Int_t varCounter, char varType = 'F', void* external = 0,
00058                     Double_t min = 0, Double_t max = 0, Bool_t normalized=kTRUE );
00059       VariableInfo();
00060       VariableInfo( const VariableInfo& other );
00061       ~VariableInfo() {}
00062       const TString& GetExpression()       const { return fExpression; }
00063       const TString& GetInternalName()     const { return fInternalName; }
00064       const TString& GetLabel()            const { return fLabel; }
00065       const TString& GetTitle()            const { return fTitle; }
00066       const TString& GetUnit()             const { return fUnit; }
00067       char           GetVarType()          const { return fVarType; }
00068 
00069       Double_t       GetMin () const { return fXminNorm; }
00070       Double_t       GetMax () const { return fXmaxNorm; }
00071       Double_t       GetMean() const { return fXmeanNorm; }
00072       Double_t       GetRMS () const { return fXrmsNorm; }
00073 
00074       void           SetMin         ( Double_t v ) { fXminNorm     = v; }
00075       void           SetMax         ( Double_t v ) { fXmaxNorm     = v; }
00076       void           SetMean        ( Double_t v ) { fXmeanNorm    = v; }
00077       void           SetRMS         ( Double_t v ) { fXrmsNorm     = v; }
00078       void           SetExternalLink( void* p    ) { fExternalData = p; }
00079       void           ResetMinMax() { fXminNorm = 1e30; fXmaxNorm = -1e30; }
00080 
00081       void           WriteToStream ( std::ostream& o ) const;
00082       void           ReadFromStream( std::istream& istr );
00083       void           ReadFromXML   ( void* varnode );
00084       void           AddToXML      ( void* varnode );
00085       void*          GetExternalLink() const { return fExternalData; }
00086 
00087       // assignment operator (does not copy external link)
00088       VariableInfo&  operator=(const TMVA::VariableInfo& rhs);
00089 
00090    private:
00091 
00092       // should not be set from outside this class
00093       void           SetExpression     ( const TString& s ) { fExpression = s; }
00094       void           SetLabel          ( const TString& s ) { fLabel = s; }
00095       void           SetTitle          ( const TString& s ) { fTitle = s; }
00096       void           SetUnit           ( const TString& s ) { fUnit  = s; }
00097       void           SetInternalVarName( const TString& s ) { fInternalName = s; }
00098       void           SetVarType        ( char c )           { fVarType = c; }
00099 
00100       TString  fExpression;      //! original variable expression (can be a formula)
00101       TString  fInternalName;    //! internal variable name (needs to be regular expression)
00102       TString  fLabel;           //! variable label, set by "mylabel := var1 + var2", this is a shortcut
00103       TString  fTitle;           //! title for axis labels in plots; set by second string in AddVariable
00104       TString  fUnit;            //! unit for axis labels in plots; set by third string in AddVariable
00105       Char_t   fVarType;         //! the variable type to be used internally ('F'-default or 'I')
00106       Double_t fXminNorm;        //! minimum value for correlated/decorrelated/PCA variable
00107       Double_t fXmaxNorm;        //! maximum value for correlated/decorrelated/PCA variable
00108       Double_t fXmeanNorm;       //! mean value for correlated/decorrelated/PCA variable
00109       Double_t fXrmsNorm;        //! rms value for correlated/decorrelated/PCA variable
00110       Bool_t   fNormalized;      //! variable gets normalized
00111       void*    fExternalData;    //! if the variable content is linked to an external pointer      
00112       TString  fExternalDataType;//! type of external variable (int, long, double, float) - to be done JS
00113       Int_t    fVarCounter;      //! dummy variable
00114    };
00115 
00116 }
00117 
00118 #endif

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