CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Protected Attributes

GBRTree Class Reference

#include <GBRTree.h>

List of all members.

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]
const std::vector<unsigned char>& GBRTree::CutIndices ( ) const [inline]

Definition at line 49 of file GBRTree.h.

References fCutIndices.

{ return fCutIndices; }
std::vector<unsigned char>& GBRTree::CutIndices ( ) [inline]

Definition at line 48 of file GBRTree.h.

References fCutIndices.

{ return fCutIndices; }
const std::vector<float>& GBRTree::CutVals ( ) const [inline]

Definition at line 52 of file GBRTree.h.

References fCutVals.

{ return fCutVals; }
std::vector<float>& GBRTree::CutVals ( ) [inline]

Definition at line 51 of file GBRTree.h.

References fCutVals.

{ return fCutVals; }
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.

                                                            {
  
  int index = 0;
  
  unsigned char cutindex = fCutIndices[0];
  float cutval = fCutVals[0];
  
  while (true) {
     
    if (vector[cutindex] > cutval) {
      index = fRightIndices[index];
    }
    else {
      index = fLeftIndices[index];
    }
    
    if (index>0) {
      cutindex = fCutIndices[index];
      cutval = fCutVals[index];
    }
    else {
      return fResponses[-index];
    }
    
  }
  

}
std::vector<int>& GBRTree::LeftIndices ( ) [inline]

Definition at line 54 of file GBRTree.h.

References fLeftIndices.

{ return fLeftIndices; }
const std::vector<int>& GBRTree::LeftIndices ( ) const [inline]

Definition at line 55 of file GBRTree.h.

References fLeftIndices.

{ return fLeftIndices; } 
std::vector<float>& GBRTree::Responses ( ) [inline]

Definition at line 45 of file GBRTree.h.

References fResponses.

{ return fResponses; }       
const std::vector<float>& GBRTree::Responses ( ) const [inline]

Definition at line 46 of file GBRTree.h.

References fResponses.

{ return fResponses; }
std::vector<int>& GBRTree::RightIndices ( ) [inline]

Definition at line 57 of file GBRTree.h.

References fRightIndices.

{ return fRightIndices; }
const std::vector<int>& GBRTree::RightIndices ( ) const [inline]

Definition at line 58 of file GBRTree.h.

References fRightIndices.

{ return fRightIndices; }
int GBRTree::TerminalIndex ( const float *  vector) const [inline]

Definition at line 107 of file GBRTree.h.

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

                                                           {
  
  int index = 0;
  
  unsigned char cutindex = fCutIndices[0];
  float cutval = fCutVals[0];
  
  while (true) {
    if (vector[cutindex] > cutval) {
      index = fRightIndices[index];
    }
    else {
      index = fLeftIndices[index];
    }
    
    if (index>0) {
      cutindex = fCutIndices[index];
      cutval = fCutVals[index];
    }
    else {
      return (-index);
    }
    
  }
  

}

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().