A simple Binary search tree including a volume search method.
Definition at line 63 of file BinarySearchTree.h.
Public Member Functions | |
BinarySearchTree (const BinarySearchTree &b) | |
copy constructor that creates a true copy, i.e. a completely independent tree More... | |
BinarySearchTree (void) | |
default constructor More... | |
virtual | ~BinarySearchTree (void) |
destructor More... | |
void | CalcStatistics (TMVA::Node *n=0) |
calculate basic statistics (mean, rms for each variable) More... | |
virtual const char * | ClassName () const |
void | Clear (TMVA::Node *n=0) |
clear nodes More... | |
virtual Node * | CreateNode (UInt_t) const |
virtual BinaryTree * | CreateTree () const |
Double_t | Fill (const std::vector< TMVA::Event * > &events, const std::vector< Int_t > &theVars, Int_t theType=-1) |
create the search tree from the event collection using ONLY the variables specified in "theVars" More... | |
Double_t | Fill (const std::vector< TMVA::Event * > &events, Int_t theType=-1) |
create the search tree from the events in a TTree using ALL the variables specified included in the Event More... | |
UInt_t | GetPeriode (void) const |
Double_t | GetSumOfWeights (Int_t theType) const |
return the sum of event (node) weights More... | |
Double_t | GetSumOfWeights (void) const |
return the sum of event (node) weights More... | |
void | Insert (const Event *) |
insert a new "event" in the binary tree More... | |
Float_t | Max (Types::ESBType sb, UInt_t var) |
Float_t | Mean (Types::ESBType sb, UInt_t var) |
Float_t | Min (Types::ESBType sb, UInt_t var) |
void | NormalizeTree () |
Normalisation of tree. More... | |
Float_t | RMS (Types::ESBType sb, UInt_t var) |
Float_t | RMS (UInt_t var) |
BinarySearchTreeNode * | Search (Event *event) const |
search the tree to find the node matching "event" More... | |
Double_t | SearchVolume (Volume *, std::vector< const TMVA::BinarySearchTreeNode * > *events=0) |
search the whole tree and add up all weights of events that lie within the given volume More... | |
Int_t | SearchVolumeWithMaxLimit (TMVA::Volume *, std::vector< const TMVA::BinarySearchTreeNode * > *events=0, Int_t=-1) |
recursively walk through the daughter nodes and add up all weights of events that lie within the given volume a maximum number of events can be given More... | |
void | SetNormalize (Bool_t norm) |
void | SetPeriode (Int_t p) |
Public Member Functions inherited from TMVA::BinaryTree | |
BinaryTree (void) | |
constructor for a yet "empty" tree. Needs to be filled afterwards More... | |
virtual | ~BinaryTree () |
destructor (deletes the nodes and "events" if owned by the tree More... | |
virtual void * | AddXMLTo (void *parent) const |
add attributes to XML More... | |
virtual const char * | ClassName () const =0 |
UInt_t | CountNodes (Node *n=NULL) |
return the number of nodes in the tree. (make a new count --> takes time) More... | |
virtual Node * | CreateNode (UInt_t size=0) const =0 |
virtual BinaryTree * | CreateTree () const =0 |
Node * | GetLeftDaughter (Node *n) |
get left daughter node current node "n" More... | |
UInt_t | GetNNodes () const |
Node * | GetRightDaughter (Node *n) |
get right daughter node current node "n" More... | |
virtual Node * | GetRoot () const |
UInt_t | GetTotalTreeDepth () const |
virtual void | Print (std::ostream &os) const |
recursively print the tree More... | |
virtual void | Read (std::istream &istr, UInt_t tmva_Version_Code=TMVA_VERSION_CODE) |
Read the binary tree from an input stream. More... | |
virtual void | ReadXML (void *node, UInt_t tmva_Version_Code=TMVA_VERSION_CODE) |
read attributes from XML More... | |
void | SetRoot (Node *r) |
void | SetTotalTreeDepth (Int_t depth) |
void | SetTotalTreeDepth (Node *n=NULL) |
descend a tree to find all its leaf nodes, fill max depth reached in the tree at the same time. More... | |
Static Public Member Functions | |
static BinarySearchTree * | CreateFromXML (void *node, UInt_t tmva_Version_Code=TMVA_VERSION_CODE) |
re-create a new tree (decision tree or search tree) from XML More... | |
Private Member Functions | |
void | DestroyNode (BinarySearchTreeNode *) |
void | Insert (const Event *, Node *) |
private internal function to insert a event (node) at the proper position More... | |
Bool_t | InVolume (const std::vector< Float_t > &, Volume *) const |
test if the data points are in the given volume More... | |
void | NormalizeTree (std::vector< std::pair< Double_t, const TMVA::Event * > >::iterator, std::vector< std::pair< Double_t, const TMVA::Event * > >::iterator, UInt_t) |
normalises the binary-search tree to reduce the branch length and hence speed up the search procedure (on average). More... | |
BinarySearchTreeNode * | Search (Event *, Node *) const |
Private, recursive, function for searching. More... | |
Double_t | SearchVolume (Node *, Volume *, Int_t, std::vector< const TMVA::BinarySearchTreeNode * > *events) |
recursively walk through the daughter nodes and add up all weights of events that lie within the given volume More... | |
Private Attributes | |
Bool_t | fCanNormalize |
UInt_t | fCurrentDepth |
std::vector< Float_t > | fMax [2] |
std::vector< Float_t > | fMeans [2] |
std::vector< Float_t > | fMin [2] |
Double_t | fNEventsW [2] |
std::vector< std::pair< Double_t, const TMVA::Event * > > | fNormalizeTreeTable |
UInt_t | fPeriod |
std::vector< Float_t > | fRMS [2] |
Bool_t | fStatisticsIsValid |
std::vector< Double_t > | fSum [2] |
Double_t | fSumOfWeights |
std::vector< Double_t > | fSumSq [2] |
Additional Inherited Members | |
Protected Member Functions inherited from TMVA::BinaryTree | |
void | DeleteNode (Node *) |
protected, recursive, function used by the class destructor and when Pruning More... | |
MsgLogger & | Log () const |
Protected Attributes inherited from TMVA::BinaryTree | |
UInt_t | fDepth |
UInt_t | fNNodes |
Node * | fRoot |
#include <TMVA/BinarySearchTree.h>
TMVA::BinarySearchTree::BinarySearchTree | ( | void | ) |
default constructor
Definition at line 63 of file BinarySearchTree.cxx.
TMVA::BinarySearchTree::BinarySearchTree | ( | const BinarySearchTree & | b | ) |
copy constructor that creates a true copy, i.e. a completely independent tree
Definition at line 77 of file BinarySearchTree.cxx.
|
virtual |
destructor
Definition at line 92 of file BinarySearchTree.cxx.
void TMVA::BinarySearchTree::CalcStatistics | ( | TMVA::Node * | n = 0 | ) |
calculate basic statistics (mean, rms for each variable)
Definition at line 432 of file BinarySearchTree.cxx.
|
inlinevirtual |
Implements TMVA::BinaryTree.
Definition at line 79 of file BinarySearchTree.h.
void TMVA::BinarySearchTree::Clear | ( | TMVA::Node * | n = 0 | ) |
clear nodes
Definition at line 356 of file BinarySearchTree.cxx.
|
static |
re-create a new tree (decision tree or search tree) from XML
Definition at line 103 of file BinarySearchTree.cxx.
Implements TMVA::BinaryTree.
Definition at line 76 of file BinarySearchTree.h.
|
inlinevirtual |
Implements TMVA::BinaryTree.
Definition at line 77 of file BinarySearchTree.h.
|
private |
Double_t TMVA::BinarySearchTree::Fill | ( | const std::vector< TMVA::Event * > & | events, |
const std::vector< Int_t > & | theVars, | ||
Int_t | theType = -1 |
||
) |
create the search tree from the event collection using ONLY the variables specified in "theVars"
Definition at line 249 of file BinarySearchTree.cxx.
Double_t TMVA::BinarySearchTree::Fill | ( | const std::vector< TMVA::Event * > & | events, |
Int_t | theType = -1 |
||
) |
create the search tree from the events in a TTree using ALL the variables specified included in the Event
Definition at line 260 of file BinarySearchTree.cxx.
Definition at line 98 of file BinarySearchTree.h.
return the sum of event (node) weights
Definition at line 233 of file BinarySearchTree.cxx.
return the sum of event (node) weights
Definition at line 218 of file BinarySearchTree.cxx.
insert a new "event" in the binary tree
Definition at line 114 of file BinarySearchTree.cxx.
private internal function to insert a event (node) at the proper position
Definition at line 147 of file BinarySearchTree.cxx.
|
private |
test if the data points are in the given volume
Definition at line 417 of file BinarySearchTree.cxx.
|
inline |
Definition at line 126 of file BinarySearchTree.h.
|
inline |
Definition at line 117 of file BinarySearchTree.h.
|
inline |
Definition at line 123 of file BinarySearchTree.h.
void TMVA::BinarySearchTree::NormalizeTree | ( | ) |
Normalisation of tree.
Definition at line 345 of file BinarySearchTree.cxx.
|
private |
normalises the binary-search tree to reduce the branch length and hence speed up the search procedure (on average).
Definition at line 288 of file BinarySearchTree.cxx.
|
inline |
Definition at line 120 of file BinarySearchTree.h.
Definition at line 131 of file BinarySearchTree.h.
|
private |
Private, recursive, function for searching.
Definition at line 201 of file BinarySearchTree.cxx.
TMVA::BinarySearchTreeNode * TMVA::BinarySearchTree::Search | ( | Event * | event | ) | const |
search the tree to find the node matching "event"
Definition at line 193 of file BinarySearchTree.cxx.
|
private |
recursively walk through the daughter nodes and add up all weights of events that lie within the given volume
Definition at line 382 of file BinarySearchTree.cxx.
Double_t TMVA::BinarySearchTree::SearchVolume | ( | Volume * | volume, |
std::vector< const TMVA::BinarySearchTreeNode * > * | events = 0 |
||
) |
search the whole tree and add up all weights of events that lie within the given volume
Definition at line 372 of file BinarySearchTree.cxx.
Int_t TMVA::BinarySearchTree::SearchVolumeWithMaxLimit | ( | TMVA::Volume * | volume, |
std::vector< const TMVA::BinarySearchTreeNode * > * | events = 0 , |
||
Int_t | max_points = -1 |
||
) |
recursively walk through the daughter nodes and add up all weights of events that lie within the given volume a maximum number of events can be given
Definition at line 497 of file BinarySearchTree.cxx.
Definition at line 133 of file BinarySearchTree.h.
Definition at line 95 of file BinarySearchTree.h.
|
private |
Definition at line 168 of file BinarySearchTree.h.
|
private |
Definition at line 155 of file BinarySearchTree.h.
|
private |
Definition at line 161 of file BinarySearchTree.h.
|
private |
Definition at line 158 of file BinarySearchTree.h.
|
private |
Definition at line 160 of file BinarySearchTree.h.
|
private |
Definition at line 164 of file BinarySearchTree.h.
|
private |
Definition at line 169 of file BinarySearchTree.h.
|
private |
Definition at line 154 of file BinarySearchTree.h.
|
private |
Definition at line 159 of file BinarySearchTree.h.
|
private |
Definition at line 156 of file BinarySearchTree.h.
|
private |
Definition at line 162 of file BinarySearchTree.h.
|
private |
Definition at line 165 of file BinarySearchTree.h.
|
private |
Definition at line 163 of file BinarySearchTree.h.