CondFormats
EgammaObjects
interface
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
19
#include "
CondFormats/Serialization/interface/Serializable.h
"
20
21
#include "
GBRTree2D.h
"
22
#include <cstdio>
23
#include <vector>
24
25
class
GBRForest2D
{
26
public
:
27
GBRForest2D
();
28
~GBRForest2D
() {}
29
30
void
GetResponse
(
const
float
*
vector
,
double
&
x
,
double
&
y
)
const
;
31
32
void
SetInitialResponse
(
double
x
,
double
y
) {
33
fInitialResponseX
=
x
;
34
fInitialResponseY
=
y
;
35
}
36
37
std::vector<GBRTree2D> &
Trees
() {
return
fTrees
; }
38
const
std::vector<GBRTree2D> &
Trees
()
const
{
return
fTrees
; }
39
40
protected
:
41
double
fInitialResponseX
;
42
double
fInitialResponseY
;
43
std::vector<GBRTree2D>
fTrees
;
44
45
COND_SERIALIZABLE
;
46
};
47
48
//_______________________________________________________________________
49
inline
void
GBRForest2D::GetResponse
(
const
float
*
vector
,
double
&
x
,
double
&
y
)
const
{
50
x
=
fInitialResponseX
;
51
y
=
fInitialResponseY
;
52
double
tx, ty;
53
for
(std::vector<GBRTree2D>::const_iterator it =
fTrees
.begin(); it !=
fTrees
.end(); ++it) {
54
it->GetResponse(
vector
, tx, ty);
55
x
+= tx;
56
y
+= ty;
57
}
58
return
;
59
}
60
61
#endif
DDAxes::y
GBRForest2D::GetResponse
void GetResponse(const float *vector, double &x, double &y) const
Definition:
GBRForest2D.h:49
GBRForest2D::~GBRForest2D
~GBRForest2D()
Definition:
GBRForest2D.h:28
COND_SERIALIZABLE
#define COND_SERIALIZABLE
Definition:
Serializable.h:39
GBRForest2D::SetInitialResponse
void SetInitialResponse(double x, double y)
Definition:
GBRForest2D.h:32
DDAxes::x
GBRForest2D::fInitialResponseX
double fInitialResponseX
Definition:
GBRForest2D.h:41
GBRForest2D::fInitialResponseY
double fInitialResponseY
Definition:
GBRForest2D.h:42
GBRTree2D.h
GBRForest2D
Definition:
GBRForest2D.h:25
GBRForest2D::Trees
std::vector< GBRTree2D > & Trees()
Definition:
GBRForest2D.h:37
GBRForest2D::GBRForest2D
GBRForest2D()
Serializable.h
trackerHitRTTI::vector
Definition:
trackerHitRTTI.h:21
GBRForest2D::fTrees
std::vector< GBRTree2D > fTrees
Definition:
GBRForest2D.h:43
GBRForest2D::Trees
const std::vector< GBRTree2D > & Trees() const
Definition:
GBRForest2D.h:38
genVertex_cff.x
x
Definition:
genVertex_cff.py:12
detailsBasic3DVector::y
float float y
Definition:
extBasic3DVector.h:14
Generated for CMSSW Reference Manual by
1.8.16