CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Attributes | Private Member Functions | Friends
GBRTree2D Class Reference

#include <GBRTree2D.h>

Public Member Functions

std::vector< unsigned short > & CutIndices ()
 
const std::vector< unsigned short > & CutIndices () const
 
std::vector< float > & CutVals ()
 
const std::vector< float > & CutVals () const
 
 GBRTree2D ()
 
void GetResponse (const float *vector, double &x, double &y) const
 
std::vector< int > & LeftIndices ()
 
const std::vector< int > & LeftIndices () const
 
std::vector< float > & ResponsesX ()
 
const std::vector< float > & ResponsesX () const
 
std::vector< float > & ResponsesY ()
 
const std::vector< float > & ResponsesY () const
 
std::vector< int > & RightIndices ()
 
const std::vector< int > & RightIndices () const
 
int TerminalIndex (const float *vector) const
 
 ~GBRTree2D ()
 

Protected Attributes

std::vector< unsigned short > fCutIndices
 
std::vector< float > fCutVals
 
std::vector< int > fLeftIndices
 
std::vector< float > fResponsesX
 
std::vector< float > fResponsesY
 
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 30 of file GBRTree2D.h.

Constructor & Destructor Documentation

GBRTree2D::GBRTree2D ( )
inline

Definition at line 32 of file GBRTree2D.h.

32 {}
GBRTree2D::~GBRTree2D ( )
inline

Definition at line 33 of file GBRTree2D.h.

References GetResponse(), TerminalIndex(), x, and y.

33 {}

Member Function Documentation

std::vector<unsigned short>& GBRTree2D::CutIndices ( )
inline

Definition at line 44 of file GBRTree2D.h.

References fCutIndices.

44 { return fCutIndices; }
std::vector< unsigned short > fCutIndices
Definition: GBRTree2D.h:57
const std::vector<unsigned short>& GBRTree2D::CutIndices ( ) const
inline

Definition at line 45 of file GBRTree2D.h.

References fCutIndices.

45 { return fCutIndices; }
std::vector< unsigned short > fCutIndices
Definition: GBRTree2D.h:57
std::vector<float>& GBRTree2D::CutVals ( )
inline

Definition at line 47 of file GBRTree2D.h.

References fCutVals.

47 { return fCutVals; }
std::vector< float > fCutVals
Definition: GBRTree2D.h:58
const std::vector<float>& GBRTree2D::CutVals ( ) const
inline

Definition at line 48 of file GBRTree2D.h.

References fCutVals.

48 { return fCutVals; }
std::vector< float > fCutVals
Definition: GBRTree2D.h:58
void GBRTree2D::GetResponse ( const float *  vector,
double &  x,
double &  y 
) const
inline

Definition at line 68 of file GBRTree2D.h.

References fCutIndices, fCutVals, fLeftIndices, fResponsesX, fResponsesY, and fRightIndices.

Referenced by ~GBRTree2D().

68  {
69  int index = 0;
70 
71  unsigned short cutindex = fCutIndices[0];
72  float cutval = fCutVals[0];
73 
74  while (true) {
75  if (vector[cutindex] > cutval) {
76  index = fRightIndices[index];
77  } else {
78  index = fLeftIndices[index];
79  }
80 
81  if (index > 0) {
82  cutindex = fCutIndices[index];
83  cutval = fCutVals[index];
84  } else {
85  x = fResponsesX[-index];
86  y = fResponsesY[-index];
87  return;
88  }
89  }
90 }
std::vector< float > fResponsesY
Definition: GBRTree2D.h:62
std::vector< int > fLeftIndices
Definition: GBRTree2D.h:59
std::vector< int > fRightIndices
Definition: GBRTree2D.h:60
std::vector< float > fResponsesX
Definition: GBRTree2D.h:61
std::vector< float > fCutVals
Definition: GBRTree2D.h:58
std::vector< unsigned short > fCutIndices
Definition: GBRTree2D.h:57
std::vector<int>& GBRTree2D::LeftIndices ( )
inline

Definition at line 50 of file GBRTree2D.h.

References fLeftIndices.

50 { return fLeftIndices; }
std::vector< int > fLeftIndices
Definition: GBRTree2D.h:59
const std::vector<int>& GBRTree2D::LeftIndices ( ) const
inline

Definition at line 51 of file GBRTree2D.h.

References fLeftIndices.

51 { return fLeftIndices; }
std::vector< int > fLeftIndices
Definition: GBRTree2D.h:59
std::vector<float>& GBRTree2D::ResponsesX ( )
inline

Definition at line 38 of file GBRTree2D.h.

References fResponsesX.

38 { return fResponsesX; }
std::vector< float > fResponsesX
Definition: GBRTree2D.h:61
const std::vector<float>& GBRTree2D::ResponsesX ( ) const
inline

Definition at line 39 of file GBRTree2D.h.

References fResponsesX.

39 { return fResponsesX; }
std::vector< float > fResponsesX
Definition: GBRTree2D.h:61
std::vector<float>& GBRTree2D::ResponsesY ( )
inline

Definition at line 41 of file GBRTree2D.h.

References fResponsesY.

41 { return fResponsesY; }
std::vector< float > fResponsesY
Definition: GBRTree2D.h:62
const std::vector<float>& GBRTree2D::ResponsesY ( ) const
inline

Definition at line 42 of file GBRTree2D.h.

References fResponsesY.

42 { return fResponsesY; }
std::vector< float > fResponsesY
Definition: GBRTree2D.h:62
std::vector<int>& GBRTree2D::RightIndices ( )
inline

Definition at line 53 of file GBRTree2D.h.

References fRightIndices.

53 { return fRightIndices; }
std::vector< int > fRightIndices
Definition: GBRTree2D.h:60
const std::vector<int>& GBRTree2D::RightIndices ( ) const
inline

Definition at line 54 of file GBRTree2D.h.

References fRightIndices.

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

Definition at line 93 of file GBRTree2D.h.

References fCutIndices, fCutVals, fLeftIndices, and fRightIndices.

Referenced by ~GBRTree2D().

93  {
94  int index = 0;
95 
96  unsigned short cutindex = fCutIndices[0];
97  float cutval = fCutVals[0];
98 
99  while (true) {
100  if (vector[cutindex] > cutval) {
101  index = fRightIndices[index];
102  } else {
103  index = fLeftIndices[index];
104  }
105 
106  if (index > 0) {
107  cutindex = fCutIndices[index];
108  cutval = fCutVals[index];
109  } else {
110  return (-index);
111  }
112  }
113 }
std::vector< int > fLeftIndices
Definition: GBRTree2D.h:59
std::vector< int > fRightIndices
Definition: GBRTree2D.h:60
std::vector< float > fCutVals
Definition: GBRTree2D.h:58
std::vector< unsigned short > fCutIndices
Definition: GBRTree2D.h:57

Friends And Related Function Documentation

friend class boost::serialization::access
friend

Definition at line 64 of file GBRTree2D.h.

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

Definition at line 64 of file GBRTree2D.h.

Member Data Documentation

std::vector<unsigned short> GBRTree2D::fCutIndices
protected

Definition at line 57 of file GBRTree2D.h.

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

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

Definition at line 58 of file GBRTree2D.h.

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

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

Definition at line 59 of file GBRTree2D.h.

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

std::vector<float> GBRTree2D::fResponsesX
protected

Definition at line 61 of file GBRTree2D.h.

Referenced by GetResponse(), and ResponsesX().

std::vector<float> GBRTree2D::fResponsesY
protected

Definition at line 62 of file GBRTree2D.h.

Referenced by GetResponse(), and ResponsesY().

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

Definition at line 60 of file GBRTree2D.h.

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