class TMVA::Reader: public TMVA::Configurable


  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 (eg, in the initialisation step)


    // create TMVA::Reader object

    TMVA::Reader *reader = new TMVA::Reader();

    // create a set of variables and declare them to the reader
    // - the variable names must corresponds in name and type to
    // those given in the weight file(s) that you use
    Float_t var1, var2, var3, var4;
    reader->AddVariable( "var1", &var1 );
    reader->AddVariable( "var2", &var2 );
    reader->AddVariable( "var3", &var3 );
    reader->AddVariable( "var4", &var4 );

    // book the MVA of your choice (prior training of these methods, ie,
    // existence of the weight files is required)
    reader->BookMVA( "Fisher method",  "weights/Fisher.weights.txt"   );
    reader->BookMVA( "MLP method",     "weights/MLP.weights.txt" );
    // ... etc

    // ------- start your event loop

    for (Long64_t ievt=0; ievt<myTree->GetEntries();ievt++) {

      // fill vector with values of variables computed from those in the tree
      var1 = myvar1;
      var2 = myvar2;
      var3 = myvar3;
      var4 = myvar4;

      // retrieve the corresponding MVA output
      double mvaFi = reader->EvaluateMVA( "Fisher method" );
      double mvaNN = reader->EvaluateMVA( "MLP method"    );

      // do something with these ...., e.g., fill them into your ntuple

    } // end of event loop

    delete reader;


  An example application of the Reader can be found in TMVA/macros/TMVApplication.C.

Function Members (Methods)

public:
virtual~Reader()
voidTObject::AbstractMethod(const char* method) const
voidAddVariable(const TString& expression, Float_t*)
voidAddVariable(const TString& expression, Int_t*)
virtual voidTObject::AppendPad(Option_t* option = "")
TMVA::IMethod*BookMVA(const TString& methodTag, const TString& weightfile)
virtual voidTObject::Browse(TBrowser* b)
voidTMVA::Configurable::CheckForUnusedOptions() const
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidTObject::Clear(Option_t* = "")
virtual TObject*TObject::Clone(const char* newname = "") const
virtual Int_tTObject::Compare(const TObject* obj) const
TMVA::ConfigurableTMVA::Configurable::Configurable(const TString& theOption = "")
virtual voidTObject::Copy(TObject& object) const
const TMVA::DataSet&Data() const
TMVA::DataSet&Data()
virtual voidTObject::Delete(Option_t* option = "")MENU
virtual Int_tTObject::DistancetoPrimitive(Int_t px, Int_t py)
virtual voidTObject::Draw(Option_t* option = "")
virtual voidTObject::DrawClass() constMENU
virtual TObject*TObject::DrawClone(Option_t* option = "") constMENU
virtual voidTObject::Dump() constMENU
virtual voidTObject::Error(const char* method, const char* msgfmt) const
Double_tEvaluateMVA(TMVA::MethodBase* method, Double_t aux = 0)
Double_tEvaluateMVA(const TString& methodTag, Double_t aux = 0)
Double_tEvaluateMVA(const vector<Float_t>&, const TString& methodTag, Double_t aux = 0)
Double_tEvaluateMVA(const vector<Double_t>&, const TString& methodTag, Double_t aux = 0)
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidTObject::ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
TMVA::IMethod*FindMVA(const TString& methodTag)
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
const char*TMVA::Configurable::GetConfigDescription() const
const char*TMVA::Configurable::GetConfigName() const
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
virtual const char*TObject::GetIconName() const
virtual const char*GetName() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
const TString&TMVA::Configurable::GetOptions() const
Double_tGetProba(const TString& methodTag, Double_t ap_sig = 0.5, Double_t mvaVal = -9999999)
Double_tGetRarity(const TString& methodTag, Double_t mvaVal = -9999999)
virtual const char*TObject::GetTitle() const
virtual UInt_tTObject::GetUniqueID() const
const TString&GetVarName(Int_t ivar)
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTObject::Hash() const
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
virtual voidTObject::Inspect() constMENU
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tTObject::IsFolder() const
Bool_tTObject::IsOnHeap() const
virtual Bool_tTObject::IsSortable() const
Bool_tTObject::IsZombie() const
virtual voidTObject::ls(Option_t* option = "") const
voidTObject::MayNotUse(const char* method) const
virtual Bool_tTObject::Notify()
static voidTObject::operator delete(void* ptr)
static voidTObject::operator delete(void* ptr, void* vp)
static voidTObject::operator delete[](void* ptr)
static voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
TObject&TObject::operator=(const TObject& rhs)
virtual voidTObject::Paint(Option_t* option = "")
voidTMVA::Configurable::ParseOptions(Bool_t verbose = kTRUE)
virtual voidTObject::Pop()
virtual voidTObject::Print(Option_t* option = "") const
voidTMVA::Configurable::PrintOptions() const
virtual Int_tTObject::Read(const char* name)
TMVA::ReaderReader(TString theOption = "", Bool_t verbose = 0)
TMVA::ReaderReader(vector<std::string>& varNames, TString theOption = "", Bool_t verbose = 0)
TMVA::ReaderReader(const string varNames, TString theOption, Bool_t verbose = 0)
TMVA::ReaderReader(vector<TString>& varNames, TString theOption = "", Bool_t verbose = 0)
TMVA::ReaderReader(const TString varNames, TString theOption, Bool_t verbose = 0)
virtual voidTObject::RecursiveRemove(TObject* obj)
voidTObject::ResetBit(UInt_t f)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU
virtual voidTObject::SavePrimitive(basic_ostream<char,char_traits<char> >& out, Option_t* option = "")
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
voidTMVA::Configurable::SetConfigDescription(const char* d)
voidTMVA::Configurable::SetConfigName(const char* n)
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
static voidTObject::SetObjectStat(Bool_t stat)
voidTMVA::Configurable::SetOptions(const TString& s)
virtual voidTObject::SetUniqueID(UInt_t uid)
voidSetVerbose(Bool_t v)
virtual voidShowMembers(TMemberInspector& insp, char* parent)
virtual voidStreamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
virtual voidTObject::UseCurrentStyle()
Bool_tVerbose() const
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const
protected:
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
voidTMVA::Configurable::EnableLooseOptions(Bool_t b = kTRUE)
const TString&TMVA::Configurable::GetReferenceFile() const
Bool_tTMVA::Configurable::LooseOptionCheckingEnabled() const
voidTObject::MakeZombie()
voidTMVA::Configurable::ReadOptionsFromStream(istream& istr)
voidTMVA::Configurable::ResetSetFlag()
voidTMVA::Configurable::WriteOptionsReferenceToFile()
voidTMVA::Configurable::WriteOptionsToStream(ostream& o, const TString& prefix) const
private:
TMVA::IMethod*BookMVA(TMVA::Types::EMVA method, TString weightfile)
voidDeclareOptions()
voidDecodeVarNames(const string varNames)
voidDecodeVarNames(const TString varNames)
voidGetMethodNameTitle(const TString& weightfile, TString& methodName, TString& methodTitle)
voidInit()

Data Members

public:
enum TObject::EStatusBits { kCanDelete
kMustCleanup
kObjInCanvas
kIsReferenced
kHasUUID
kCannotPick
kNoContextMenu
kInvalidObject
};
enum TObject::[unnamed] { kIsOnHeap
kNotDeleted
kZombie
kBitMask
kSingleKey
kOverwrite
kWriteDelete
};
public:
TMVA::MsgLoggerTMVA::Configurable::fLoggermessage logger
private:
TMVA::DataSet*fDataSetthe data set
TMVA::MsgLoggerfLoggermessage logger
map<TString,IMethod*>fMethodMapmap of methods
Bool_tfVerboseverbosity

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

Reader(TString theOption = "", Bool_t verbose = 0)
 constructor
Reader( vector<TString>& inputVars, TString theOption, Bool_t verbose )
 constructor
Reader( vector<string>& inputVars, TString theOption, Bool_t verbose )
 constructor
Reader( const string varNames, TString theOption, Bool_t verbose )
 constructor
Reader( const TString varNames, TString theOption, Bool_t verbose )
 constructor
void DeclareOptions()
 declaration of configuration options
~Reader()
 destructor
 the data set
void Init( void )
 default initialisation (no member variables)
void AddVariable( const TString& expression, Float_t* datalink )
 Add a float variable or expression to the reader
void AddVariable( const TString& expression, Int_t* datalink )
 Add a integer variable or expression to the reader
TMVA::IMethod* BookMVA( const TString& methodTag, const TString& weightfile )
 read method name from weight file
TMVA::IMethod* BookMVA( TMVA::Types::EMVA methodType, TString weightfile )
 books MVA method from weightfile
TMVA::IMethod* FindMVA(const TString& methodTag)
 return pointer to method with tag "methodTag"
Double_t EvaluateMVA( const std::vector<Float_t>& inputVec, const TString& methodTag, Double_t aux )
 Evaluate a vector<float> of input data for a given method
 The parameter aux is obligatory for the cuts method where it represents the efficiency cutoff
Double_t EvaluateMVA( const std::vector<Double_t>& inputVec, const TString& methodTag, Double_t aux )
 Evaluate a vector<double> of input data for a given method
Double_t EvaluateMVA( const TString& methodTag, Double_t aux )
 evaluates MVA for given set of input variables
Double_t EvaluateMVA( MethodBase* method, Double_t aux )
 evaluates the MVA
Double_t GetProba(const TString& methodTag, Double_t ap_sig = 0.5, Double_t mvaVal = -9999999)
 evaluates probability of MVA for given set of input variables
Double_t GetRarity(const TString& methodTag, Double_t mvaVal = -9999999)
 evaluates the MVA's rarity
void DecodeVarNames( const string varNames )
 decodes "name1:name2:..." form
void DecodeVarNames( const TString varNames )
 decodes "name1:name2:..." form
void GetMethodNameTitle(const TString& weightfile, TString& methodName, TString& methodTitle)
const char* GetName()
 accessors
{ return "Reader"; }
Bool_t Verbose( void )
{ return fVerbose; }
void SetVerbose(Bool_t v)
{ fVerbose = v; }
const TString& GetVarName(Int_t ivar)
{ return Data().GetExpression(ivar); }

Author: Andreas Hoecker, Joerg Stelzer, Helge Voss, Kai Voss
Last change: root/tmva $Id: Reader.h 23334 2008-04-19 18:38:57Z brun $
Last generated: 2008-11-01 10:21
Copyright (c) 2005: *

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.