CMS 3D CMS Logo

SVTimeHelpers.h
Go to the documentation of this file.
1 #ifndef __RecoVertex_AdaptiveVertexFinder_SVTimeHelpers_h__
2 #define __RecoVertex_AdaptiveVertexFinder_SVTimeHelpers_h__
3 
6 
8 
9 namespace svhelper {
10 
12  const auto& trks = vtx.originalTracks();
13  double meantime = 0., expv_x2 = 0., normw = 0., timecov = 0.;
14  for (const auto& trk : trks) {
15  if (edm::isFinite(trk.timeExt())) {
16  const double time = trk.timeExt();
17  const double inverr = 1.0 / trk.dtErrorExt();
18  const double w = inverr * inverr;
19  meantime += time * w;
20  expv_x2 += time * time * w;
21  normw += w;
22  }
23  }
24  if (normw > 0.) {
25  meantime = meantime / normw;
26  expv_x2 = expv_x2 / normw;
27  timecov = expv_x2 - meantime * meantime;
28  auto err = vtx.positionError().matrix4D();
29  err(3, 3) = timecov / (double)trks.size();
30  vtx = TransientVertex(vtx.position(), meantime, err, vtx.originalTracks(), vtx.totalChiSquared());
31  }
32  }
33 } // namespace svhelper
34 
35 #endif
svhelper
Definition: SVTimeHelpers.h:9
TransientTrack.h
w
const double w
Definition: UKUtility.cc:23
svhelper::updateVertexTime
void updateVertexTime(TransientVertex &vtx)
Definition: SVTimeHelpers.h:11
TransientVertex
Definition: TransientVertex.h:18
submitPVResolutionJobs.err
err
Definition: submitPVResolutionJobs.py:85
TransientVertex.h
isFinite.h
extraflags_cff.vtx
vtx
Definition: extraflags_cff.py:18
edm::isFinite
constexpr bool isFinite(T x)
ntuplemaker.time
time
Definition: ntuplemaker.py:310