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
6
/* This Class Header */
7
#include "
RecoLocalMuon/DTSegment/src/DTLinearFit.h
"
8
9
/* Collaborating Class Header */
10
11
/* C++ Headers */
12
using namespace
std;
13
14
/* ====================================================================== */
15
17
DTLinearFit::DTLinearFit
() {
18
19
}
20
22
DTLinearFit::~DTLinearFit
() {
23
}
24
25
/* Operations */
26
void
DTLinearFit::fit
(
const
vector<float> &
x
,
27
const
vector<float> &
y
,
28
int
ndat,
29
const
vector<float> & sigy,
30
float
&
slope
,
31
float
& intercept,
32
float
& covss,
33
float
& covii,
34
float
& covsi)
const
35
{
36
37
float
g1
= 0,
g2
= 0;
38
float
s11 = 0, s12 = 0, s22 = 0;
39
for
(
int
i
= 0;
i
!= ndat;
i
++) {
40
float
sy2 = sigy[
i
] * sigy[
i
];
41
g1 += y[
i
] / sy2;
42
g2
+= x[
i
]*y[
i
] / sy2;
43
s11 += 1. / sy2;
44
s12 += x[
i
] / sy2;
45
s22 += x[
i
]*x[
i
] / sy2;
46
}
47
48
float
d = s11*s22 - s12*s12;
49
intercept = (g1*s22 -
g2
*s12) / d;
50
slope = (
g2
*s11 - g1*s12) / d;
51
52
covii = s22 / d;
53
covss = s11 / d;
54
covsi = -s12 / d;
55
56
}
i
int i
Definition:
DBlmapReader.cc:9
slope
static const double slope[3]
Definition:
CastorTimeSlew.cc:6
DTLinearFit::~DTLinearFit
~DTLinearFit()
Destructor.
Definition:
DTLinearFit.cc:22
DTLinearFit::DTLinearFit
DTLinearFit()
Constructor.
Definition:
DTLinearFit.cc:17
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:26
x
Definition:
DDAxes.h:10
Generated for CMSSW Reference Manual by
1.8.5