CMS 3D CMS Logo

List of all members | Public 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 (int nIntermediate, int nTerminal)
 
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
 

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

Constructor & Destructor Documentation

◆ GBRTree() [1/2]

GBRTree::GBRTree ( )
inline

Definition at line 31 of file GBRTree.h.

31 {}

◆ GBRTree() [2/2]

GBRTree::GBRTree ( int  nIntermediate,
int  nTerminal 
)
explicit

Definition at line 4 of file GBRTree.cc.

References fCutIndices, fCutVals, fLeftIndices, fResponses, and fRightIndices.

4  {
5  //special case, root node is terminal
6  if (nIntermediate == 0)
7  nIntermediate = 1;
8 
9  fCutIndices.reserve(nIntermediate);
10  fCutVals.reserve(nIntermediate);
11  fLeftIndices.reserve(nIntermediate);
12  fRightIndices.reserve(nIntermediate);
13  fResponses.reserve(nTerminal);
14 }
std::vector< int > fRightIndices
Definition: GBRTree.h:55
std::vector< float > fResponses
Definition: GBRTree.h:56
std::vector< float > fCutVals
Definition: GBRTree.h:53
std::vector< int > fLeftIndices
Definition: GBRTree.h:54
std::vector< unsigned char > fCutIndices
Definition: GBRTree.h:52

Member Function Documentation

◆ CutIndices() [1/2]

std::vector<unsigned char>& GBRTree::CutIndices ( )
inline

Definition at line 39 of file GBRTree.h.

References fCutIndices.

39 { return fCutIndices; }
std::vector< unsigned char > fCutIndices
Definition: GBRTree.h:52

◆ CutIndices() [2/2]

const std::vector<unsigned char>& GBRTree::CutIndices ( ) const
inline

Definition at line 40 of file GBRTree.h.

References fCutIndices.

40 { return fCutIndices; }
std::vector< unsigned char > fCutIndices
Definition: GBRTree.h:52

◆ CutVals() [1/2]

std::vector<float>& GBRTree::CutVals ( )
inline

Definition at line 42 of file GBRTree.h.

References fCutVals.

42 { return fCutVals; }
std::vector< float > fCutVals
Definition: GBRTree.h:53

◆ CutVals() [2/2]

const std::vector<float>& GBRTree::CutVals ( ) const
inline

Definition at line 43 of file GBRTree.h.

References fCutVals.

43 { return fCutVals; }
std::vector< float > fCutVals
Definition: GBRTree.h:53

◆ GetResponse()

double GBRTree::GetResponse ( const float *  vector) const
inline

Definition at line 62 of file GBRTree.h.

References fCutIndices, fCutVals, fLeftIndices, fResponses, fRightIndices, MainPageGenerator::l, alignCSCRings::r, trackerHitRTTI::vector, and x.

62  {
63  int index = 0;
64  do {
65  auto r = fRightIndices[index];
66  auto l = fLeftIndices[index];
67  unsigned int x = vector[fCutIndices[index]] > fCutVals[index] ? ~0 : 0;
68  index = (x & r) | ((~x) & l);
69  } while (index > 0);
70  return fResponses[-index];
71 }
std::vector< int > fRightIndices
Definition: GBRTree.h:55
std::vector< float > fResponses
Definition: GBRTree.h:56
std::vector< float > fCutVals
Definition: GBRTree.h:53
std::vector< int > fLeftIndices
Definition: GBRTree.h:54
std::vector< unsigned char > fCutIndices
Definition: GBRTree.h:52

◆ LeftIndices() [1/2]

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

Definition at line 45 of file GBRTree.h.

References fLeftIndices.

45 { return fLeftIndices; }
std::vector< int > fLeftIndices
Definition: GBRTree.h:54

◆ LeftIndices() [2/2]

const std::vector<int>& GBRTree::LeftIndices ( ) const
inline

Definition at line 46 of file GBRTree.h.

References fLeftIndices.

46 { return fLeftIndices; }
std::vector< int > fLeftIndices
Definition: GBRTree.h:54

◆ Responses() [1/2]

std::vector<float>& GBRTree::Responses ( )
inline

Definition at line 36 of file GBRTree.h.

References fResponses.

36 { return fResponses; }
std::vector< float > fResponses
Definition: GBRTree.h:56

◆ Responses() [2/2]

const std::vector<float>& GBRTree::Responses ( ) const
inline

Definition at line 37 of file GBRTree.h.

References fResponses.

37 { return fResponses; }
std::vector< float > fResponses
Definition: GBRTree.h:56

◆ RightIndices() [1/2]

std::vector<int>& GBRTree::RightIndices ( )
inline

Definition at line 48 of file GBRTree.h.

References fRightIndices.

48 { return fRightIndices; }
std::vector< int > fRightIndices
Definition: GBRTree.h:55

◆ RightIndices() [2/2]

const std::vector<int>& GBRTree::RightIndices ( ) const
inline

Definition at line 49 of file GBRTree.h.

References fRightIndices.

49 { return fRightIndices; }
std::vector< int > fRightIndices
Definition: GBRTree.h:55

◆ serialize()

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

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Definition at line 58 of file GBRTree.h.

◆ cond::serialization::access

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

Definition at line 58 of file GBRTree.h.

Member Data Documentation

◆ fCutIndices

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

Definition at line 52 of file GBRTree.h.

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

◆ fCutVals

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

Definition at line 53 of file GBRTree.h.

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

◆ fLeftIndices

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

Definition at line 54 of file GBRTree.h.

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

◆ fResponses

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

Definition at line 56 of file GBRTree.h.

Referenced by GBRTree(), GetResponse(), and Responses().

◆ fRightIndices

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

Definition at line 55 of file GBRTree.h.

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