CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
GBRTree Class Reference

#include <GBRTree.h>

Public Member Functions

std::vector< unsigned char > & CutIndices ()
 
const std::vector< unsigned
char > & 
CutIndices () const
 
std::vector< float > & CutVals ()
 
const std::vector< float > & CutVals () const
 
 GBRTree ()
 
 GBRTree (const TMVA::DecisionTree *tree)
 
double GetResponse (const float *vector) const
 
std::vector< int > & LeftIndices ()
 
const std::vector< int > & LeftIndices () const
 
std::vector< float > & Responses ()
 
const std::vector< float > & Responses () const
 
std::vector< int > & RightIndices ()
 
const std::vector< int > & RightIndices () const
 
int TerminalIndex (const float *vector) const
 
virtual ~GBRTree ()
 

Protected Member Functions

void AddNode (const TMVA::DecisionTreeNode *node)
 
unsigned int CountIntermediateNodes (const TMVA::DecisionTreeNode *node)
 
unsigned int CountTerminalNodes (const TMVA::DecisionTreeNode *node)
 

Protected Attributes

std::vector< unsigned char > fCutIndices
 
std::vector< float > fCutVals
 
std::vector< int > fLeftIndices
 
std::vector< float > fResponses
 
std::vector< int > fRightIndices
 

Detailed Description

Definition at line 34 of file GBRTree.h.

Constructor & Destructor Documentation

GBRTree::GBRTree ( )
GBRTree::GBRTree ( const TMVA::DecisionTree *  tree)
explicit
virtual GBRTree::~GBRTree ( )
virtual

Member Function Documentation

void GBRTree::AddNode ( const TMVA::DecisionTreeNode *  node)
protected
unsigned int GBRTree::CountIntermediateNodes ( const TMVA::DecisionTreeNode *  node)
protected
unsigned int GBRTree::CountTerminalNodes ( const TMVA::DecisionTreeNode *  node)
protected
std::vector<unsigned char>& GBRTree::CutIndices ( )
inline

Definition at line 48 of file GBRTree.h.

References fCutIndices.

48 { return fCutIndices; }
std::vector< unsigned char > fCutIndices
Definition: GBRTree.h:68
const std::vector<unsigned char>& GBRTree::CutIndices ( ) const
inline

Definition at line 49 of file GBRTree.h.

References fCutIndices.

49 { return fCutIndices; }
std::vector< unsigned char > fCutIndices
Definition: GBRTree.h:68
std::vector<float>& GBRTree::CutVals ( )
inline

Definition at line 51 of file GBRTree.h.

References fCutVals.

51 { return fCutVals; }
std::vector< float > fCutVals
Definition: GBRTree.h:69
const std::vector<float>& GBRTree::CutVals ( ) const
inline

Definition at line 52 of file GBRTree.h.

References fCutVals.

52 { return fCutVals; }
std::vector< float > fCutVals
Definition: GBRTree.h:69
double GBRTree::GetResponse ( const float *  vector) const
inline

Definition at line 77 of file GBRTree.h.

References fCutIndices, fCutVals, fLeftIndices, fResponses, fRightIndices, and getHLTprescales::index.

77  {
78 
79  int index = 0;
80 
81  unsigned char cutindex = fCutIndices[0];
82  float cutval = fCutVals[0];
83 
84  while (true) {
85 
86  if (vector[cutindex] > cutval) {
87  index = fRightIndices[index];
88  }
89  else {
90  index = fLeftIndices[index];
91  }
92 
93  if (index>0) {
94  cutindex = fCutIndices[index];
95  cutval = fCutVals[index];
96  }
97  else {
98  return fResponses[-index];
99  }
100 
101  }
102 
103 
104 }
std::vector< int > fRightIndices
Definition: GBRTree.h:71
std::vector< float > fResponses
Definition: GBRTree.h:72
std::vector< float > fCutVals
Definition: GBRTree.h:69
std::vector< int > fLeftIndices
Definition: GBRTree.h:70
std::vector< unsigned char > fCutIndices
Definition: GBRTree.h:68
std::vector<int>& GBRTree::LeftIndices ( )
inline

Definition at line 54 of file GBRTree.h.

References fLeftIndices.

54 { return fLeftIndices; }
std::vector< int > fLeftIndices
Definition: GBRTree.h:70
const std::vector<int>& GBRTree::LeftIndices ( ) const
inline

Definition at line 55 of file GBRTree.h.

References fLeftIndices.

55 { return fLeftIndices; }
std::vector< int > fLeftIndices
Definition: GBRTree.h:70
std::vector<float>& GBRTree::Responses ( )
inline

Definition at line 45 of file GBRTree.h.

References fResponses.

45 { return fResponses; }
std::vector< float > fResponses
Definition: GBRTree.h:72
const std::vector<float>& GBRTree::Responses ( ) const
inline

Definition at line 46 of file GBRTree.h.

References fResponses.

46 { return fResponses; }
std::vector< float > fResponses
Definition: GBRTree.h:72
std::vector<int>& GBRTree::RightIndices ( )
inline

Definition at line 57 of file GBRTree.h.

References fRightIndices.

57 { return fRightIndices; }
std::vector< int > fRightIndices
Definition: GBRTree.h:71
const std::vector<int>& GBRTree::RightIndices ( ) const
inline

Definition at line 58 of file GBRTree.h.

References fRightIndices.

58 { return fRightIndices; }
std::vector< int > fRightIndices
Definition: GBRTree.h:71
int GBRTree::TerminalIndex ( const float *  vector) const
inline

Definition at line 107 of file GBRTree.h.

References fCutIndices, fCutVals, fLeftIndices, fRightIndices, and getHLTprescales::index.

107  {
108 
109  int index = 0;
110 
111  unsigned char cutindex = fCutIndices[0];
112  float cutval = fCutVals[0];
113 
114  while (true) {
115  if (vector[cutindex] > cutval) {
116  index = fRightIndices[index];
117  }
118  else {
119  index = fLeftIndices[index];
120  }
121 
122  if (index>0) {
123  cutindex = fCutIndices[index];
124  cutval = fCutVals[index];
125  }
126  else {
127  return (-index);
128  }
129 
130  }
131 
132 
133 }
std::vector< int > fRightIndices
Definition: GBRTree.h:71
std::vector< float > fCutVals
Definition: GBRTree.h:69
std::vector< int > fLeftIndices
Definition: GBRTree.h:70
std::vector< unsigned char > fCutIndices
Definition: GBRTree.h:68

Member Data Documentation

std::vector<unsigned char> GBRTree::fCutIndices
protected

Definition at line 68 of file GBRTree.h.

Referenced by CutIndices(), GetResponse(), and TerminalIndex().

std::vector<float> GBRTree::fCutVals
protected

Definition at line 69 of file GBRTree.h.

Referenced by CutVals(), GetResponse(), and TerminalIndex().

std::vector<int> GBRTree::fLeftIndices
protected

Definition at line 70 of file GBRTree.h.

Referenced by GetResponse(), LeftIndices(), and TerminalIndex().

std::vector<float> GBRTree::fResponses
protected

Definition at line 72 of file GBRTree.h.

Referenced by GetResponse(), and Responses().

std::vector<int> GBRTree::fRightIndices
protected

Definition at line 71 of file GBRTree.h.

Referenced by GetResponse(), RightIndices(), and TerminalIndex().