ROOT logo
ROOT » TMVA » TMVA::BinarySearchTree

class TMVA::BinarySearchTree: public TMVA::BinaryTree


BinarySearchTree

A simple Binary search tree including a volume search method


Function Members (Methods)

public:
virtual~BinarySearchTree()
virtual void*TMVA::BinaryTree::AddXMLTo(void* parent) const
TMVA::BinarySearchTreeBinarySearchTree()
TMVA::BinarySearchTreeBinarySearchTree(const TMVA::BinarySearchTree& b)
voidCalcStatistics(TMVA::Node* n = 0)
static TClass*Class()
virtual const char*ClassName() const
voidClear(TMVA::Node* n = 0)
UInt_tTMVA::BinaryTree::CountNodes(TMVA::Node* n = NULL)
static TMVA::BinarySearchTree*CreateFromXML(void* node, UInt_t tmva_Version_Code = TMVA_VERSION_CODE)
virtual TMVA::Node*CreateNode(UInt_t) const
virtual TMVA::BinaryTree*CreateTree() const
Double_tFill(const vector<TMVA::Event*>& events, Int_t theType = -1)
Double_tFill(const vector<TMVA::Event*>& events, const vector<Int_t>& theVars, Int_t theType = -1)
TMVA::Node*TMVA::BinaryTree::GetLeftDaughter(TMVA::Node* n)
UInt_tTMVA::BinaryTree::GetNNodes() const
UInt_tGetPeriode() const
TMVA::Node*TMVA::BinaryTree::GetRightDaughter(TMVA::Node* n)
virtual TMVA::Node*TMVA::BinaryTree::GetRoot() const
Double_tGetSumOfWeights() const
Double_tGetSumOfWeights(Int_t theType) const
UInt_tTMVA::BinaryTree::GetTotalTreeDepth() const
voidInsert(const TMVA::Event*)
virtual TClass*IsA() const
Float_tMax(TMVA::Types::ESBType sb, UInt_t var)
Float_tMean(TMVA::Types::ESBType sb, UInt_t var)
Float_tMin(TMVA::Types::ESBType sb, UInt_t var)
voidNormalizeTree()
TMVA::BinarySearchTree&operator=(const TMVA::BinarySearchTree&)
virtual voidTMVA::BinaryTree::Print(ostream& os) const
virtual voidTMVA::BinaryTree::Read(istream& istr, UInt_t tmva_Version_Code = TMVA_VERSION_CODE)
virtual voidTMVA::BinaryTree::ReadXML(void* node, UInt_t tmva_Version_Code = TMVA_VERSION_CODE)
Float_tRMS(UInt_t var)
Float_tRMS(TMVA::Types::ESBType sb, UInt_t var)
TMVA::BinarySearchTreeNode*Search(TMVA::Event* event) const
Double_tSearchVolume(TMVA::Volume*, vector<const TMVA::BinarySearchTreeNode*>* events = 0)
Int_tSearchVolumeWithMaxLimit(TMVA::Volume*, vector<const TMVA::BinarySearchTreeNode*>* events = 0, Int_t = -1)
voidSetNormalize(Bool_t norm)
voidSetPeriode(Int_t p)
voidTMVA::BinaryTree::SetRoot(TMVA::Node* r)
voidTMVA::BinaryTree::SetTotalTreeDepth(Int_t depth)
voidTMVA::BinaryTree::SetTotalTreeDepth(TMVA::Node* n = NULL)
virtual voidShowMembers(TMemberInspector& insp)
virtual voidStreamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)
private:
voidDestroyNode(TMVA::BinarySearchTreeNode*)
voidInsert(const TMVA::Event*, TMVA::Node*)
Bool_tInVolume(const vector<Float_t>&, TMVA::Volume*) const
voidNormalizeTree(vector<pair<double,const TMVA::Event*>,allocator<pair<double,const TMVA::Event*> > >::iterator, vector<pair<double,const TMVA::Event*>,allocator<pair<double,const TMVA::Event*> > >::iterator, UInt_t)
TMVA::BinarySearchTreeNode*Search(TMVA::Event*, TMVA::Node*) const
Double_tSearchVolume(TMVA::Node*, TMVA::Volume*, Int_t, vector<const TMVA::BinarySearchTreeNode*>* events)

Data Members

protected:
UInt_tTMVA::BinaryTree::fDepthmaximal depth in tree reached
UInt_tTMVA::BinaryTree::fNNodestotal number of nodes in the tree (counted)
TMVA::Node*TMVA::BinaryTree::fRootthe root node of the tree
static TMVA::MsgLogger*TMVA::BinaryTree::fgLoggermessage logger, static to save resources
private:
Bool_tfCanNormalizethe tree can be normalised
UInt_tfCurrentDepthinternal variable, counting the depth of the tree during insertion
vector<Float_t>fMax[2]RMS for signal and background for each variable
vector<Float_t>fMeans[2]mean for signal and background for each variable
vector<Float_t>fMin[2]RMS for signal and background for each variable
Double_tfNEventsW[2]Number of events per class, taking into account event weights
vector<std::pair<Double_t,const TMVA::Event*> >fNormalizeTreeTable
UInt_tfPeriodperiode (number of event variables)
vector<Float_t>fRMS[2]RMS for signal and background for each variable
Bool_tfStatisticsIsValidflag if last stat calculation is still valid, set to false if new node is insert
vector<Double_t>fSum[2]Sum for signal and background for each variable
Double_tfSumOfWeightsTotal number of events (weigthed) counted during filling
vector<Double_t>fSumSq[2]Squared Sum for signal and background for each variable

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

BinarySearchTree(const TMVA::BinarySearchTree& b)
 default constructor
BinarySearchTree(const TMVA::BinarySearchTree& b)
 copy constructor that creates a true copy, i.e. a completely independent tree
~BinarySearchTree( void )
 destructor
TMVA::BinarySearchTree* CreateFromXML(void* node, UInt_t tmva_Version_Code = TMVA_VERSION_CODE)
 re-create a new tree (decision tree or search tree) from XML
void Insert(const TMVA::Event* )
 insert a new "event" in the binary tree
void Insert(const TMVA::Event* , TMVA::Node* )
 private internal function to insert a event (node) at the proper position
TMVA::BinarySearchTreeNode* Search(TMVA::Event* event) const
search the tree to find the node matching "event"
TMVA::BinarySearchTreeNode* Search(TMVA::Event* , TMVA::Node* ) const
 Private, recursive, function for searching.
Double_t GetSumOfWeights(Int_t theType) const
return the sum of event (node) weights
Double_t GetSumOfWeights(Int_t theType) const
return the sum of event (node) weights
Double_t Fill(const vector<TMVA::Event*>& events, const 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 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
void NormalizeTree(vector<pair<double,const TMVA::Event*>,allocator<pair<double,const TMVA::Event*> > >::iterator , vector<pair<double,const TMVA::Event*>,allocator<pair<double,const TMVA::Event*> > >::iterator , UInt_t )
void NormalizeTree()
 Normalisation of tree
void Clear(TMVA::Node* n = 0)
 clear nodes
Double_t SearchVolume(TMVA::Volume* , vector<const TMVA::BinarySearchTreeNode*>* events = 0)
 search the whole tree and add up all weigths of events that
 lie within the given voluem
Double_t SearchVolume(TMVA::Node* , TMVA::Volume* , Int_t , vector<const TMVA::BinarySearchTreeNode*>* events)
 recursively walk through the daughter nodes and add up all weigths of events that
 lie within the given volume
Bool_t InVolume(const vector<Float_t>& , TMVA::Volume* ) const
 test if the data points are in the given volume
void CalcStatistics(TMVA::Node* n = 0)
 calculate basic statistics (mean, rms for each variable)
Int_t SearchVolumeWithMaxLimit(TMVA::Volume* , vector<const TMVA::BinarySearchTreeNode*>* events = 0, Int_t = -1)
 recursively walk through the daughter nodes and add up all weigths of events that
 lie within the given volume a maximum number of events can be given
Node * CreateNode(UInt_t ) const
{ return new BinarySearchTreeNode(); }
BinaryTree* CreateTree() const
{ return new BinarySearchTree(); }
const char* ClassName() const
{ return "BinarySearchTree"; }
void SetPeriode(Int_t p)
set the periode (number of variables)
{ fPeriod = p; }
UInt_t GetPeriode( void )
 return periode (number of variables)
{ return fPeriod; }
Float_t Mean(TMVA::Types::ESBType sb, UInt_t var)
 access to mean for signal and background for each variable
{ return fMeans[sb==Types::kSignal?0:1][var]; }
Float_t RMS(TMVA::Types::ESBType sb, UInt_t var)
 access to RMS for signal and background for each variable
{ return fRMS[sb==Types::kSignal?0:1][var]; }
Float_t Min(TMVA::Types::ESBType sb, UInt_t var)
 access to Minimum for signal and background for each variable
{ return fMin[sb==Types::kSignal?0:1][var]; }
Float_t Max(TMVA::Types::ESBType sb, UInt_t var)
 access to Maximum for signal and background for each variable
{ return fMax[sb==Types::kSignal?0:1][var]; }
Float_t RMS(UInt_t var)
 access to RMS for each variable
{ return fRMS[0][var]; }
void SetNormalize(Bool_t norm)
{ fCanNormalize = norm; }
void DestroyNode(TMVA::BinarySearchTreeNode* )