test
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  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 != 0) {
68  std::pair<bool, double> result = theVertexSmoothedChiSquaredEstimator->estimate(interVertex);
69  smChi2 = result.second;
70  }
71 
72  if (theTrackToTrackCovCalculator == 0) {
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
int i
Definition: DBlmapReader.cc:9
std::vector< RefCountedVertexTrack > tracks() const
VertexState const & vertexState() const
GlobalError priorError() const
tuple result
Definition: mps_fire.py:84
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
float totalChiSquared() const
bool hasPrior() const
const VertexSmoothedChiSquaredEstimator< N > * vertexSmoothedChiSquaredEstimator() const
VertexState const & priorVertexState() const
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