library: libTMVA #include "Reader.h" |
TMVA::Reader
class description - header file - source file - inheritance tree (.pdf)
private:
void DecodeVarNames(const string varNames)
void DecodeVarNames(const TString varNames)
void Init()
public:
Reader(vector<string>& varNames, Bool_t verbose = 0)
Reader(const string varNames, Bool_t verbose = 0)
Reader(vector<TString>& varNames, Bool_t verbose = 0)
Reader(const TString varNames, Bool_t verbose = 0)
Reader(const TMVA::Reader&)
virtual ~Reader()
Bool_t BookMVA(TMVA::Types::MVA method, TString filename)
static TClass* Class()
Double_t EvaluateMVA(vector<Double_t>&, TMVA::Types::MVA method, Double_t aux = 0)
virtual TClass* IsA() const
TMVA::Reader& operator=(const TMVA::Reader&)
void SetVerbose(Bool_t v)
virtual void ShowMembers(TMemberInspector& insp, char* parent)
virtual void Streamer(TBuffer& b)
void StreamerNVirtual(TBuffer& b)
Bool_t Verbose() const
private:
vector<TString>* fInputVars
vector<MethodBase*> fMethods
Bool_t fVerbose
_______________________________________________________________________
The Reader class serves to use the MVAs in a specific analysis context.
Within an event loop, a vector is filled that corresponds to the variables
that were used to train the MVA(s) during the training stage. This vector
is transfered to the Reader, who takes care of interpreting the weight
file of the MVA of choice, and to return the MVA's output. This is then
used by the user for further analysis.
---------------------------------------------------------------------
Usage:
// ------ before starting the event loop
// fill vector with variable names according to the definition and order
// used in the training stage
vector<string> inputVars;
inputVars.push_back( "var1" );
inputVars.push_back( "var2" );
inputVars.push_back( "var3" );
inputVars.push_back( "var4" );
// create the Reader object
Reader *reader = new TMVA_Reader( inputVars );
// book the MVA of your choice (prior training of these methods, ie,
// existence of weight files is required)
reader->BookMVA( TMVA_Types::Fisher, "weights/Fisher.weights" );
reader->BookMVA( TMVA_Types::CFMlpANN, "weights/CFMlpANN.weights" );
// ... etc
// ------- start the event loop
for (Long64_t ievt=0; ievt<myTree->GetEntries();ievt++) {
// fill vector with values of variables
vector<double> varValues;
varValues.push_back( var1 );
varValues.push_back( var2 );
varValues.push_back( var3 );
varValues.push_back( var4 );
// retrieve the corresponding MVA output
double mvaFi = reader->EvaluateMVA( varValues, TMVA_Types::Fisher );
double mvaNN = reader->EvaluateMVA( varValues, TMVA_Types::CFMlpANN );
// do something with these ...., e.g., fill them into your ntuple
} // end of event loop
delete reader;
---------------------------------------------------------------------
The example application of the Reader: "TMVApplication.cxx" can be found
in the ROOT tutorial directory.
_______________________________________________________________________
Reader( vector<TString>& inputVars, Bool_t verbose )
constructor
arguments: names of input variables (vector)
verbose flag
Reader( vector<string>& inputVars, Bool_t verbose )
constructor
arguments: names of input variables (vector)
verbose flag
Reader( const string varNames, Bool_t verbose )
constructor
arguments: names of input variables given in form: "name1:name2:name3"
verbose flag
Reader( const TString varNames, Bool_t verbose )
constructor
arguments: names of input variables given in form: "name1:name2:name3"
verbose flag
void Init( void )
default initialisation (no member variables)
void DecodeVarNames( const string varNames )
decodes "name1:name2:..." form
Last update: Tue Jul 11 11:56:39 2006
Copyright (c) 2005: *
ROOT page - Class index - Class Hierarchy - Top of the page
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.