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

Constructor & Destructor Documentation

GBRTree2D::GBRTree2D ( )
inline

Definition at line 35 of file GBRTree2D.h.

35 {}
GBRTree2D::~GBRTree2D ( )
inline

Definition at line 36 of file GBRTree2D.h.

36 {}

Member Function Documentation

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

Definition at line 47 of file GBRTree2D.h.

References fCutIndices.

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

Definition at line 48 of file GBRTree2D.h.

References fCutIndices.

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

Definition at line 50 of file GBRTree2D.h.

References fCutVals.

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

Definition at line 51 of file GBRTree2D.h.

References fCutVals.

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

Definition at line 74 of file GBRTree2D.h.

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

74  {
75 
76  int index = 0;
77 
78  unsigned short cutindex = fCutIndices[0];
79  float cutval = fCutVals[0];
80 
81  while (true) {
82 
83  if (vector[cutindex] > cutval) {
84  index = fRightIndices[index];
85  }
86  else {
87  index = fLeftIndices[index];
88  }
89 
90  if (index>0) {
91  cutindex = fCutIndices[index];
92  cutval = fCutVals[index];
93  }
94  else {
95  x = fResponsesX[-index];
96  y = fResponsesY[-index];
97  return;
98  }
99 
100  }
101 
102 
103 }
std::vector< float > fResponsesY
Definition: GBRTree2D.h:67
std::vector< int > fLeftIndices
Definition: GBRTree2D.h:64
std::vector< int > fRightIndices
Definition: GBRTree2D.h:65
std::vector< float > fResponsesX
Definition: GBRTree2D.h:66
std::vector< float > fCutVals
Definition: GBRTree2D.h:63
std::vector< unsigned short > fCutIndices
Definition: GBRTree2D.h:62
std::vector<int>& GBRTree2D::LeftIndices ( )
inline

Definition at line 53 of file GBRTree2D.h.

References fLeftIndices.

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

Definition at line 54 of file GBRTree2D.h.

References fLeftIndices.

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

Definition at line 41 of file GBRTree2D.h.

References fResponsesX.

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

Definition at line 42 of file GBRTree2D.h.

References fResponsesX.

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

Definition at line 44 of file GBRTree2D.h.

References fResponsesY.

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

Definition at line 45 of file GBRTree2D.h.

References fResponsesY.

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

Definition at line 56 of file GBRTree2D.h.

References fRightIndices.

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

Definition at line 57 of file GBRTree2D.h.

References fRightIndices.

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

Definition at line 106 of file GBRTree2D.h.

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

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

Friends And Related Function Documentation

friend class boost::serialization::access
friend

Definition at line 70 of file GBRTree2D.h.

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

Definition at line 70 of file GBRTree2D.h.

Member Data Documentation

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

Definition at line 62 of file GBRTree2D.h.

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

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

Definition at line 63 of file GBRTree2D.h.

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

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

Definition at line 64 of file GBRTree2D.h.

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

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

Definition at line 66 of file GBRTree2D.h.

Referenced by GetResponse(), and ResponsesX().

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

Definition at line 67 of file GBRTree2D.h.

Referenced by GetResponse(), and ResponsesY().

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

Definition at line 65 of file GBRTree2D.h.

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