Logo ROOT   6.10/09
Reference Guide
VariableGaussTransform.h
Go to the documentation of this file.
1 // @(#)root/tmva $Id$
2 // Author: Andreas Hoecker, Joerg Stelzer, Helge Voss, Eckhard v. Toerne
3 
4 /**********************************************************************************
5  * Project: TMVA - a Root-integrated toolkit for multivariate data analysis *
6  * Package: TMVA *
7  * Class : VariableGaussTransform *
8  * Web : http://tmva.sourceforge.net *
9  * *
10  * Description: *
11  * Decorrelation of input variables *
12  * *
13  * Authors (alphabetical): *
14  * Andreas Hoecker <Andreas.Hocker@cern.ch> - CERN, Switzerland *
15  * Joerg Stelzer <Joerg.Stelzer@cern.ch> - CERN, Switzerland *
16  * Eckhard v. Toerne <evt@uni-bonn.de> - Uni Bonn, Germany *
17  * Helge Voss <Helge.Voss@cern.ch> - MPI-K Heidelberg, Germany *
18  * *
19  * Copyright (c) 2005: *
20  * CERN, Switzerland *
21  * U. of Victoria, Canada *
22  * MPI-K Heidelberg, Germany *
23  * *
24  * Redistribution and use in source and binary forms, with or without *
25  * modification, are permitted according to the terms listed in LICENSE *
26  * (http://tmva.sourceforge.net/LICENSE) *
27  **********************************************************************************/
28 
29 #ifndef ROOT_TMVA_VariableGaussTransform
30 #define ROOT_TMVA_VariableGaussTransform
31 
32 #include "TMVA/PDF.h"
33 
34 //////////////////////////////////////////////////////////////////////////
35 // //
36 // VariableGaussTransform //
37 // //
38 // Gaussian transformation of input variables. //
39 // //
40 //////////////////////////////////////////////////////////////////////////
41 
42 #include <vector>
43 
44 #include "TH1.h"
45 #include "TGraph.h"
46 #include "TSpline.h"
47 #include "TDirectory.h"
48 #include "Event.h"
49 
51 
52 namespace TMVA {
53 
54  class TMVAGaussPair {
55 
56  public:
57 
58  TMVAGaussPair( Float_t f, Float_t w ): fF(f), fW(w) {}
59  Bool_t operator > ( const TMVAGaussPair &p ) const { return fF > p.fF; }
60  Bool_t operator < ( const TMVAGaussPair &p ) const { return fF < p.fF; }
61  Bool_t operator == ( const TMVAGaussPair &p ) const { return fF == p.fF; }
62  Float_t GetValue() const { return fF; }
63  Float_t GetWeight() const { return fW; }
64 
65  private:
66 
67  Float_t fF; // the float
68  Float_t fW; // the event weight
69  };
70 
71 
73 
74  public:
75 
76  VariableGaussTransform( DataSetInfo& dsi, TString strcor="" );
77  virtual ~VariableGaussTransform( void );
78 
79  void Initialize();
80  Bool_t PrepareTransformation (const std::vector<Event*>&);
81 
82  virtual const Event* Transform(const Event* const, Int_t cls ) const;
83  virtual const Event* InverseTransform(const Event* const, Int_t cls ) const;
84 
85  void WriteTransformationToStream ( std::ostream& ) const;
86  void ReadTransformationFromStream( std::istream&, const TString& );
87 
88  virtual void AttachXMLTo(void* parent);
89  virtual void ReadFromXML( void* trfnode );
90 
91  virtual void PrintTransformation( std::ostream & o );
92 
93  // writer of function code
94  virtual void MakeFunction( std::ostream& fout, const TString& fncName, Int_t part, UInt_t trCounter, Int_t cls );
95 
96  private:
97 
101  // mutable Event* fTransformedEvent;
102 
103  std::vector< std::vector< TH1F* > > fCumulativeDist; //! The Cumulative distributions
104  //std::vector< std::vector< TGraph* > > fCumulativeGraph; //! The Cumulative distributions
105  //std::vector< std::vector< TSpline3* > > fCumulativeSpline; //! The Cumulative distributions
106  std::vector< std::vector< PDF*> > fCumulativePDF; // The cumulative PDF
107 
108  void GetCumulativeDist( const std::vector<Event*>& );
109  void CleanUpCumulativeArrays(TString opt = "ALL");
110 
111  // needed for backward compatibility
112  UInt_t fElementsperbin; // av number of events stored per bin in cum dist
113  Double_t OldCumulant(Float_t x, TH1* h ) const;
114 
115  ClassDef(VariableGaussTransform,0); // Variable transformation: Gauss transformation
116  };
117 
118 } // namespace TMVA
119 
120 #endif
float Float_t
Definition: RtypesCore.h:53
TH1 * h
Definition: legend2.C:5
Basic string class.
Definition: TString.h:129
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
Bool_t operator==(const TMVAGaussPair &p) const
Double_t x[n]
Definition: legend1.C:17
#define ClassDef(name, id)
Definition: Rtypes.h:297
Bool_t operator>(const TMVAGaussPair &p) const
Class that contains all the data information.
Definition: DataSetInfo.h:60
Linear interpolation class.
void Initialize(Bool_t useTMVAStyle=kTRUE)
Definition: tmvaglob.cxx:176
unsigned int UInt_t
Definition: RtypesCore.h:42
Gaussian Transformation of input variables.
Bool_t operator<(const TMVAGaussPair &p) const
double f(double x)
double Double_t
Definition: RtypesCore.h:55
The TH1 histogram class.
Definition: TH1.h:56
Abstract ClassifierFactory template that handles arbitrary types.
std::vector< std::vector< PDF * > > fCumulativePDF
The Cumulative distributions.
TMVAGaussPair(Float_t f, Float_t w)
std::vector< std::vector< TH1F *> > fCumulativeDist