#ifndef ROOT_TMVA_VariableTransformBase
#define ROOT_TMVA_VariableTransformBase
#include <vector>
#ifndef ROOT_TH1
#include "TH1.h"
#endif
#ifndef ROOT_TDirectory
#include "TDirectory.h"
#endif
#ifndef ROOT_TString
#include "TString.h"
#endif
#ifndef ROOT_TMVA_Types
#include "TMVA/Types.h"
#endif
#ifndef ROOT_TMVA_Event
#include "TMVA/Event.h"
#endif
#ifndef ROOT_TMVA_VariableInfo
#include "TMVA/VariableInfo.h"
#endif
#ifndef ROOT_TMVA_DataSetInfo
#include "TMVA/DataSetInfo.h"
#endif
namespace TMVA {
class VariableTransformBase : public TObject {
public:
typedef std::vector<std::pair<Char_t,UInt_t> > VectorOfCharAndInt;
typedef VectorOfCharAndInt::iterator ItVarTypeIdx;
typedef VectorOfCharAndInt::const_iterator ItVarTypeIdxConst;
VariableTransformBase( DataSetInfo& dsi, Types::EVariableTransform tf, const TString& trfName );
virtual ~VariableTransformBase( void );
virtual void Initialize() = 0;
virtual Bool_t PrepareTransformation (const std::vector<Event*>& ) = 0;
virtual const Event* Transform ( const Event* const, Int_t cls ) const = 0;
virtual const Event* InverseTransform( const Event* const, Int_t cls ) const = 0;
void SetEnabled ( Bool_t e ) { fEnabled = e; }
void SetNormalise( Bool_t n ) { fNormalise = n; }
Bool_t IsEnabled() const { return fEnabled; }
Bool_t IsCreated() const { return fCreated; }
Bool_t IsNormalised() const { return fNormalise; }
virtual void SelectInput( const TString& inputVariables, Bool_t putIntoVariables = kFALSE );
virtual Bool_t GetInput ( const Event* event, std::vector<Float_t>& input, std::vector<Char_t>& mask, Bool_t backTransform = kFALSE ) const;
virtual void SetOutput( Event* event, std::vector<Float_t>& output, std::vector<Char_t>& mask, const Event* oldEvent = 0, Bool_t backTransform = kFALSE ) const;
virtual void CountVariableTypes( UInt_t& nvars, UInt_t& ntgts, UInt_t& nspcts ) const;
void ToggleInputSortOrder( Bool_t sortOrder ) { fSortGet = sortOrder; }
void SetOutputDataSetInfo( DataSetInfo* outputDsi ) { fDsiOutput = outputDsi; }
void SetUseSignalTransform( Bool_t e=kTRUE) { fUseSignalTransform = e; }
Bool_t UseSignalTransform() const { return fUseSignalTransform; }
virtual const char* GetName() const { return fTransformName.Data(); }
TString GetShortName() const { TString a(fTransformName); a.ReplaceAll("Transform",""); return a; }
virtual void WriteTransformationToStream ( std::ostream& o ) const = 0;
virtual void ReadTransformationFromStream( std::istream& istr, const TString& classname="" ) = 0;
virtual void AttachXMLTo(void* parent) = 0;
virtual void ReadFromXML( void* trfnode ) = 0;
Types::EVariableTransform GetVariableTransform() const { return fVariableTransform; }
virtual void MakeFunction( std::ostream& fout, const TString& fncName, Int_t part,
UInt_t trCounter, Int_t cls ) = 0;
virtual std::vector<TString>* GetTransformationStrings( Int_t cls ) const;
virtual void PrintTransformation( std::ostream & ) {}
const std::vector<TMVA::VariableInfo>& Variables() const { return fVariables; }
const std::vector<TMVA::VariableInfo>& Targets() const { return fTargets; }
const std::vector<TMVA::VariableInfo>& Spectators() const { return fSpectators; }
MsgLogger& Log() const { return *fLogger; }
void SetTMVAVersion(TMVAVersion_t v) { fTMVAVersion = v; }
protected:
void CalcNorm( const std::vector<const Event*>& );
void SetCreated( Bool_t c = kTRUE ) { fCreated = c; }
void SetNVariables( UInt_t i ) { fNVars = i; }
void SetName( const TString& c ) { fTransformName = c; }
UInt_t GetNVariables() const { return fDsi.GetNVariables(); }
UInt_t GetNTargets() const { return fDsi.GetNTargets(); }
UInt_t GetNSpectators() const { return fDsi.GetNSpectators(); }
DataSetInfo& fDsi;
DataSetInfo* fDsiOutput;
std::vector<TMVA::VariableInfo>& Variables() { return fVariables; }
std::vector<TMVA::VariableInfo>& Targets() { return fTargets; }
std::vector<TMVA::VariableInfo>& Spectators() { return fSpectators; }
Int_t GetNClasses() const { return fDsi.GetNClasses(); }
mutable Event* fTransformedEvent;
mutable Event* fBackTransformedEvent;
VectorOfCharAndInt fGet;
VectorOfCharAndInt fPut;
private:
Types::EVariableTransform fVariableTransform;
void UpdateNorm( Int_t ivar, Double_t x );
Bool_t fUseSignalTransform;
Bool_t fEnabled;
Bool_t fCreated;
Bool_t fNormalise;
UInt_t fNVars;
TString fTransformName;
std::vector<TMVA::VariableInfo> fVariables;
std::vector<TMVA::VariableInfo> fTargets;
std::vector<TMVA::VariableInfo> fSpectators;
mutable Bool_t fVariableTypesAreCounted;
mutable UInt_t fNVariables;
mutable UInt_t fNTargets;
mutable UInt_t fNSpectators;
Bool_t fSortGet;
protected:
TMVAVersion_t fTMVAVersion;
mutable MsgLogger* fLogger;
ClassDef(VariableTransformBase,0)
};
}
#endif
VariableTransformBase.h:1 VariableTransformBase.h:2 VariableTransformBase.h:3 VariableTransformBase.h:4 VariableTransformBase.h:5 VariableTransformBase.h:6 VariableTransformBase.h:7 VariableTransformBase.h:8 VariableTransformBase.h:9 VariableTransformBase.h:10 VariableTransformBase.h:11 VariableTransformBase.h:12 VariableTransformBase.h:13 VariableTransformBase.h:14 VariableTransformBase.h:15 VariableTransformBase.h:16 VariableTransformBase.h:17 VariableTransformBase.h:18 VariableTransformBase.h:19 VariableTransformBase.h:20 VariableTransformBase.h:21 VariableTransformBase.h:22 VariableTransformBase.h:23 VariableTransformBase.h:24 VariableTransformBase.h:25 VariableTransformBase.h:26 VariableTransformBase.h:27 VariableTransformBase.h:28 VariableTransformBase.h:29 VariableTransformBase.h:30 VariableTransformBase.h:31 VariableTransformBase.h:32 VariableTransformBase.h:33 VariableTransformBase.h:34 VariableTransformBase.h:35 VariableTransformBase.h:36 VariableTransformBase.h:37 VariableTransformBase.h:38 VariableTransformBase.h:39 VariableTransformBase.h:40 VariableTransformBase.h:41 VariableTransformBase.h:42 VariableTransformBase.h:43 VariableTransformBase.h:44 VariableTransformBase.h:45 VariableTransformBase.h:46 VariableTransformBase.h:47 VariableTransformBase.h:48 VariableTransformBase.h:49 VariableTransformBase.h:50 VariableTransformBase.h:51 VariableTransformBase.h:52 VariableTransformBase.h:53 VariableTransformBase.h:54 VariableTransformBase.h:55 VariableTransformBase.h:56 VariableTransformBase.h:57 VariableTransformBase.h:58 VariableTransformBase.h:59 VariableTransformBase.h:60 VariableTransformBase.h:61 VariableTransformBase.h:62 VariableTransformBase.h:63 VariableTransformBase.h:64 VariableTransformBase.h:65 VariableTransformBase.h:66 VariableTransformBase.h:67 VariableTransformBase.h:68 VariableTransformBase.h:69 VariableTransformBase.h:70 VariableTransformBase.h:71 VariableTransformBase.h:72 VariableTransformBase.h:73 VariableTransformBase.h:74 VariableTransformBase.h:75 VariableTransformBase.h:76 VariableTransformBase.h:77 VariableTransformBase.h:78 VariableTransformBase.h:79 VariableTransformBase.h:80 VariableTransformBase.h:81 VariableTransformBase.h:82 VariableTransformBase.h:83 VariableTransformBase.h:84 VariableTransformBase.h:85 VariableTransformBase.h:86 VariableTransformBase.h:87 VariableTransformBase.h:88 VariableTransformBase.h:89 VariableTransformBase.h:90 VariableTransformBase.h:91 VariableTransformBase.h:92 VariableTransformBase.h:93 VariableTransformBase.h:94 VariableTransformBase.h:95 VariableTransformBase.h:96 VariableTransformBase.h:97 VariableTransformBase.h:98 VariableTransformBase.h:99 VariableTransformBase.h:100 VariableTransformBase.h:101 VariableTransformBase.h:102 VariableTransformBase.h:103 VariableTransformBase.h:104 VariableTransformBase.h:105 VariableTransformBase.h:106 VariableTransformBase.h:107 VariableTransformBase.h:108 VariableTransformBase.h:109 VariableTransformBase.h:110 VariableTransformBase.h:111 VariableTransformBase.h:112 VariableTransformBase.h:113 VariableTransformBase.h:114 VariableTransformBase.h:115 VariableTransformBase.h:116 VariableTransformBase.h:117 VariableTransformBase.h:118 VariableTransformBase.h:119 VariableTransformBase.h:120 VariableTransformBase.h:121 VariableTransformBase.h:122 VariableTransformBase.h:123 VariableTransformBase.h:124 VariableTransformBase.h:125 VariableTransformBase.h:126 VariableTransformBase.h:127 VariableTransformBase.h:128 VariableTransformBase.h:129 VariableTransformBase.h:130 VariableTransformBase.h:131 VariableTransformBase.h:132 VariableTransformBase.h:133 VariableTransformBase.h:134 VariableTransformBase.h:135 VariableTransformBase.h:136 VariableTransformBase.h:137 VariableTransformBase.h:138 VariableTransformBase.h:139 VariableTransformBase.h:140 VariableTransformBase.h:141 VariableTransformBase.h:142 VariableTransformBase.h:143 VariableTransformBase.h:144 VariableTransformBase.h:145 VariableTransformBase.h:146 VariableTransformBase.h:147 VariableTransformBase.h:148 VariableTransformBase.h:149 VariableTransformBase.h:150 VariableTransformBase.h:151 VariableTransformBase.h:152 VariableTransformBase.h:153 VariableTransformBase.h:154 VariableTransformBase.h:155 VariableTransformBase.h:156 VariableTransformBase.h:157 VariableTransformBase.h:158 VariableTransformBase.h:159 VariableTransformBase.h:160 VariableTransformBase.h:161 VariableTransformBase.h:162 VariableTransformBase.h:163 VariableTransformBase.h:164 VariableTransformBase.h:165 VariableTransformBase.h:166 VariableTransformBase.h:167 VariableTransformBase.h:168 VariableTransformBase.h:169 VariableTransformBase.h:170 VariableTransformBase.h:171 VariableTransformBase.h:172 VariableTransformBase.h:173 VariableTransformBase.h:174 VariableTransformBase.h:175 VariableTransformBase.h:176 VariableTransformBase.h:177 VariableTransformBase.h:178 VariableTransformBase.h:179 VariableTransformBase.h:180 VariableTransformBase.h:181 VariableTransformBase.h:182 VariableTransformBase.h:183 VariableTransformBase.h:184 VariableTransformBase.h:185 VariableTransformBase.h:186 VariableTransformBase.h:187 VariableTransformBase.h:188 VariableTransformBase.h:189 VariableTransformBase.h:190 VariableTransformBase.h:191 VariableTransformBase.h:192 VariableTransformBase.h:193 VariableTransformBase.h:194