Classes | Enumerations | Functions
AnitaTMVA Namespace Reference

Classes

struct  MVAVar
 
struct  MVAVarSet
 

Enumerations

enum  MVAPurpose { PURPOSE_NORMAL = 0, PURPOSE_SPECTATOR =1, PURPOSE_TARGET = 2 }
 

Functions

TTree * makeTMVATree (TTree *intree, TFile *outfile, const char *out_tree_name, const MVAVarSet &vars, const char *selection)
 
TTree * makeTMVATree (int ntrees, TTree **intree, TFile *outfile, const char *out_tree_name, const MVAVarSet &vars, const char *selection)
 
int evaluateTMVA (TTree *tree, const MVAVarSet &vars, const char *branch_name, const char *tmva_weights_xml_file, double aux=0)
 

Detailed Description

TMVA helpers for ANITA analysis

The basic problem is that AnitaEventSummary has arrays of things, but TMVA doesn't support that properly (even though... it could in a way similar to TTree::Scan)

See macros/TMVAExample.C for an example analysis.

Cosmin Deaconu cozzy.nosp@m.d@ki.nosp@m.cp.uc.nosp@m.hica.nosp@m.go.ed.nosp@m.u

Function Documentation

int AnitaTMVA::evaluateTMVA ( TTree *  tree,
const MVAVarSet vars,
const char *  branch_name,
const char *  tmva_weights_xml_file,
double  aux = 0 
)

Adds the TMVA classifier result to a tree. This tree should have been generated with makeTMVATree. A branch will be added to the tree with the same name as the method

This takes care of generating the reader and such.

Parameters
treethe tree to evaluate. Should have been generated with maketMVATree
varsThe set of variables that are being evaluated. All branches must exist in tree and the TMVA method must have been generated with it.
branch_nameThe name of the evaluation branch to be added to the tree
tmva_weights_fileThe weights.xml file that you want to read in.
auxaux parameter to EvaluateMVA 0 on success;

Definition at line 163 of file AnitaTMVA.cc.

TTree * AnitaTMVA::makeTMVATree ( TTree *  intree,
TFile *  outfile,
const char *  out_tree_name,
const MVAVarSet vars,
const char *  selection 
)

Creates a tree that may be used by TMVA. Stores in in file outfile, which must exist.

This tree can then be used for training or reading using the varName you provide. Note that internally this uses TTree::Draw, so if your cuts suck, you might end up with an insane amount of memory usage, but since TMVA loads everything into memory anyway, I don't think you lose much. This is necessary because TMVA's methods with selection don't properly handle cuts on array variables. Maybe in the future they'll fix this and this won't be necessary.

The tree will also have the iteration and entry number in it.

Parameters
intreeThe input tree
outfileThe file to write the output tree to
out_tree_hnamethe name of the new tree
varsAnMVAVarSet describing the variables to use
selectionThe selection cuts.
Returns
pointer to the created tree

Definition at line 82 of file AnitaTMVA.cc.

TTree * AnitaTMVA::makeTMVATree ( int  ntrees,
TTree **  intree,
TFile *  outfile,
const char *  out_tree_name,
const MVAVarSet vars,
const char *  selection 
)

Parallel version of above, will treat each input tree separately

Definition at line 88 of file AnitaTMVA.cc.