CMS 3D CMS Logo

GBRForest2D.h
Go to the documentation of this file.
1 
2 #ifndef EGAMMAOBJECTS_GBRForest2D
3 #define EGAMMAOBJECTS_GBRForest2D
4 
6 // //
7 // GBRForest2D //
8 // //
9 // A fast minimal implementation of Gradient-Boosted Regression Trees //
10 // which has been especially optimized for size on disk and in memory. //
11 // //
12 // Designed to be built from TMVA-trained trees, but could also be //
13 // generalized to otherwise-trained trees, classification, //
14 // or other boosting methods in the future //
15 // //
16 // Josh Bendavid - MIT //
18 
20 
21 #include "GBRTree2D.h"
22 
23 #include <vector>
24 
25 class GBRForest2D {
26 public:
28 
29  void GetResponse(const float *vector, double &x, double &y) const;
30 
31  void SetInitialResponse(double x, double y) {
34  }
35 
36  std::vector<GBRTree2D> &Trees() { return fTrees; }
37  const std::vector<GBRTree2D> &Trees() const { return fTrees; }
38 
39 protected:
40  double fInitialResponseX = 0.0;
41  double fInitialResponseY = 0.0;
42  std::vector<GBRTree2D> fTrees;
43 
45 };
46 
47 //_______________________________________________________________________
48 inline void GBRForest2D::GetResponse(const float *vector, double &x, double &y) const {
51  double tx, ty;
52  for (std::vector<GBRTree2D>::const_iterator it = fTrees.begin(); it != fTrees.end(); ++it) {
53  it->GetResponse(vector, tx, ty);
54  x += tx;
55  y += ty;
56  }
57  return;
58 }
59 
60 #endif
DDAxes::y
GBRForest2D::GetResponse
void GetResponse(const float *vector, double &x, double &y) const
Definition: GBRForest2D.h:48
COND_SERIALIZABLE
#define COND_SERIALIZABLE
Definition: Serializable.h:39
GBRForest2D::SetInitialResponse
void SetInitialResponse(double x, double y)
Definition: GBRForest2D.h:31
DDAxes::x
GBRForest2D::fInitialResponseX
double fInitialResponseX
Definition: GBRForest2D.h:40
GBRForest2D::fInitialResponseY
double fInitialResponseY
Definition: GBRForest2D.h:41
GBRTree2D.h
GBRForest2D
Definition: GBRForest2D.h:25
GBRForest2D::Trees
std::vector< GBRTree2D > & Trees()
Definition: GBRForest2D.h:36
GBRForest2D::GBRForest2D
GBRForest2D()
Definition: GBRForest2D.h:27
Serializable.h
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
GBRForest2D::fTrees
std::vector< GBRTree2D > fTrees
Definition: GBRForest2D.h:42
GBRForest2D::Trees
const std::vector< GBRTree2D > & Trees() const
Definition: GBRForest2D.h:37
genVertex_cff.x
x
Definition: genVertex_cff.py:13
detailsBasic3DVector::y
float float y
Definition: extBasic3DVector.h:14