Logo ROOT  
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
52namespace TMVA {
53
55
56 public:
57
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
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
#define f(i)
Definition: RSha256.hxx:104
#define h(i)
Definition: RSha256.hxx:106
double Double_t
Definition: RtypesCore.h:57
float Float_t
Definition: RtypesCore.h:55
#define ClassDef(name, id)
Definition: Rtypes.h:322
The TH1 histogram class.
Definition: TH1.h:56
Class that contains all the data information.
Definition: DataSetInfo.h:60
TMVAGaussPair(Float_t f, Float_t w)
Bool_t operator<(const TMVAGaussPair &p) const
Bool_t operator>(const TMVAGaussPair &p) const
Bool_t operator==(const TMVAGaussPair &p) const
Gaussian Transformation of input variables.
VariableGaussTransform(DataSetInfo &dsi, TString strcor="")
constructor can only be applied one after the other when they are created.
virtual void AttachXMLTo(void *parent)
create XML description of Gauss transformation
virtual void PrintTransformation(std::ostream &o)
prints the transformation
virtual void ReadFromXML(void *trfnode)
Read the transformation matrices from the xml node.
std::vector< std::vector< TH1F * > > fCumulativeDist
void WriteTransformationToStream(std::ostream &) const
virtual ~VariableGaussTransform(void)
destructor
virtual void MakeFunction(std::ostream &fout, const TString &fncName, Int_t part, UInt_t trCounter, Int_t cls)
creates the transformation function
void ReadTransformationFromStream(std::istream &, const TString &)
Read the cumulative distribution.
virtual const Event * InverseTransform(const Event *const, Int_t cls) const
apply the inverse Gauss or inverse uniform transformation
void GetCumulativeDist(const std::vector< Event * > &)
fill the cumulative distributions
std::vector< std::vector< PDF * > > fCumulativePDF
The Cumulative distributions.
void CleanUpCumulativeArrays(TString opt="ALL")
clean up of cumulative arrays
virtual const Event * Transform(const Event *const, Int_t cls) const
apply the Gauss transformation
Bool_t PrepareTransformation(const std::vector< Event * > &)
calculate the cumulative distributions
Double_t OldCumulant(Float_t x, TH1 *h) const
Linear interpolation class.
Basic string class.
Definition: TString.h:131
Double_t x[n]
Definition: legend1.C:17
create variable transformations