66 this->DeleteNode( fRoot );
76 this->DeleteNode(node->
GetLeft());
88 return (
Node*)
n->GetLeft();
96 return (
Node*)
n->GetRight();
105 n = (
Node*)this->GetRoot();
106 if (
n ==
NULL)
return 0 ;
111 if (this->GetLeftDaughter(
n) !=
NULL){
112 countNodes += this->CountNodes( this->GetLeftDaughter(
n) );
114 if (this->GetRightDaughter(
n) !=
NULL) {
115 countNodes += this->CountNodes( this->GetRightDaughter(
n) );
126 this->GetRoot()->PrintRec(os);
127 os <<
"-1" << std::endl;
136 this->GetRoot()->AddXMLTo(
bdt);
144 this->DeleteNode( fRoot );
150 this->SetTotalTreeDepth();
170 Node * currentNode = GetRoot();
175 SetRoot(currentNode);
181 this->SetTotalTreeDepth();
190 if (currentNode->
GetPos()==
'l') parent->
SetLeft(currentNode);
194 parent = currentNode;
215 n = (
Node*) this->GetRoot();
217 Log() << kFATAL <<
"SetTotalTreeDepth: started with undefined ROOT node" <<
Endl;
221 if (this->GetLeftDaughter(
n) !=
NULL){
222 this->SetTotalTreeDepth( this->GetLeftDaughter(
n) );
224 if (this->GetRightDaughter(
n) !=
NULL) {
225 this->SetTotalTreeDepth( this->GetRightDaughter(
n) );
227 if (
n->GetDepth() >
this->GetTotalTreeDepth()) this->SetTotalTreeDepth(
n->GetDepth());
static ROOT::Experimental::RTreeMapBase::Node CreateNode(const ROOT::Experimental::RNTupleInspector &insp, const ROOT::RFieldDescriptor &fldDesc, std::uint64_t childrenIdx, std::uint64_t nChildren, ROOT::DescriptorId_t rootId, size_t rootSize)
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Base class for BinarySearch and Decision Trees.
UInt_t CountNodes(Node *n=nullptr)
return the number of nodes in the tree. (make a new count --> takes time)
Node * GetLeftDaughter(Node *n)
get left daughter node current node "n"
Node * GetRightDaughter(Node *n)
get right daughter node current node "n"
virtual void * AddXMLTo(void *parent) const
add attributes to XML
BinaryTree(void)
constructor for a yet "empty" tree. Needs to be filled afterwards
void DeleteNode(Node *)
protected, recursive, function used by the class destructor and when Pruning
void SetTotalTreeDepth(Int_t depth)
virtual void Print(std::ostream &os) const
recursively print the tree
virtual ~BinaryTree()
destructor (deletes the nodes and "events" if owned by the tree
virtual void ReadXML(void *node, UInt_t tmva_Version_Code=262657)
read attributes from XML
virtual void Read(std::istream &istr, UInt_t tmva_Version_Code=262657)
Read the binary tree from an input stream.
ostringstream derivative to redirect and format output
Node for the BinarySearch or Decision Trees.
virtual Node * GetLeft() const
virtual Node * GetParent() const
virtual void SetRight(Node *r)
virtual void SetLeft(Node *l)
virtual void SetParent(Node *p)
virtual Bool_t ReadDataRecord(std::istream &, UInt_t tmva_Version_Code=262657)=0
virtual Node * GetRight() const
std::istream & operator>>(std::istream &istr, BinaryTree &tree)
std::ostream & operator<<(std::ostream &os, const BinaryTree &tree)
MsgLogger & Endl(MsgLogger &ml)