CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
 

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 29 of file GBRTree2D.h.

Constructor & Destructor Documentation

GBRTree2D::GBRTree2D ( )
inline

Definition at line 31 of file GBRTree2D.h.

31 {}

Member Function Documentation

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

Definition at line 42 of file GBRTree2D.h.

References fCutIndices.

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

Definition at line 43 of file GBRTree2D.h.

References fCutIndices.

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

Definition at line 45 of file GBRTree2D.h.

References fCutVals.

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

Definition at line 46 of file GBRTree2D.h.

References fCutVals.

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

Definition at line 66 of file GBRTree2D.h.

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

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

Definition at line 48 of file GBRTree2D.h.

References fLeftIndices.

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

Definition at line 49 of file GBRTree2D.h.

References fLeftIndices.

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

Definition at line 36 of file GBRTree2D.h.

References fResponsesX.

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

Definition at line 37 of file GBRTree2D.h.

References fResponsesX.

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

Definition at line 39 of file GBRTree2D.h.

References fResponsesY.

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

Definition at line 40 of file GBRTree2D.h.

References fResponsesY.

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

Definition at line 51 of file GBRTree2D.h.

References fRightIndices.

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

Definition at line 52 of file GBRTree2D.h.

References fRightIndices.

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

Definition at line 91 of file GBRTree2D.h.

References fCutIndices, fCutVals, fLeftIndices, and fRightIndices.

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

Friends And Related Function Documentation

friend class boost::serialization::access
friend

Definition at line 62 of file GBRTree2D.h.

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

Definition at line 62 of file GBRTree2D.h.

Member Data Documentation

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

Definition at line 55 of file GBRTree2D.h.

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

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

Definition at line 56 of file GBRTree2D.h.

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

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

Definition at line 57 of file GBRTree2D.h.

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

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

Definition at line 59 of file GBRTree2D.h.

Referenced by GetResponse(), and ResponsesX().

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

Definition at line 60 of file GBRTree2D.h.

Referenced by GetResponse(), and ResponsesY().

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

Definition at line 58 of file GBRTree2D.h.

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