A simple Binary search tree including a volume search method.
Definition at line 65 of file BinarySearchTree.h.
Public Member Functions | |
| BinarySearchTree (const BinarySearchTree &b) | |
| copy constructor that creates a true copy, i.e. a completely independent tree | |
| BinarySearchTree (void) | |
| default constructor | |
| virtual | ~BinarySearchTree (void) |
| destructor | |
| virtual void * | AddXMLTo (void *parent) const |
| add attributes to XML | |
| void | CalcStatistics (TMVA::Node *n=nullptr) |
| calculate basic statistics (mean, rms for each variable) | |
| const char * | ClassName () const override |
| void | Clear (TMVA::Node *n=nullptr) |
| clear nodes | |
| UInt_t | CountNodes (Node *n=nullptr) |
| return the number of nodes in the tree. (make a new count --> takes time) | |
| Node * | CreateNode (UInt_t) const override |
| BinaryTree * | CreateTree () const override |
| 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" | |
| 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 | |
| Node * | GetLeftDaughter (Node *n) |
| get left daughter node current node "n" | |
| UInt_t | GetNNodes () const |
| UInt_t | GetPeriode (void) const |
| Node * | GetRightDaughter (Node *n) |
| get right daughter node current node "n" | |
| virtual Node * | GetRoot () const |
| Double_t | GetSumOfWeights (Int_t theType) const |
| return the sum of event (node) weights | |
| Double_t | GetSumOfWeights (void) const |
| return the sum of event (node) weights | |
| UInt_t | GetTotalTreeDepth () const |
| void | Insert (const Event *) |
| insert a new "event" in the binary tree | |
| TClass * | IsA () const override |
| Float_t | Max (Types::ESBType sb, UInt_t var) |
| access to Maximum for signal and background for each variable | |
| Float_t | Mean (Types::ESBType sb, UInt_t var) |
| access to mean for signal and background for each variable | |
| Float_t | Min (Types::ESBType sb, UInt_t var) |
| access to Minimum for signal and background for each variable | |
| void | NormalizeTree () |
| Normalisation of tree. | |
| virtual void | Print (std::ostream &os) const |
| recursively print the tree | |
| virtual void | Read (std::istream &istr, UInt_t tmva_Version_Code=262657) |
| Read the binary tree from an input stream. | |
| virtual void | ReadXML (void *node, UInt_t tmva_Version_Code=262657) |
| read attributes from XML | |
| Float_t | RMS (Types::ESBType sb, UInt_t var) |
| access to RMS for signal and background for each variable | |
| Float_t | RMS (UInt_t var) |
| access to RMS for each variable | |
| BinarySearchTreeNode * | Search (Event *event) const |
| search the tree to find the node matching "event" | |
| Double_t | SearchVolume (Volume *, std::vector< const TMVA::BinarySearchTreeNode * > *events=nullptr) |
| search the whole tree and add up all weights of events that lie within the given volume | |
| Int_t | SearchVolumeWithMaxLimit (TMVA::Volume *, std::vector< const TMVA::BinarySearchTreeNode * > *events=nullptr, 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 | |
| void | SetNormalize (Bool_t norm) |
| void | SetPeriode (Int_t p) |
| void | SetRoot (Node *r) |
| void | SetTotalTreeDepth (Int_t depth) |
| void | SetTotalTreeDepth (Node *n=nullptr) |
| descend a tree to find all its leaf nodes, fill max depth reached in the tree at the same time. | |
| void | Streamer (TBuffer &) override |
| void | StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b) |
Static Public Member Functions | |
| static TClass * | Class () |
| static const char * | Class_Name () |
| static constexpr Version_t | Class_Version () |
| static BinarySearchTree * | CreateFromXML (void *node, UInt_t tmva_Version_Code=262657) |
| re-create a new tree (decision tree or search tree) from XML | |
| static const char * | DeclFileName () |
Protected Member Functions | |
| void | DeleteNode (Node *) |
| protected, recursive, function used by the class destructor and when Pruning | |
| MsgLogger & | Log () const |
Protected Attributes | |
| UInt_t | fDepth |
| maximal depth in tree reached | |
| UInt_t | fNNodes |
| total number of nodes in the tree (counted) | |
| Node * | fRoot |
| the root node of the tree the tree only has it's root node, the "daughters" are taken care of by the "node" properties of the "root" | |
Private Member Functions | |
| void | DestroyNode (BinarySearchTreeNode *) |
| void | Insert (const Event *, Node *) |
| private internal function to insert a event (node) at the proper position | |
| Bool_t | InVolume (const std::vector< Float_t > &, Volume *) const |
| test if the data points are in the given volume | |
| 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). | |
| BinarySearchTreeNode * | Search (Event *, Node *) const |
| Private, recursive, function for searching. | |
| 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 | |
Private Attributes | |
| Bool_t | fCanNormalize |
| the tree can be normalised | |
| UInt_t | fCurrentDepth |
| internal variable, counting the depth of the tree during insertion | |
| std::vector< Float_t > | fMax [2] |
| RMS for signal and background for each variable. | |
| std::vector< Float_t > | fMeans [2] |
| mean for signal and background for each variable | |
| std::vector< Float_t > | fMin [2] |
| RMS for signal and background for each variable. | |
| Double_t | fNEventsW [2] |
| Number of events per class, taking into account event weights. | |
| std::vector< std::pair< Double_t, const TMVA::Event * > > | fNormalizeTreeTable |
| UInt_t | fPeriod |
| periode (number of event variables) | |
| std::vector< Float_t > | fRMS [2] |
| RMS for signal and background for each variable. | |
| Bool_t | fStatisticsIsValid |
| flag if last stat calculation is still valid, set to false if new node is insert | |
| std::vector< Double_t > | fSum [2] |
| Sum for signal and background for each variable. | |
| Double_t | fSumOfWeights |
| Total number of events (weighted) counted during filling should be the same as fNEventsW[0]+fNEventsW[1]. | |
| std::vector< Double_t > | fSumSq [2] |
| Squared Sum for signal and background for each variable. | |
#include <TMVA/BinarySearchTree.h>
| TMVA::BinarySearchTree::BinarySearchTree | ( | void | ) |
default constructor
Definition at line 62 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 76 of file BinarySearchTree.cxx.
|
virtual |
destructor
Definition at line 91 of file BinarySearchTree.cxx.
|
virtualinherited |
add attributes to XML
Definition at line 133 of file BinaryTree.cxx.
| void TMVA::BinarySearchTree::CalcStatistics | ( | TMVA::Node * | n = nullptr | ) |
calculate basic statistics (mean, rms for each variable)
Definition at line 429 of file BinarySearchTree.cxx.
|
static |
|
static |
|
inlinestaticconstexpr |
Definition at line 173 of file BinarySearchTree.h.
|
inlineoverridevirtual |
Implements TMVA::BinaryTree.
Definition at line 81 of file BinarySearchTree.h.
| void TMVA::BinarySearchTree::Clear | ( | TMVA::Node * | n = nullptr | ) |
clear nodes
Definition at line 353 of file BinarySearchTree.cxx.
|
inherited |
return the number of nodes in the tree. (make a new count --> takes time)
Definition at line 102 of file BinaryTree.cxx.
|
static |
re-create a new tree (decision tree or search tree) from XML
Definition at line 102 of file BinarySearchTree.cxx.
Implements TMVA::BinaryTree.
Definition at line 78 of file BinarySearchTree.h.
|
inlineoverridevirtual |
Implements TMVA::BinaryTree.
Definition at line 79 of file BinarySearchTree.h.
|
inlinestatic |
Definition at line 173 of file BinarySearchTree.h.
|
protectedinherited |
protected, recursive, function used by the class destructor and when Pruning
Definition at line 73 of file BinaryTree.cxx.
|
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 248 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 259 of file BinarySearchTree.cxx.
|
inherited |
get left daughter node current node "n"
Definition at line 86 of file BinaryTree.cxx.
|
inlineinherited |
Definition at line 86 of file BinaryTree.h.
|
inline |
Definition at line 100 of file BinarySearchTree.h.
|
inherited |
get right daughter node current node "n"
Definition at line 94 of file BinaryTree.cxx.
|
inlinevirtualinherited |
Reimplemented in TMVA::DecisionTree.
Definition at line 83 of file BinaryTree.h.
return the sum of event (node) weights
Definition at line 232 of file BinarySearchTree.cxx.
| Double_t TMVA::BinarySearchTree::GetSumOfWeights | ( | void | ) | const |
return the sum of event (node) weights
Definition at line 217 of file BinarySearchTree.cxx.
|
inlineinherited |
Definition at line 93 of file BinaryTree.h.
| void TMVA::BinarySearchTree::Insert | ( | const Event * | event | ) |
insert a new "event" in the binary tree
Definition at line 113 of file BinarySearchTree.cxx.
private internal function to insert a event (node) at the proper position
Definition at line 146 of file BinarySearchTree.cxx.
|
private |
test if the data points are in the given volume
Definition at line 414 of file BinarySearchTree.cxx.
|
inlineoverridevirtual |
Reimplemented from TMVA::BinaryTree.
Definition at line 173 of file BinarySearchTree.h.
|
protectedinherited |
Definition at line 234 of file BinaryTree.cxx.
|
inline |
access to Maximum for signal and background for each variable
Definition at line 128 of file BinarySearchTree.h.
|
inline |
access to mean for signal and background for each variable
Definition at line 119 of file BinarySearchTree.h.
|
inline |
access to Minimum for signal and background for each variable
Definition at line 125 of file BinarySearchTree.h.
| void TMVA::BinarySearchTree::NormalizeTree | ( | ) |
Normalisation of tree.
Definition at line 342 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 285 of file BinarySearchTree.cxx.
|
virtualinherited |
recursively print the tree
Definition at line 124 of file BinaryTree.cxx.
|
virtualinherited |
Read the binary tree from an input stream.
The input stream format depends on the tree type, it is defined be the node of the tree
Definition at line 168 of file BinaryTree.cxx.
|
virtualinherited |
read attributes from XML
Definition at line 143 of file BinaryTree.cxx.
|
inline |
access to RMS for signal and background for each variable
Definition at line 122 of file BinarySearchTree.h.
access to RMS for each variable
Definition at line 133 of file BinarySearchTree.h.
|
private |
Private, recursive, function for searching.
Definition at line 200 of file BinarySearchTree.cxx.
| TMVA::BinarySearchTreeNode * TMVA::BinarySearchTree::Search | ( | Event * | event | ) | const |
search the tree to find the node matching "event"
Definition at line 192 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 379 of file BinarySearchTree.cxx.
| Double_t TMVA::BinarySearchTree::SearchVolume | ( | Volume * | volume, |
| std::vector< const TMVA::BinarySearchTreeNode * > * | events = nullptr ) |
search the whole tree and add up all weights of events that lie within the given volume
Definition at line 369 of file BinarySearchTree.cxx.
| Int_t TMVA::BinarySearchTree::SearchVolumeWithMaxLimit | ( | TMVA::Volume * | volume, |
| std::vector< const TMVA::BinarySearchTreeNode * > * | events = nullptr, | ||
| 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 494 of file BinarySearchTree.cxx.
|
inline |
Definition at line 135 of file BinarySearchTree.h.
|
inline |
Definition at line 97 of file BinarySearchTree.h.
|
inlineinherited |
Definition at line 80 of file BinaryTree.h.
|
inlineinherited |
Definition at line 95 of file BinaryTree.h.
|
inherited |
descend a tree to find all its leaf nodes, fill max depth reached in the tree at the same time.
Definition at line 212 of file BinaryTree.cxx.
|
overridevirtual |
Reimplemented from TMVA::BinaryTree.
|
inline |
Definition at line 173 of file BinarySearchTree.h.
|
private |
the tree can be normalised
Definition at line 170 of file BinarySearchTree.h.
|
private |
internal variable, counting the depth of the tree during insertion
Definition at line 157 of file BinarySearchTree.h.
|
protectedinherited |
maximal depth in tree reached
Definition at line 118 of file BinaryTree.h.
|
private |
RMS for signal and background for each variable.
Definition at line 163 of file BinarySearchTree.h.
|
private |
mean for signal and background for each variable
Definition at line 160 of file BinarySearchTree.h.
|
private |
RMS for signal and background for each variable.
Definition at line 162 of file BinarySearchTree.h.
|
private |
Number of events per class, taking into account event weights.
Definition at line 166 of file BinarySearchTree.h.
|
protectedinherited |
total number of nodes in the tree (counted)
Definition at line 117 of file BinaryTree.h.
|
private |
Definition at line 171 of file BinarySearchTree.h.
|
private |
periode (number of event variables)
Definition at line 156 of file BinarySearchTree.h.
|
private |
RMS for signal and background for each variable.
Definition at line 161 of file BinarySearchTree.h.
|
protectedinherited |
the root node of the tree the tree only has it's root node, the "daughters" are taken care of by the "node" properties of the "root"
Definition at line 110 of file BinaryTree.h.
|
private |
flag if last stat calculation is still valid, set to false if new node is insert
Definition at line 158 of file BinarySearchTree.h.
|
private |
Sum for signal and background for each variable.
Definition at line 164 of file BinarySearchTree.h.
|
private |
Total number of events (weighted) counted during filling should be the same as fNEventsW[0]+fNEventsW[1].
. used as a check
Definition at line 167 of file BinarySearchTree.h.
|
private |
Squared Sum for signal and background for each variable.
Definition at line 165 of file BinarySearchTree.h.