96 Double_t totalSquaredError = 0;
100 totalSquaredError += (*it)->getTotalError();
110 Double_t bestNodeErrorReduction = -1;
122 if( (*it)->getErrorReduction() > bestNodeErrorReduction )
124 bestNodeErrorReduction = (*it)->getErrorReduction();
187 if(left == 0 || right == 0)
return;
207 if(left==0 || right==0)
return;
232 template <
typename T>
236 std::stringstream
ss;
258 TXMLEngine* xml =
new TXMLEngine();
268 XMLDocPointer_t
xmldoc = xml->NewDoc();
269 xml->DocSetRootElement(xmldoc, root);
272 xml->SaveDoc(xmldoc, c);
275 xml->FreeDoc(xmldoc);
286 if(l==0 || r==0)
return;
289 XMLNodePointer_t left = xml->NewChild(np, 0,
"left");
290 XMLNodePointer_t right = xml->NewChild(np, 0,
"right");
306 TXMLEngine* xml =
new TXMLEngine();
309 XMLDocPointer_t
xmldoc = xml->ParseFile(filename);
317 XMLNodePointer_t mainnode = xml->DocGetRootElement(xmldoc);
323 xml->FreeDoc(xmldoc);
333 XMLAttrPointer_t attr = xml->GetFirstAttr(xnode);
334 std::vector<std::string> splitInfo(3);
335 for(
unsigned int i=0;
i<3;
i++)
337 splitInfo[
i] = xml->GetAttrValue(attr);
338 attr = xml->GetNextAttr(attr);
342 std::stringstream converter;
347 converter << splitInfo[0];
348 converter >> splitVar;
352 converter << splitInfo[1];
353 converter >> splitVal;
357 converter << splitInfo[2];
368 XMLNodePointer_t xleft = xml->GetChild(xnode);
369 XMLNodePointer_t xright = xml->GetNext(xleft);
372 if(xleft == 0 || xright == 0)
return;
void filterEventsRecursive(Node *node)
void rankVariablesRecursive(Node *node, std::vector< Double_t > &v)
void loadFromXML(const char *filename)
void setSplitValue(Double_t sSplitValue)
void setTerminalNodes(std::list< Node * > &sTNodes)
std::list< Node * > terminalNodes
void buildTree(Int_t nodeLimit)
void saveToXMLRecursive(TXMLEngine *xml, Node *node, XMLNodePointer_t np)
void theMiracleOfChildBirth()
Node * getRightDaughter()
void setRootNode(Node *sRootNode)
void filterEventsToDaughters()
std::vector< std::vector< Event * > > & getEvents()
void setEvents(std::vector< std::vector< Event * > > &sEvents)
Double_t getErrorReduction()
void setFitValue(Double_t sFitValue)
std::list< Node * > & getTerminalNodes()
void addXMLAttributes(TXMLEngine *xml, Node *node, XMLNodePointer_t np)
void filterEvents(std::vector< Event * > &tEvents)
void setSplitVariable(Int_t sSplitVar)
void rankVariables(std::vector< Double_t > &v)
edm::TrieNode< PDet > Node
void saveToXML(const char *filename)
std::string numToStr(T num)
void loadFromXMLRecursive(TXMLEngine *xml, XMLNodePointer_t node, Node *tnode)
Int_t getNumTerminalNodes()