CMS 3D CMS Logo

Tree.h
Go to the documentation of this file.
1 // Tree.h
2 
3 #ifndef ADD_TREE
4 #define ADD_TREE
5 
6 #include <list>
8 #include "TXMLEngine.h"
13 
14 
15 //class Node;
16 
17 namespace emtf{
18  class Tree
19  {
20  public:
21  Tree();
22  Tree(std::vector< std::vector<Event*> >& cEvents);
23  ~Tree();
24 
25  void setRootNode(Node *sRootNode);
26  Node* getRootNode();
27 
28  void setTerminalNodes(std::list<Node*>& sTNodes);
29  std::list<Node*>& getTerminalNodes();
30 
31  Int_t getNumTerminalNodes();
32 
33  void buildTree(Int_t nodeLimit);
34  void calcError();
35  void filterEvents(std::vector<Event*>& tEvents);
36  void filterEventsRecursive(Node* node);
38  Node* filterEventRecursive(Node* node, Event* e);
39 
40  void saveToXML(const char* filename);
41  void saveToXMLRecursive(TXMLEngine* xml, Node* node, XMLNodePointer_t np);
42  void addXMLAttributes(TXMLEngine* xml, Node* node, XMLNodePointer_t np);
43 
44  void loadFromXML(const char* filename);
45  void loadFromXMLRecursive(TXMLEngine* xml, XMLNodePointer_t node, Node* tnode);
46 
47  void rankVariables(std::vector<Double_t>& v);
48  void rankVariablesRecursive(Node* node, std::vector<Double_t>& v);
49 
50  void getSplitValues(std::vector<std::vector<Double_t>>& v);
51  void getSplitValuesRecursive(Node* node, std::vector<std::vector<Double_t>>& v);
52 
53  private:
55  std::list<Node*> terminalNodes;
57  Double_t rmsError;
58  };
59 }
60 
61 #endif
Node * filterEventRecursive(Node *node, Event *e)
Definition: Tree.cc:215
std::list< Node * > terminalNodes
Definition: Tree.h:55
void getSplitValues(std::vector< std::vector< Double_t >> &v)
Definition: Tree.cc:301
Tree()
Definition: Tree.cc:28
void loadFromXMLRecursive(TXMLEngine *xml, XMLNodePointer_t node, Node *tnode)
Definition: Tree.cc:407
void addXMLAttributes(TXMLEngine *xml, Node *node, XMLNodePointer_t np)
Definition: Tree.cc:322
Node * getRootNode()
Definition: Tree.cc:64
Definition: Event.h:15
void getSplitValuesRecursive(Node *node, std::vector< std::vector< Double_t >> &v)
Definition: Tree.cc:271
void rankVariables(std::vector< Double_t > &v)
Definition: Tree.cc:263
void setTerminalNodes(std::list< Node * > &sTNodes)
Definition: Tree.cc:71
int np
Definition: AMPTWrapper.h:33
void saveToXMLRecursive(TXMLEngine *xml, Node *node, XMLNodePointer_t np)
Definition: Tree.cc:359
Int_t numTerminalNodes
Definition: Tree.h:56
Int_t getNumTerminalNodes()
Definition: Tree.cc:83
std::list< Node * > & getTerminalNodes()
Definition: Tree.cc:76
void filterEventsRecursive(Node *node)
Definition: Tree.cc:185
void buildTree(Int_t nodeLimit)
Definition: Tree.cc:108
void calcError()
Definition: Tree.cc:92
Node * filterEvent(Event *e)
Definition: Tree.cc:203
void loadFromXML(const char *filename)
Definition: Tree.cc:381
Double_t rmsError
Definition: Tree.h:57
void saveToXML(const char *filename)
Definition: Tree.cc:333
Node * rootNode
Definition: Tree.h:54
void rankVariablesRecursive(Node *node, std::vector< Double_t > &v)
Definition: Tree.cc:230
void filterEvents(std::vector< Event * > &tEvents)
Definition: Tree.cc:169
void setRootNode(Node *sRootNode)
Definition: Tree.cc:59
~Tree()
Definition: Tree.cc:48