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 | Private Member Functions | Friends
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 scale, bool useyesnoleaf, bool adjustboundary)
 
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, double scale, bool isregression, bool useyesnoleaf, bool adjustboundary)
 
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
 

Private Member Functions

template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Friends

class boost::serialization::access
 
template<typename CondSerializationT , typename Enabled >
struct cond::serialization::access
 

Detailed Description

Definition at line 36 of file GBRTree.h.

Constructor & Destructor Documentation

GBRTree::GBRTree ( )
GBRTree::GBRTree ( const TMVA::DecisionTree *  tree,
double  scale,
bool  useyesnoleaf,
bool  adjustboundary 
)
explicit
virtual GBRTree::~GBRTree ( )
virtual

Member Function Documentation

void GBRTree::AddNode ( const TMVA::DecisionTreeNode *  node,
double  scale,
bool  isregression,
bool  useyesnoleaf,
bool  adjustboundary 
)
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 50 of file GBRTree.h.

References fCutIndices.

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

Definition at line 51 of file GBRTree.h.

References fCutIndices.

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

Definition at line 53 of file GBRTree.h.

References fCutVals.

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

Definition at line 54 of file GBRTree.h.

References fCutVals.

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

Definition at line 81 of file GBRTree.h.

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

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

Definition at line 56 of file GBRTree.h.

References fLeftIndices.

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

Definition at line 57 of file GBRTree.h.

References fLeftIndices.

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

Definition at line 47 of file GBRTree.h.

References fResponses.

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

Definition at line 48 of file GBRTree.h.

References fResponses.

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

Definition at line 59 of file GBRTree.h.

References fRightIndices.

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

Definition at line 60 of file GBRTree.h.

References fRightIndices.

60 { return fRightIndices; }
std::vector< int > fRightIndices
Definition: GBRTree.h:73
template<class Archive >
void GBRTree::serialize ( Archive &  ar,
const unsigned int  version 
)
private
int GBRTree::TerminalIndex ( const float *  vector) const
inline

Definition at line 111 of file GBRTree.h.

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

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

Friends And Related Function Documentation

friend class boost::serialization::access
friend

Definition at line 77 of file GBRTree.h.

template<typename CondSerializationT , typename Enabled >
friend struct cond::serialization::access
friend

Definition at line 77 of file GBRTree.h.

Member Data Documentation

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

Definition at line 70 of file GBRTree.h.

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

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

Definition at line 71 of file GBRTree.h.

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

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

Definition at line 72 of file GBRTree.h.

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

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

Definition at line 74 of file GBRTree.h.

Referenced by GetResponse(), and Responses().

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

Definition at line 73 of file GBRTree.h.

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