CMS 3D CMS Logo

SequentialVertexSmoother.cc
Go to the documentation of this file.
2 
3 template <unsigned int N>
6  const TrackToTrackCovCalculator<N>& covCalc)
7  : theVertexTrackUpdator(vtu.clone()),
8  theVertexSmoothedChiSquaredEstimator(vse.clone()),
9  theTrackToTrackCovCalculator(covCalc.clone()) {}
10 
11 template <unsigned int N>
13  delete theVertexTrackUpdator;
16 }
17 
18 template <unsigned int N>
20  theVertexTrackUpdator = smoother.vertexTrackUpdator()->clone();
23 }
24 
25 template <unsigned int N>
27  // Track refit
28 
29  std::vector<RefCountedVertexTrack> newTracks;
30  if (theVertexTrackUpdator != nullptr) {
31  const std::vector<RefCountedVertexTrack>& vOut = vertex.tracks();
32  for (typename std::vector<RefCountedVertexTrack>::const_iterator i = vOut.begin(); i != vOut.end(); i++) {
33  RefCountedVertexTrack nTrack = theVertexTrackUpdator->update(vertex, *i);
34  newTracks.push_back(nTrack);
35  }
36  } else {
37  newTracks = vertex.tracks();
38  }
39 
40  // intermediate vertex for chi2 calculation and TktoTkcovariance map
41  CachingVertex<N> interVertex(vertex.position(), vertex.weight(), newTracks, 0.);
42  if (vertex.hasPrior()) {
43  interVertex = CachingVertex<N>(
44  vertex.priorPosition(), vertex.priorError(), vertex.position(), vertex.weight(), newTracks, 0.);
45  }
46 
47  // Smoothed chi2
48 
49  float smChi2 = vertex.totalChiSquared();
50  if (theVertexSmoothedChiSquaredEstimator != nullptr) {
51  std::pair<bool, double> result = theVertexSmoothedChiSquaredEstimator->estimate(interVertex);
52  smChi2 = result.second;
53  }
54 
55  if (theTrackToTrackCovCalculator == nullptr) {
56  if (vertex.hasPrior()) {
57  return CachingVertex<N>(vertex.priorVertexState(), vertex.vertexState(), newTracks, smChi2);
58  } else {
59  return CachingVertex<N>(vertex.vertexState(), newTracks, smChi2);
60  }
61  }
62 
63  //TktoTkcovariance map
64  typename CachingVertex<N>::TrackToTrackMap tkMap = (*theTrackToTrackCovCalculator)(interVertex);
65 
66  // CachingVertex<N> finalVertex(vertex.position(), vertex.error(),
67  // newTracks, smChi2, tkMap);
68  if (vertex.hasPrior()) {
69  CachingVertex<N> finalVertex(vertex.priorVertexState(), vertex.vertexState(), newTracks, smChi2, tkMap);
70  return finalVertex;
71  }
72 
73  CachingVertex<N> finalVertex(vertex.vertexState(), newTracks, smChi2, tkMap);
74  return finalVertex;
75 }
76 
77 template class SequentialVertexSmoother<5>;
78 template class SequentialVertexSmoother<6>;
const VertexTrackUpdator< N > * vertexTrackUpdator() const
std::vector< RefCountedVertexTrack > tracks() const
CachingVertex< N > smooth(const CachingVertex< N > &vertex) const override
VertexState const & vertexState() const
GlobalError priorError() const
SequentialVertexSmoother(const VertexTrackUpdator< N > &vtu, const VertexSmoothedChiSquaredEstimator< N > &vse, const TrackToTrackCovCalculator< N > &covCalc)
GlobalWeight weight() const
float totalChiSquared() const
bool hasPrior() const
TrackToTrackCovCalculator< N > * theTrackToTrackCovCalculator
const VertexSmoothedChiSquaredEstimator< N > * vertexSmoothedChiSquaredEstimator() const
VertexTrackUpdator< N > * theVertexTrackUpdator
VertexState const & priorVertexState() const
VertexSmoothedChiSquaredEstimator< N > * theVertexSmoothedChiSquaredEstimator
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
const TrackToTrackCovCalculator< N > * trackToTrackCovCalculator() const
GlobalPoint position() const
GlobalPoint priorPosition() const
std::map< RefCountedVertexTrack, TrackMap > TrackToTrackMap
Definition: CachingVertex.h:28