CMS 3D CMS Logo

SequentialVertexSmoother.cc
Go to the documentation of this file.
2 
3 
4 template <unsigned int N>
6  const VertexTrackUpdator<N> & vtu,
8  const TrackToTrackCovCalculator<N> & covCalc) :
9  theVertexTrackUpdator(vtu.clone()),
10  theVertexSmoothedChiSquaredEstimator(vse.clone()),
11  theTrackToTrackCovCalculator(covCalc.clone())
12 {}
13 
14 
15 template <unsigned int N>
17 {
18  delete theVertexTrackUpdator;
21 }
22 
23 
24 template <unsigned int N>
26  const SequentialVertexSmoother & smoother)
27 {
28  theVertexTrackUpdator = smoother.vertexTrackUpdator()->clone();
30  = smoother.vertexSmoothedChiSquaredEstimator()->clone();
32 }
33 
34 
35 template <unsigned int N>
38 {
39 
40  // Track refit
41 
42  std::vector<RefCountedVertexTrack> newTracks;
43  if (theVertexTrackUpdator != nullptr) {
44  const std::vector<RefCountedVertexTrack>& vOut=vertex.tracks();
45  for(typename std::vector<RefCountedVertexTrack>::const_iterator i = vOut.begin();
46  i != vOut.end();i++)
47  {
48  RefCountedVertexTrack nTrack = theVertexTrackUpdator->update(vertex, *i);
49  newTracks.push_back(nTrack);
50  }
51  } else {
52  newTracks = vertex.tracks();
53  }
54 
55  // intermediate vertex for chi2 calculation and TktoTkcovariance map
56  CachingVertex<N> interVertex(vertex.position(), vertex.weight(),
57  newTracks, 0.);
58  if ( vertex.hasPrior() )
59  {
60  interVertex = CachingVertex<N> ( vertex.priorPosition(), vertex.priorError(),
61  vertex.position(), vertex.weight(), newTracks, 0.);
62  }
63 
64  // Smoothed chi2
65 
66  float smChi2 = vertex.totalChiSquared();
67  if (theVertexSmoothedChiSquaredEstimator != nullptr) {
68  std::pair<bool, double> result = theVertexSmoothedChiSquaredEstimator->estimate(interVertex);
69  smChi2 = result.second;
70  }
71 
72  if (theTrackToTrackCovCalculator == nullptr) {
73  if (vertex.hasPrior()) {
74  return CachingVertex<N>(vertex.priorVertexState(), vertex.vertexState(),
75  newTracks, smChi2);
76  } else {
77  return CachingVertex<N>(vertex.vertexState(), newTracks, smChi2);
78  }
79  }
80 
81  //TktoTkcovariance map
82  typename CachingVertex<N>::TrackToTrackMap tkMap = (*theTrackToTrackCovCalculator)(interVertex);
83 
84 // CachingVertex<N> finalVertex(vertex.position(), vertex.error(),
85 // newTracks, smChi2, tkMap);
86  if (vertex.hasPrior()) {
87  CachingVertex<N> finalVertex(vertex.priorVertexState(), vertex.vertexState(),
88  newTracks, smChi2, tkMap);
89  return finalVertex;
90  }
91 
92  CachingVertex<N> finalVertex(vertex.vertexState(), newTracks, smChi2, tkMap);
93  return finalVertex;
94 
95 }
96 
97 template class SequentialVertexSmoother<5>;
98 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
std::map< RefCountedVertexTrack, TrackMap > TrackToTrackMap
Definition: CachingVertex.h:33
GlobalPoint priorPosition() const