library: libTMVA #include "Factory.h" |
TMVA::Factory
class description - header file - source file - inheritance tree (.pdf)
private:
void SetLocalDir()
protected:
void GetCorrelationMatrix(TTree* theTree)
void PlotVariables(TTree* theTree)
public:
Factory(TString theJobName, TFile* theTargetFile, TString theOption = )
Factory(TFile* theTargetFile)
Factory(const TMVA::Factory&)
virtual ~Factory()
Bool_t BookMethod(TString theMethodName, TString theOption = , TString theNameAppendix = )
Bool_t BookMethod(TMVA::Types::MVA theMethod, TString theOption = , TString theNameAppendix = )
Bool_t BookMethod(TMVA::MethodBase* theMethod, TString theNameAppendix = )
void BookMultipleMVAs(TString theVariable, Int_t nbins, Double_t* array)
static TClass* Class()
void DeleteAllMethods()
void EvaluateAllMethods()
void EvaluateAllVariables(TString options = )
TCut GetCut()
TMVA::MethodBase* GetMVA(TString method)
TTree* GetTestTree() const
TTree* GetTrainingTree() const
void Greeting(TString = )
virtual TClass* IsA() const
TMVA::Factory& operator=(const TMVA::Factory&)
void PrepareTrainingAndTestTree(TCut cut = , Int_t Ntrain = 0, Int_t Ntest = 0, TString TreeName = )
void ProcessMultipleMVA()
void SetBackgroundTree(TTree* background)
Bool_t SetInputTrees(TString signalFileName, TString backgroundFileName)
Bool_t SetInputTrees(TTree* inputTree, TCut SigCut, TCut BgCut = )
Bool_t SetInputTrees(TTree* signal, TTree* background)
void SetInputVariables(vector<TString>* theVariables)
void SetSignalAndBackgroundEvents(Double_t signal, Double_t background)
void SetSignalTree(TTree* signal)
void SetTestTree(TTree* testTree)
void SetVerbose(Bool_t v = kTRUE)
virtual void ShowMembers(TMemberInspector& insp, char* parent)
virtual void Streamer(TBuffer& b)
void StreamerNVirtual(TBuffer& b)
void TestAllMethods()
void TrainAllMethods()
Bool_t Verbose() const
private:
TFile* fSignalFile if two input files: signal file
TFile* fBackgFile if two input files: background file
TTree* fTrainingTree
TTree* fTestTree
TTree* fMultiCutTestTree
TTree* fSignalTree cloned from input tree (signal)
TTree* fBackgTree cloned from input tree (background)
Double_t fSignalEvents number of signal events
Double_t fBackgroundEvents number of background events
TFile* fTargetFile ROOT output file
TNtuple* fSigBgdVariables Signal and background ntuple (see example significances.C)
TCut fCut preselection cut applied to all input events
TString fOptions option string given by construction (presently only "V")
Bool_t fVerbose verbose mode
vector<TString>* fInputVariables names of input variables used in the MVAs
vector<MethodBase*> fMethods all MVA methods
TString fJobName jobname, used as extension in weight file names
Bool_t fMultipleMVAs multi-cut mode ?
Bool_t fMultipleStoredOptions multi-cut driving flag
Bool_t fMultiTrain multi-cut driving flag
Bool_t fMultiTest multi-cut driving flag
Bool_t fMultiEvalVar multi-cut driving flag
Bool_t fMultiEval multi-cut driving flag
TCut fMultiCut phase-space cut
Int_t fMultiNtrain number of training events
Int_t fMultiNtest number of testing events
map<TString,std::pair<TString,TCut> > fMultipleMVAnames map of MVA names
map<TString,std::pair<TString,TString> > fMultipleMVAMethodOptions map of option strings
TDirectory* fLocalTDir
_______________________________________________________________________
This is the main MVA steering class: it creates all MVA methods,
and guides them through the training, testing and evaluation
phases. It also manages multiple MVA handling in case of distinct
phase space requirements (cuts).
_______________________________________________________________________
Factory( TString jobName, TFile* theTargetFile, TString theOption )
standard constructor
jobname : this name will appear in all weight file names produced by the MVAs
theTargetFile : output ROOT file; the test tree and all evaluation plots
will be stored here
theOption : option string; the currently only option is "V" for verbose
Bool_t SetInputTrees(TTree* inputTree, TCut SigCut, TCut BgCut)
define the input trees for signal and background from single input tree,
containing both signal and background events distinguished by the type
identifiers: SigCut and BgCut
void PrepareTrainingAndTestTree( TCut cut, Int_t Ntrain, Int_t Ntest, TString TreeName )
------------------------------------------------------
| | | | |
------------------------------------------------------
# input signal events
# input signal events after cuts
------------------------------------------------------
| | | | |
------------------------------------------------------
\/ \/ # input bg events
# input bg events after cuts
Ntrain/2 Ntest/2
definitions:
nsigTot = all signal events
nbkgTot = all bkg events
nTot = nsigTot + nbkgTot
i.g.: nsigTot != nbkgTot
N:M = use M events after event N (distinct event sample)
(read as: "from event N to event M")
assumptions:
a) equal number of signal and background events is used for training
b) any numbers of signal and background events are used for testing
c) an explicit syntax can violate a)
cases (in order of importance)
1)
user gives : N1
PrepareTree does : nsig_train=nbkg_train=min(N1,nsigTot,nbkgTot)
nsig_test =nsig_train:nsigTot, nbkg_test =nsig_train:nbkgTot
-> give warning if nsig_test<=0 || nbkg_test<=0
2)
user gives : N1, N2
PrepareTree does : nsig_train=nbkg_train=min(N1,nsigTot,nbkgTot)
nsig_test =nsig_train:min(N2,nsigTot-nsig_train),
nbkg_test =nsig_train:min(N2,nbkgTot-nbkg_train)
-> give warning if nsig(bkg)_train != N1, or
if nsig_test<N2 || nbkg_test<N2
3)
user gives : -1
PrepareTree does : nsig_train=nbkg_train=min(nsigTot,nbkgTot)
nsig_test =nsigTot, nbkg_test=nbkgTot
-> give warning that same samples are used for testing and training
4)
user gives : -1, -1
PrepareTree does : nsig_train=nsigTot, nbkg_train=nbkgTot
nsig_test =nsigTot, nbkg_test =nbkgTot
-> give warning that same samples are used for testing and training,
and, if nsig_train != nbkg_train, that an unequal number of
signal and background events are used in training
------------------------------------------------------------------------
Give in any case the number of signal and background events that are
used for testing and training, and tell whether there are overlaps between
the samples.
------------------------------------------------------------------------
void GetCorrelationMatrix( TTree* theTree )
calculates the correlation matrices for signal and background,
and print them to standard output
Bool_t BookMethod( TMVA::Types::MVA theMethod, TString theOption, TString theNameAppendix )
books MVA method; the option configuration string is custom for each MVA
the TString field "theNameAppendix" serves to define (and distringuish)
several instances of a given MVA, eg, when one wants to compare the
performance of various configurations
void TrainAllMethods( void )
iterates over all MVAs that have been booked, and calls their training methods
void TestAllMethods( void )
iterates over all MVAs that have been booked, and calls their testing methods
void EvaluateAllMethods( void )
iterates over all MVAs that have been booked, and calls their evaluation methods
void ProcessMultipleMVA( void )
multiple MVAs in different phase space regions are trained and tested
Author: Andreas Hoecker, Joerg Stelzer, Helge Voss, Kai Voss
Last update: root/tmva $Id: Factory.cxx,v 1.4 2006/05/31 14:01:33 rdm Exp $
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.