CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
KalmanVertexTrackCompatibilityEstimator< N > Class Template Reference

#include <KalmanVertexTrackCompatibilityEstimator.h>

Inheritance diagram for KalmanVertexTrackCompatibilityEstimator< N >:
VertexTrackCompatibilityEstimator< N >

Public Types

typedef std::pair< bool, double > BDpair
 
typedef VertexTrack< N >
::RefCountedLinearizedTrackState 
RefCountedLinearizedTrackState
 
typedef VertexTrack< N >
::RefCountedRefittedTrackState 
RefCountedRefittedTrackState
 
typedef CachingVertex< N >
::RefCountedVertexTrack 
RefCountedVertexTrack
 
- Public Types inherited from VertexTrackCompatibilityEstimator< N >
typedef std::pair< bool, double > BDpair
 
typedef VertexTrack< N >
::RefCountedLinearizedTrackState 
RefCountedLinearizedTrackState
 
typedef CachingVertex< N >
::RefCountedVertexTrack 
RefCountedVertexTrack
 

Public Member Functions

virtual
KalmanVertexTrackCompatibilityEstimator
< N > * 
clone () const
 
virtual BDpair estimate (const CachingVertex< N > &vrt, const RefCountedVertexTrack track, unsigned int hint=UINT_MAX) const
 
virtual BDpair estimate (const CachingVertex< N > &v, const RefCountedLinearizedTrackState track, unsigned int hint=UINT_MAX) const
 
virtual BDpair estimate (const reco::Vertex &vertex, const reco::TransientTrack &track) const
 
 KalmanVertexTrackCompatibilityEstimator ()
 
virtual ~KalmanVertexTrackCompatibilityEstimator ()
 
- Public Member Functions inherited from VertexTrackCompatibilityEstimator< N >
 VertexTrackCompatibilityEstimator ()
 
virtual ~VertexTrackCompatibilityEstimator ()
 

Private Member Functions

BDpair estimateDifference (const CachingVertex< N > &more, const CachingVertex< N > &less, const RefCountedVertexTrack track) const
 
BDpair estimateFittedTrack (const CachingVertex< N > &v, const RefCountedVertexTrack track) const
 
BDpair estimateNFittedTrack (const CachingVertex< N > &v, const RefCountedVertexTrack track) const
 

Private Attributes

KVFHelper< Nhelper
 
KalmanVertexTrackUpdator< NtrackUpdator
 
KalmanVertexUpdator< Nupdator
 
VertexTrackFactory< NvTrackFactory
 

Detailed Description

template<unsigned int N>
class KalmanVertexTrackCompatibilityEstimator< N >

Calculates the compatiblity of a track with respect to a vertex using the Kalman filter algorithms. The compatibility is computed from the squared standardized residuals between the track and the vertex. If track and vertex errors are Gaussian and correct, this quantity is distributed as chi**2(ndf=2)). Can be used to identify outlying tracks.

Definition at line 25 of file KalmanVertexTrackCompatibilityEstimator.h.

Member Typedef Documentation

template<unsigned int N>
typedef std::pair<bool, double> KalmanVertexTrackCompatibilityEstimator< N >::BDpair

Definition at line 33 of file KalmanVertexTrackCompatibilityEstimator.h.

Definition at line 31 of file KalmanVertexTrackCompatibilityEstimator.h.

Definition at line 32 of file KalmanVertexTrackCompatibilityEstimator.h.

Definition at line 30 of file KalmanVertexTrackCompatibilityEstimator.h.

Constructor & Destructor Documentation

template<unsigned int N>
virtual KalmanVertexTrackCompatibilityEstimator< N >::~KalmanVertexTrackCompatibilityEstimator ( )
inlinevirtual

Definition at line 37 of file KalmanVertexTrackCompatibilityEstimator.h.

37 {}

Member Function Documentation

template<unsigned int N>
virtual KalmanVertexTrackCompatibilityEstimator<N>* KalmanVertexTrackCompatibilityEstimator< N >::clone ( ) const
inlinevirtual
template<unsigned int N>
KalmanVertexTrackCompatibilityEstimator< N >::BDpair KalmanVertexTrackCompatibilityEstimator< N >::estimate ( const CachingVertex< N > &  vrt,
const RefCountedVertexTrack  track,
unsigned int  hint = UINT_MAX 
) const
virtual

Track-to-vertex compatibility. The track weight is taken into account.

Parameters
trackThe track for which the chi**2 has to be estimated.
vThe vertex against which the chi**2 has to be estimated.
Returns
The chi**2.

Implements VertexTrackCompatibilityEstimator< N >.

Definition at line 10 of file KalmanVertexTrackCompatibilityEstimator.cc.

References ztail::d, testEve_cfg::tracks, and CachingVertex< N >::tracksRef().

Referenced by MultiVertexFitter::updateWeights().

13 {
14 //checking if the track passed really belongs to the vertex
15 
16  const std::vector<RefCountedVertexTrack> &tracks = vertex.tracksRef();
17 
18  if ( tracks.size()==0)
19  return estimateNFittedTrack(vertex,tr);
20 
21  if (hint<tracks.size() ) {
23  if ( d(tracks[hint]))
24  return estimateFittedTrack(vertex,tracks[hint]);
25  }
26 
27  typename std::vector<RefCountedVertexTrack>::const_iterator pos
28  = find_if(tracks.begin(), tracks.end(), VertexTrackEqual<N>(tr));
29  if(pos != tracks.end()) {
30  return estimateFittedTrack(vertex,*pos);
31  } else {
32  return estimateNFittedTrack(vertex,tr);
33  }
34 }
tuple d
Definition: ztail.py:151
tuple tracks
Definition: testEve_cfg.py:39
BDpair estimateFittedTrack(const CachingVertex< N > &v, const RefCountedVertexTrack track) const
BDpair estimateNFittedTrack(const CachingVertex< N > &v, const RefCountedVertexTrack track) const
template<unsigned int N>
KalmanVertexTrackCompatibilityEstimator< N >::BDpair KalmanVertexTrackCompatibilityEstimator< N >::estimate ( const CachingVertex< N > &  v,
const RefCountedLinearizedTrackState  track,
unsigned int  hint = UINT_MAX 
) const
virtual

Methods giving back the compatibility estimation

Implements VertexTrackCompatibilityEstimator< N >.

Definition at line 39 of file KalmanVertexTrackCompatibilityEstimator.cc.

References CachingVertex< N >::vertexState().

42 {
43  RefCountedVertexTrack vertexTrack = vTrackFactory.vertexTrack(track,
44  vertex.vertexState());
45  return estimate(vertex, vertexTrack,hint);
46 }
virtual BDpair estimate(const CachingVertex< N > &vrt, const RefCountedVertexTrack track, unsigned int hint=UINT_MAX) const
CachingVertex< N >::RefCountedVertexTrack RefCountedVertexTrack
template<unsigned int N>
KalmanVertexTrackCompatibilityEstimator< N >::BDpair KalmanVertexTrackCompatibilityEstimator< N >::estimate ( const reco::Vertex vertex,
const reco::TransientTrack track 
) const
virtual

Implements VertexTrackCompatibilityEstimator< N >.

Definition at line 51 of file KalmanVertexTrackCompatibilityEstimator.cc.

References reco::Vertex::chi2(), reco::Vertex::covariance(), spr::find(), LinearizedTrackStateFactory::linearizedTrackState(), reco::Vertex::position(), reco::TransientTrack::trackBaseRef(), reco::Vertex::tracks_begin(), and reco::Vertex::tracks_end().

53 {
54 // GlobalPoint linP(vertex.position().x(), vertex.position().z(),vertex.position().z());
55  GlobalPoint linP(Basic3DVector<float> (vertex.position()));
56 
57  LinearizedTrackStateFactory lTrackFactory;
59  lTrackFactory.linearizedTrackState(linP, track);
60  GlobalError err(vertex.covariance());
61  VertexState vState(linP, err);
62  RefCountedVertexTrack vertexTrack = vTrackFactory.vertexTrack(linTrack, vState);
63 
64  std::vector<RefCountedVertexTrack> initialTracks(1, vertexTrack);
65  CachingVertex<N> cachingVertex(linP, err, initialTracks,
66  vertex.chi2());
67  // FIXME: this should work also for tracks without a persistent ref.
68 // return estimateNFittedTrack(cachingVertex, vertexTrack);
69  if (find(vertex.tracks_begin(), vertex.tracks_end(), track.trackBaseRef()) != vertex.tracks_end())
70  {
71  return estimateFittedTrack(cachingVertex, vertexTrack);
72  } else {
73  return estimateNFittedTrack(cachingVertex, vertexTrack);
74  }
75 }
trackRef_iterator tracks_end() const
last iterator over tracks
Definition: Vertex.cc:81
TrackBaseRef trackBaseRef() const
double covariance(int i, int j) const
(i, j)-th element of error matrix, i, j = 0, ... 2
Definition: Vertex.h:130
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
const Point & position() const
position
Definition: Vertex.h:109
RefCountedLinearizedTrackState linearizedTrackState(const GlobalPoint &linP, const reco::TransientTrack &track) const
double chi2() const
chi-squares
Definition: Vertex.h:98
VertexTrack< N >::RefCountedLinearizedTrackState RefCountedLinearizedTrackState
CachingVertex< N >::RefCountedVertexTrack RefCountedVertexTrack
trackRef_iterator tracks_begin() const
first iterator over tracks
Definition: Vertex.cc:76
BDpair estimateFittedTrack(const CachingVertex< N > &v, const RefCountedVertexTrack track) const
BDpair estimateNFittedTrack(const CachingVertex< N > &v, const RefCountedVertexTrack track) const
template<unsigned int N>
KalmanVertexTrackCompatibilityEstimator< N >::BDpair KalmanVertexTrackCompatibilityEstimator< N >::estimateDifference ( const CachingVertex< N > &  more,
const CachingVertex< N > &  less,
const RefCountedVertexTrack  track 
) const
private

Definition at line 116 of file KalmanVertexTrackCompatibilityEstimator.cc.

118 {
119  BDpair trackRes = helper.trackParameterChi2(track);
120  return BDpair(trackRes.first, trackRes.second + helper.vertexChi2(less, more)) ;
121 }
template<unsigned int N>
KalmanVertexTrackCompatibilityEstimator< N >::BDpair KalmanVertexTrackCompatibilityEstimator< N >::estimateFittedTrack ( const CachingVertex< N > &  v,
const RefCountedVertexTrack  track 
) const
private

Definition at line 85 of file KalmanVertexTrackCompatibilityEstimator.cc.

86 {
87  //remove track from the vertex using the vertex updator
88  // Using the update instead of the remove methode, we can specify a weight which
89  // is different than then one which the vertex track has been defined with.
90  //CachingVertex rVert = updator.remove(v, track);
91  RefCountedVertexTrack newSmoothedTrack = trackUpdator.update(v, track);
92 // std::cout << newSmoothedTrack->smoothedChi2()<<" "<<estimateDifference(v,rVert,newSmoothedTrack)<<std::endl;
93 // return estimateDifference(v,rVert,newSmoothedTrack);
94  return BDpair(true, newSmoothedTrack->smoothedChi2());
95 }
CachingVertex< N >::RefCountedVertexTrack RefCountedVertexTrack
template<unsigned int N>
KalmanVertexTrackCompatibilityEstimator< N >::BDpair KalmanVertexTrackCompatibilityEstimator< N >::estimateNFittedTrack ( const CachingVertex< N > &  v,
const RefCountedVertexTrack  track 
) const
private

Definition at line 102 of file KalmanVertexTrackCompatibilityEstimator.cc.

References CachingVertex< N >::isValid(), CachingVertex< N >::totalChiSquared(), and HLT_FULL_cff::updator.

103 {
104  // Using the update instead of the add methode, we can specify a weight which
105  // is different than then one which the vertex track has been defined with.
106  CachingVertex<N> rVert = updator.add(v, track);
107  if (!rVert.isValid()) return BDpair(false,-1.);
108  return BDpair(true, rVert.totalChiSquared()-v.totalChiSquared());
109 }
float totalChiSquared() const
bool isValid() const

Member Data Documentation

template<unsigned int N>
KVFHelper<N> KalmanVertexTrackCompatibilityEstimator< N >::helper
private

Definition at line 72 of file KalmanVertexTrackCompatibilityEstimator.h.

template<unsigned int N>
KalmanVertexTrackUpdator<N> KalmanVertexTrackCompatibilityEstimator< N >::trackUpdator
private

Definition at line 70 of file KalmanVertexTrackCompatibilityEstimator.h.

template<unsigned int N>
KalmanVertexUpdator<N> KalmanVertexTrackCompatibilityEstimator< N >::updator
private

Definition at line 69 of file KalmanVertexTrackCompatibilityEstimator.h.

template<unsigned int N>
VertexTrackFactory<N> KalmanVertexTrackCompatibilityEstimator< N >::vTrackFactory
private

Definition at line 71 of file KalmanVertexTrackCompatibilityEstimator.h.