src
RecoTracker
PixelVertexFinding
src
PVPositionBuilder.cc
Go to the documentation of this file.
1
#include "
RecoTracker/PixelVertexFinding/interface/PVPositionBuilder.h
"
2
#include <cmath>
3
5
PVPositionBuilder::PVPositionBuilder
() {}
6
7
Measurement1D
PVPositionBuilder::average
(
const
reco::TrackRefVector
&
trks
)
const
{
8
// Cut and paste (more or less) from same class in ORCA framework
9
double
ntracks
= double(
trks
.size());
10
if
(
ntracks
== 0)
11
return
Measurement1D
(0., 0.);
12
double
sumZIP = 0;
13
double
err
= 0;
14
for
(
unsigned
int
i
= 0;
i
<
trks
.size();
i
++) {
15
sumZIP +=
trks
[
i
]->dz();
// Z at IP
16
err
+=
trks
[
i
]->dzError();
// error on Z at IP (I hope). Fix d.k.
17
}
18
return
Measurement1D
(sumZIP /
ntracks
,
err
/
ntracks
/
std::sqrt
(
ntracks
));
19
}
20
21
Measurement1D
PVPositionBuilder::wtAverage
(
const
reco::TrackRefVector
&
trks
)
const
{
22
double
ntracks
= double(
trks
.size());
23
if
(
ntracks
== 0)
24
return
Measurement1D
(0.0, 0.0);
25
double
sumUp = 0;
26
double
sumDown = 0;
27
double
err
= 0;
28
for
(
unsigned
int
i
= 0;
i
<
trks
.size();
i
++) {
29
// double err2 = trks[i]->covariance(3,3); // error on Z at IP (I hope)
30
double
err2 =
trks
[
i
]->dzError();
// Fix d.k.
31
err2 *= err2;
32
if
(err2 != 0) {
33
sumUp +=
trks
[
i
]->dz() * 1 / err2;
// error-weighted average of Z at IP
34
sumDown += 1 / err2;
35
}
36
err
+=
std::sqrt
(err2);
37
}
38
if
(sumDown > 0)
39
return
Measurement1D
(sumUp / sumDown,
err
/
ntracks
/
sqrt
(
ntracks
));
40
else
41
return
Measurement1D
(0.0, 0.0);
42
}
hltEgammaHLTExtra_cfi.trks
trks
Definition:
hltEgammaHLTExtra_cfi.py:43
mps_fire.i
i
Definition:
mps_fire.py:429
PVPositionBuilder::average
Measurement1D average(const reco::TrackRefVector &trks) const
Calculate unweighted average of Z of tracks from const collection of track pointers.
Definition:
PVPositionBuilder.cc:7
vertices_cff.ntracks
ntracks
Definition:
vertices_cff.py:33
PVPositionBuilder::PVPositionBuilder
PVPositionBuilder()
Constructor does nothing, no data members.
Definition:
PVPositionBuilder.cc:5
PVPositionBuilder::wtAverage
Measurement1D wtAverage(const reco::TrackRefVector &trks) const
Calculate Error-Weighted average of Z of tracks from const collection of track pointers.
Definition:
PVPositionBuilder.cc:21
submitPVResolutionJobs.err
err
Definition:
submitPVResolutionJobs.py:84
mathSSE::sqrt
T sqrt(T t)
Definition:
SSEVec.h:23
edm::RefVector< TrackCollection >
PVPositionBuilder.h
Measurement1D
Definition:
Measurement1D.h:11
Generated for CMSSW Reference Manual by
1.8.14