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 }
34 
35 #endif
GlobalError positionError() const
const double w
Definition: UKUtility.cc:23
float totalChiSquared() const
const AlgebraicSymMatrix44 & matrix4D() const
bool isFinite(T x)
std::vector< reco::TransientTrack > const & originalTracks() const
GlobalPoint position() const
void updateVertexTime(TransientVertex &vtx)
Definition: SVTimeHelpers.h:11