CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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;
19  delete theVertexSmoothedChiSquaredEstimator;
20  delete theTrackToTrackCovCalculator;
21 }
22 
23 
24 template <unsigned int N>
26  const SequentialVertexSmoother & smoother)
27 {
28  theVertexTrackUpdator = smoother.vertexTrackUpdator()->clone();
29  theVertexSmoothedChiSquaredEstimator
30  = smoother.vertexSmoothedChiSquaredEstimator()->clone();
31  theTrackToTrackCovCalculator = smoother.trackToTrackCovCalculator()->clone();
32 }
33 
34 
35 template <unsigned int N>
38 {
39 
40  // Track refit
41 
42  std::vector<RefCountedVertexTrack> newTracks;
43  if (theVertexTrackUpdator != 0) {
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 
59  // Smoothed chi2
60 
61  float smChi2 = vertex.totalChiSquared();
62  if (theVertexSmoothedChiSquaredEstimator != 0) {
63  std::pair<bool, double> result = theVertexSmoothedChiSquaredEstimator->estimate(interVertex);
64  smChi2 = result.second;
65  }
66 
67  if (theTrackToTrackCovCalculator == 0) {
68  if (vertex.hasPrior()) {
69  return CachingVertex<N>(vertex.priorVertexState(), vertex.vertexState(),
70  newTracks, smChi2);
71  } else {
72  return CachingVertex<N>(vertex.vertexState(), newTracks, smChi2);
73  }
74  }
75 
76  //TktoTkcovariance map
77  typename CachingVertex<N>::TrackToTrackMap tkMap = (*theTrackToTrackCovCalculator)(interVertex);
78 
79 // CachingVertex<N> finalVertex(vertex.position(), vertex.error(),
80 // newTracks, smChi2, tkMap);
81  if (vertex.hasPrior()) {
82  CachingVertex<N> finalVertex(vertex.priorVertexState(), vertex.vertexState(),
83  newTracks, smChi2, tkMap);
84  return finalVertex;
85  }
86 
87  CachingVertex<N> finalVertex(vertex.vertexState(), newTracks, smChi2, tkMap);
88  return finalVertex;
89 
90 }
91 
92 template class SequentialVertexSmoother<5>;
93 template class SequentialVertexSmoother<6>;
const VertexTrackUpdator< N > * vertexTrackUpdator() const
int i
Definition: DBlmapReader.cc:9
std::vector< RefCountedVertexTrack > tracks() const
Definition: CachingVertex.h:92
VertexState vertexState() const
Definition: CachingVertex.h:86
SequentialVertexSmoother(const VertexTrackUpdator< N > &vtu, const VertexSmoothedChiSquaredEstimator< N > &vse, const TrackToTrackCovCalculator< N > &covCalc)
virtual CachingVertex< N > smooth(const CachingVertex< N > &vertex) const
GlobalWeight weight() const
tuple result
Definition: query.py:137
VertexState priorVertexState() const
Definition: CachingVertex.h:87
float totalChiSquared() const
bool hasPrior() const
Definition: CachingVertex.h:95
const VertexSmoothedChiSquaredEstimator< N > * vertexSmoothedChiSquaredEstimator() const
T * clone(const T *tp)
Definition: Ptr.h:42
const TrackToTrackCovCalculator< N > * trackToTrackCovCalculator() const
GlobalPoint position() const
std::map< RefCountedVertexTrack, TrackMap > TrackToTrackMap
Definition: CachingVertex.h:34