// @(#)root/tmva $Id$
// Author: Andreas Hoecker, Joerg Stelzer, Helge Voss

/**********************************************************************************
 * Project: TMVA - a Root-integrated toolkit for multivariate data analysis       *
 * Package: TMVA                                                                  *
 * Class  : VariableNormalizeTransform                                            *
 * Web    : http://tmva.sourceforge.net                                           *
 *                                                                                *
 * Description:                                                                   *
 *      Decorrelation of input variables                                          *
 *                                                                                *
 * Authors (alphabetical):                                                        *
 *      Andreas Hoecker <Andreas.Hocker@cern.ch> - CERN, Switzerland              *
 *      Peter Speckmayer <Peter.Speckmayer@cern.ch>  - CERN, Switzerland          *
 *      Joerg Stelzer   <Joerg.Stelzer@cern.ch>  - CERN, Switzerland              *
 *      Helge Voss      <Helge.Voss@cern.ch>     - MPI-K Heidelberg, Germany      *
 *                                                                                *
 * Copyright (c) 2005:                                                            *
 *      CERN, Switzerland                                                         *
 *      U. of Victoria, Canada                                                    *
 *      MPI-K Heidelberg, Germany                                                 *
 *                                                                                *
 * Redistribution and use in source and binary forms, with or without             *
 * modification, are permitted according to the terms listed in LICENSE           *
 * (http://tmva.sourceforge.net/LICENSE)                                          *
 **********************************************************************************/

#ifndef ROOT_TMVA_VariableNormalizeTransform
#define ROOT_TMVA_VariableNormalizeTransform

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// VariableNormalizeTransform                                           //
//                                                                      //
// Linear interpolation class                                           //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifndef ROOT_TMatrixDfwd
#include "TMatrixDfwd.h"
#endif

#ifndef ROOT_TMVA_VariableTransformBase
#include "TMVA/VariableTransformBase.h"
#endif

namespace TMVA {

   class VariableNormalizeTransform : public VariableTransformBase {

   public:
  
      typedef std::vector<Float_t>       FloatVector;
      typedef std::vector< FloatVector > VectorOfFloatVectors;
      VariableNormalizeTransform( DataSetInfo& dsi );
      virtual ~VariableNormalizeTransform( void );

      void   Initialize();
      Bool_t PrepareTransformation (const std::vector<Event*>&);

      virtual const Event* Transform(const Event* const, Int_t cls ) const;
      virtual const Event* InverseTransform( const Event* const, Int_t cls ) const;

      void WriteTransformationToStream ( std::ostream& ) const;
      void ReadTransformationFromStream( std::istream&, const TString& );
      void BuildTransformationFromVarInfo( const std::vector<TMVA::VariableInfo>& var );

      virtual void AttachXMLTo(void* parent);
      virtual void ReadFromXML( void* trfnode );

      virtual void PrintTransformation( std::ostream & o );

      // writer of function code
      virtual void MakeFunction( std::ostream& fout, const TString& fncName, Int_t part, UInt_t trCounter, Int_t cls );

      // provides string vector giving explicit transformation
      std::vector<TString>* GetTransformationStrings( Int_t cls ) const;

   private:

      void CalcNormalizationParams( const std::vector< Event*>& events);

      //      mutable Event*           fTransformedEvent;

      VectorOfFloatVectors                   fMin;       //! Min of source range
      VectorOfFloatVectors                   fMax;       //! Max of source range

      ClassDef(VariableNormalizeTransform,0) // Variable transformation: normalization
   };

} // namespace TMVA

#endif 
 VariableNormalizeTransform.h:1
 VariableNormalizeTransform.h:2
 VariableNormalizeTransform.h:3
 VariableNormalizeTransform.h:4
 VariableNormalizeTransform.h:5
 VariableNormalizeTransform.h:6
 VariableNormalizeTransform.h:7
 VariableNormalizeTransform.h:8
 VariableNormalizeTransform.h:9
 VariableNormalizeTransform.h:10
 VariableNormalizeTransform.h:11
 VariableNormalizeTransform.h:12
 VariableNormalizeTransform.h:13
 VariableNormalizeTransform.h:14
 VariableNormalizeTransform.h:15
 VariableNormalizeTransform.h:16
 VariableNormalizeTransform.h:17
 VariableNormalizeTransform.h:18
 VariableNormalizeTransform.h:19
 VariableNormalizeTransform.h:20
 VariableNormalizeTransform.h:21
 VariableNormalizeTransform.h:22
 VariableNormalizeTransform.h:23
 VariableNormalizeTransform.h:24
 VariableNormalizeTransform.h:25
 VariableNormalizeTransform.h:26
 VariableNormalizeTransform.h:27
 VariableNormalizeTransform.h:28
 VariableNormalizeTransform.h:29
 VariableNormalizeTransform.h:30
 VariableNormalizeTransform.h:31
 VariableNormalizeTransform.h:32
 VariableNormalizeTransform.h:33
 VariableNormalizeTransform.h:34
 VariableNormalizeTransform.h:35
 VariableNormalizeTransform.h:36
 VariableNormalizeTransform.h:37
 VariableNormalizeTransform.h:38
 VariableNormalizeTransform.h:39
 VariableNormalizeTransform.h:40
 VariableNormalizeTransform.h:41
 VariableNormalizeTransform.h:42
 VariableNormalizeTransform.h:43
 VariableNormalizeTransform.h:44
 VariableNormalizeTransform.h:45
 VariableNormalizeTransform.h:46
 VariableNormalizeTransform.h:47
 VariableNormalizeTransform.h:48
 VariableNormalizeTransform.h:49
 VariableNormalizeTransform.h:50
 VariableNormalizeTransform.h:51
 VariableNormalizeTransform.h:52
 VariableNormalizeTransform.h:53
 VariableNormalizeTransform.h:54
 VariableNormalizeTransform.h:55
 VariableNormalizeTransform.h:56
 VariableNormalizeTransform.h:57
 VariableNormalizeTransform.h:58
 VariableNormalizeTransform.h:59
 VariableNormalizeTransform.h:60
 VariableNormalizeTransform.h:61
 VariableNormalizeTransform.h:62
 VariableNormalizeTransform.h:63
 VariableNormalizeTransform.h:64
 VariableNormalizeTransform.h:65
 VariableNormalizeTransform.h:66
 VariableNormalizeTransform.h:67
 VariableNormalizeTransform.h:68
 VariableNormalizeTransform.h:69
 VariableNormalizeTransform.h:70
 VariableNormalizeTransform.h:71
 VariableNormalizeTransform.h:72
 VariableNormalizeTransform.h:73
 VariableNormalizeTransform.h:74
 VariableNormalizeTransform.h:75
 VariableNormalizeTransform.h:76
 VariableNormalizeTransform.h:77
 VariableNormalizeTransform.h:78
 VariableNormalizeTransform.h:79
 VariableNormalizeTransform.h:80
 VariableNormalizeTransform.h:81
 VariableNormalizeTransform.h:82
 VariableNormalizeTransform.h:83
 VariableNormalizeTransform.h:84
 VariableNormalizeTransform.h:85
 VariableNormalizeTransform.h:86
 VariableNormalizeTransform.h:87
 VariableNormalizeTransform.h:88
 VariableNormalizeTransform.h:89
 VariableNormalizeTransform.h:90
 VariableNormalizeTransform.h:91
 VariableNormalizeTransform.h:92
 VariableNormalizeTransform.h:93
 VariableNormalizeTransform.h:94