Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
src
RecoLocalMuon
DTSegment
src
DTLinearFit.cc
Go to the documentation of this file.
1
8
/* This Class Header */
9
#include "
RecoLocalMuon/DTSegment/src/DTLinearFit.h
"
10
11
/* Collaborating Class Header */
12
13
/* C++ Headers */
14
using namespace
std;
15
16
/* ====================================================================== */
17
19
DTLinearFit::DTLinearFit
() {
20
21
}
22
24
DTLinearFit::~DTLinearFit
() {
25
}
26
27
/* Operations */
28
void
DTLinearFit::fit
(
const
vector<float> &
x
,
29
const
vector<float> &
y
,
30
int
ndat,
31
const
vector<float> & sigy,
32
float
&
slope
,
33
float
& intercept,
34
float
& covss,
35
float
& covii,
36
float
& covsi)
const
37
{
38
39
float
g1
= 0,
g2
= 0;
40
float
s11 = 0, s12 = 0, s22 = 0;
41
for
(
int
i
= 0;
i
!= ndat;
i
++) {
42
float
sy2 = sigy[
i
] * sigy[
i
];
43
g1 += y[
i
] / sy2;
44
g2
+= x[
i
]*y[
i
] / sy2;
45
s11 += 1. / sy2;
46
s12 += x[
i
] / sy2;
47
s22 += x[
i
]*x[
i
] / sy2;
48
}
49
50
float
d = s11*s22 - s12*s12;
51
intercept = (g1*s22 -
g2
*s12) / d;
52
slope = (
g2
*s11 - g1*s12) / d;
53
54
covii = s22 / d;
55
covss = s11 / d;
56
covsi = -s12 / d;
57
58
}
i
int i
Definition:
DBlmapReader.cc:9
slope
static const double slope[3]
Definition:
CastorTimeSlew.cc:6
DTLinearFit::~DTLinearFit
~DTLinearFit()
Destructor.
Definition:
DTLinearFit.cc:24
DTLinearFit::DTLinearFit
DTLinearFit()
Constructor.
Definition:
DTLinearFit.cc:19
diffTwoXMLs.g2
tuple g2
Definition:
diffTwoXMLs.py:70
DTLinearFit.h
diffTwoXMLs.g1
g1
Definition:
diffTwoXMLs.py:51
detailsBasic3DVector::y
float float y
Definition:
extBasic3DVector.h:15
DTLinearFit::fit
void fit(const std::vector< float > &x, const std::vector< float > &y, int ndat, const std::vector< float > &sigy, float &slope, float &intercept, float &covss, float &covii, float &covsi) const
Definition:
DTLinearFit.cc:28
x
Definition:
DDAxes.h:10
Generated for CMSSW Reference Manual by
1.8.5