Logo ROOT  
Reference Guide
TMVA::BinarySearchTree Class Reference

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 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 NodeCreateNode (UInt_t) const
 
virtual BinaryTreeCreateTree () 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...
 
virtual TClassIsA () const
 
Float_t Max (Types::ESBType sb, UInt_t var)
 access to Maximum for signal and background for each variable More...
 
Float_t Mean (Types::ESBType sb, UInt_t var)
 access to mean for signal and background for each variable More...
 
Float_t Min (Types::ESBType sb, UInt_t var)
 access to Minimum for signal and background for each variable More...
 
void NormalizeTree ()
 Normalisation of tree. More...
 
Float_t RMS (Types::ESBType sb, UInt_t var)
 access to RMS for signal and background for each variable More...
 
Float_t RMS (UInt_t var)
 access to RMS for each variable More...
 
BinarySearchTreeNodeSearch (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)
 
virtual void Streamer (TBuffer &)
 
void StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b)
 
- 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 NodeCreateNode (UInt_t size=0) const =0
 
virtual BinaryTreeCreateTree () const =0
 
NodeGetLeftDaughter (Node *n)
 get left daughter node current node "n" More...
 
UInt_t GetNNodes () const
 
NodeGetRightDaughter (Node *n)
 get right daughter node current node "n" More...
 
virtual NodeGetRoot () const
 
UInt_t GetTotalTreeDepth () const
 
virtual TClassIsA () const
 
virtual void Print (std::ostream &os) const
 recursively print the tree More...
 
virtual void Read (std::istream &istr, UInt_t tmva_Version_Code=262657)
 Read the binary tree from an input stream. More...
 
virtual void ReadXML (void *node, UInt_t tmva_Version_Code=262657)
 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...
 
virtual void Streamer (TBuffer &)
 
void StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b)
 

Static Public Member Functions

static TClassClass ()
 
static const char * Class_Name ()
 
static Version_t Class_Version ()
 
static BinarySearchTreeCreateFromXML (void *node, UInt_t tmva_Version_Code=262657)
 re-create a new tree (decision tree or search tree) from XML More...
 
static const char * DeclFileName ()
 
- Static Public Member Functions inherited from TMVA::BinaryTree
static TClassClass ()
 
static const char * Class_Name ()
 
static Version_t Class_Version ()
 
static const char * DeclFileName ()
 

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...
 
BinarySearchTreeNodeSearch (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
 the tree can be normalised More...
 
UInt_t fCurrentDepth
 internal variable, counting the depth of the tree during insertion More...
 
std::vector< Float_tfMax [2]
 RMS for signal and background for each variable. More...
 
std::vector< Float_tfMeans [2]
 mean for signal and background for each variable More...
 
std::vector< Float_tfMin [2]
 RMS for signal and background for each variable. More...
 
Double_t fNEventsW [2]
 Number of events per class, taking into account event weights. More...
 
std::vector< std::pair< Double_t, const TMVA::Event * > > fNormalizeTreeTable
 
UInt_t fPeriod
 periode (number of event variables) More...
 
std::vector< Float_tfRMS [2]
 RMS for signal and background for each variable. More...
 
Bool_t fStatisticsIsValid
 flag if last stat calculation is still valid, set to false if new node is insert More...
 
std::vector< Double_tfSum [2]
 Sum for signal and background for each variable. More...
 
Double_t fSumOfWeights
 Total number of events (weighted) counted during filling should be the same as fNEventsW[0]+fNEventsW[1]. More...
 
std::vector< Double_tfSumSq [2]
 Squared Sum for signal and background for each variable. More...
 

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...
 
MsgLoggerLog () const
 
- Protected Attributes inherited from TMVA::BinaryTree
UInt_t fDepth
 maximal depth in tree reached More...
 
UInt_t fNNodes
 total number of nodes in the tree (counted) More...
 
NodefRoot
 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" More...
 

#include <TMVA/BinarySearchTree.h>

Inheritance diagram for TMVA::BinarySearchTree:
[legend]

Constructor & Destructor Documentation

◆ BinarySearchTree() [1/2]

TMVA::BinarySearchTree::BinarySearchTree ( void  )

default constructor

Definition at line 63 of file BinarySearchTree.cxx.

◆ BinarySearchTree() [2/2]

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.

◆ ~BinarySearchTree()

TMVA::BinarySearchTree::~BinarySearchTree ( void  )
virtual

destructor

Definition at line 92 of file BinarySearchTree.cxx.

Member Function Documentation

◆ CalcStatistics()

void TMVA::BinarySearchTree::CalcStatistics ( TMVA::Node n = 0)

calculate basic statistics (mean, rms for each variable)

Definition at line 432 of file BinarySearchTree.cxx.

◆ Class()

static TClass * TMVA::BinarySearchTree::Class ( )
static
Returns
TClass describing this class

◆ Class_Name()

static const char * TMVA::BinarySearchTree::Class_Name ( )
static
Returns
Name of this class

◆ Class_Version()

static Version_t TMVA::BinarySearchTree::Class_Version ( )
inlinestatic
Returns
Version of this class

Definition at line 173 of file BinarySearchTree.h.

◆ ClassName()

virtual const char * TMVA::BinarySearchTree::ClassName ( ) const
inlinevirtual

Implements TMVA::BinaryTree.

Definition at line 81 of file BinarySearchTree.h.

◆ Clear()

void TMVA::BinarySearchTree::Clear ( TMVA::Node n = 0)

clear nodes

Definition at line 356 of file BinarySearchTree.cxx.

◆ CreateFromXML()

TMVA::BinarySearchTree * TMVA::BinarySearchTree::CreateFromXML ( void *  node,
UInt_t  tmva_Version_Code = 262657 
)
static

re-create a new tree (decision tree or search tree) from XML

Definition at line 103 of file BinarySearchTree.cxx.

◆ CreateNode()

virtual Node * TMVA::BinarySearchTree::CreateNode ( UInt_t  ) const
inlinevirtual

Implements TMVA::BinaryTree.

Definition at line 78 of file BinarySearchTree.h.

◆ CreateTree()

virtual BinaryTree * TMVA::BinarySearchTree::CreateTree ( ) const
inlinevirtual

Implements TMVA::BinaryTree.

Definition at line 79 of file BinarySearchTree.h.

◆ DeclFileName()

static const char * TMVA::BinarySearchTree::DeclFileName ( )
inlinestatic
Returns
Name of the file containing the class declaration

Definition at line 173 of file BinarySearchTree.h.

◆ DestroyNode()

void TMVA::BinarySearchTree::DestroyNode ( BinarySearchTreeNode )
private

◆ Fill() [1/2]

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.

◆ Fill() [2/2]

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.

◆ GetPeriode()

UInt_t TMVA::BinarySearchTree::GetPeriode ( void  ) const
inline

Definition at line 100 of file BinarySearchTree.h.

◆ GetSumOfWeights() [1/2]

Double_t TMVA::BinarySearchTree::GetSumOfWeights ( Int_t  theType) const

return the sum of event (node) weights

Definition at line 233 of file BinarySearchTree.cxx.

◆ GetSumOfWeights() [2/2]

Double_t TMVA::BinarySearchTree::GetSumOfWeights ( void  ) const

return the sum of event (node) weights

Definition at line 218 of file BinarySearchTree.cxx.

◆ Insert() [1/2]

void TMVA::BinarySearchTree::Insert ( const Event event)

insert a new "event" in the binary tree

Definition at line 114 of file BinarySearchTree.cxx.

◆ Insert() [2/2]

void TMVA::BinarySearchTree::Insert ( const Event event,
Node node 
)
private

private internal function to insert a event (node) at the proper position

Definition at line 147 of file BinarySearchTree.cxx.

◆ InVolume()

Bool_t TMVA::BinarySearchTree::InVolume ( const std::vector< Float_t > &  event,
Volume volume 
) const
private

test if the data points are in the given volume

Definition at line 417 of file BinarySearchTree.cxx.

◆ IsA()

virtual TClass * TMVA::BinarySearchTree::IsA ( ) const
inlinevirtual
Returns
TClass describing current object

Reimplemented from TMVA::BinaryTree.

Definition at line 173 of file BinarySearchTree.h.

◆ Max()

Float_t TMVA::BinarySearchTree::Max ( Types::ESBType  sb,
UInt_t  var 
)
inline

access to Maximum for signal and background for each variable

Definition at line 128 of file BinarySearchTree.h.

◆ Mean()

Float_t TMVA::BinarySearchTree::Mean ( Types::ESBType  sb,
UInt_t  var 
)
inline

access to mean for signal and background for each variable

Definition at line 119 of file BinarySearchTree.h.

◆ Min()

Float_t TMVA::BinarySearchTree::Min ( Types::ESBType  sb,
UInt_t  var 
)
inline

access to Minimum for signal and background for each variable

Definition at line 125 of file BinarySearchTree.h.

◆ NormalizeTree() [1/2]

void TMVA::BinarySearchTree::NormalizeTree ( )

Normalisation of tree.

Definition at line 345 of file BinarySearchTree.cxx.

◆ NormalizeTree() [2/2]

void TMVA::BinarySearchTree::NormalizeTree ( std::vector< std::pair< Double_t, const TMVA::Event * > >::iterator  leftBound,
std::vector< std::pair< Double_t, const TMVA::Event * > >::iterator  rightBound,
UInt_t  actDim 
)
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.

◆ RMS() [1/2]

Float_t TMVA::BinarySearchTree::RMS ( Types::ESBType  sb,
UInt_t  var 
)
inline

access to RMS for signal and background for each variable

Definition at line 122 of file BinarySearchTree.h.

◆ RMS() [2/2]

Float_t TMVA::BinarySearchTree::RMS ( UInt_t  var)
inline

access to RMS for each variable

Definition at line 133 of file BinarySearchTree.h.

◆ Search() [1/2]

TMVA::BinarySearchTreeNode * TMVA::BinarySearchTree::Search ( Event event,
Node node 
) const
private

Private, recursive, function for searching.

Definition at line 201 of file BinarySearchTree.cxx.

◆ Search() [2/2]

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.

◆ SearchVolume() [1/2]

Double_t TMVA::BinarySearchTree::SearchVolume ( Node t,
Volume volume,
Int_t  depth,
std::vector< const TMVA::BinarySearchTreeNode * > *  events 
)
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.

◆ SearchVolume() [2/2]

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.

◆ SearchVolumeWithMaxLimit()

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.

◆ SetNormalize()

void TMVA::BinarySearchTree::SetNormalize ( Bool_t  norm)
inline

Definition at line 135 of file BinarySearchTree.h.

◆ SetPeriode()

void TMVA::BinarySearchTree::SetPeriode ( Int_t  p)
inline

Definition at line 97 of file BinarySearchTree.h.

◆ Streamer()

virtual void TMVA::BinarySearchTree::Streamer ( TBuffer )
virtual

Reimplemented from TMVA::BinaryTree.

◆ StreamerNVirtual()

void TMVA::BinarySearchTree::StreamerNVirtual ( TBuffer ClassDef_StreamerNVirtual_b)
inline

Definition at line 173 of file BinarySearchTree.h.

Member Data Documentation

◆ fCanNormalize

Bool_t TMVA::BinarySearchTree::fCanNormalize
private

the tree can be normalised

Definition at line 170 of file BinarySearchTree.h.

◆ fCurrentDepth

UInt_t TMVA::BinarySearchTree::fCurrentDepth
private

internal variable, counting the depth of the tree during insertion

Definition at line 157 of file BinarySearchTree.h.

◆ fMax

std::vector<Float_t> TMVA::BinarySearchTree::fMax[2]
private

RMS for signal and background for each variable.

Definition at line 163 of file BinarySearchTree.h.

◆ fMeans

std::vector<Float_t> TMVA::BinarySearchTree::fMeans[2]
private

mean for signal and background for each variable

Definition at line 160 of file BinarySearchTree.h.

◆ fMin

std::vector<Float_t> TMVA::BinarySearchTree::fMin[2]
private

RMS for signal and background for each variable.

Definition at line 162 of file BinarySearchTree.h.

◆ fNEventsW

Double_t TMVA::BinarySearchTree::fNEventsW[2]
private

Number of events per class, taking into account event weights.

Definition at line 166 of file BinarySearchTree.h.

◆ fNormalizeTreeTable

std::vector< std::pair<Double_t,const TMVA::Event*> > TMVA::BinarySearchTree::fNormalizeTreeTable
private

Definition at line 171 of file BinarySearchTree.h.

◆ fPeriod

UInt_t TMVA::BinarySearchTree::fPeriod
private

periode (number of event variables)

Definition at line 156 of file BinarySearchTree.h.

◆ fRMS

std::vector<Float_t> TMVA::BinarySearchTree::fRMS[2]
private

RMS for signal and background for each variable.

Definition at line 161 of file BinarySearchTree.h.

◆ fStatisticsIsValid

Bool_t TMVA::BinarySearchTree::fStatisticsIsValid
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.

◆ fSum

std::vector<Double_t> TMVA::BinarySearchTree::fSum[2]
private

Sum for signal and background for each variable.

Definition at line 164 of file BinarySearchTree.h.

◆ fSumOfWeights

Double_t TMVA::BinarySearchTree::fSumOfWeights
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.

◆ fSumSq

std::vector<Double_t> TMVA::BinarySearchTree::fSumSq[2]
private

Squared Sum for signal and background for each variable.

Definition at line 165 of file BinarySearchTree.h.

Libraries for TMVA::BinarySearchTree:
[legend]

The documentation for this class was generated from the following files: