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
GsfVertexTrackCompatibilityEstimator Class Reference

#include <GsfVertexTrackCompatibilityEstimator.h>

Inheritance diagram for GsfVertexTrackCompatibilityEstimator:
VertexTrackCompatibilityEstimator< 5 >

Public Types

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

Public Member Functions

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

Private Member Functions

BDpair estimateFittedTrack (const CachingVertex< 5 > &v, const RefCountedVertexTrack track) const
 
BDpair estimateNFittedTrack (const CachingVertex< 5 > &v, const RefCountedVertexTrack track) const
 

Private Attributes

MultiPerigeeLTSFactory lTrackFactory
 
GsfVertexUpdator updator
 
VertexTrackFactory< 5 > vTrackFactory
 

Detailed Description

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 GsfVertexTrackCompatibilityEstimator.h.

Member Typedef Documentation

Definition at line 30 of file GsfVertexTrackCompatibilityEstimator.h.

Constructor & Destructor Documentation

GsfVertexTrackCompatibilityEstimator::GsfVertexTrackCompatibilityEstimator ( )
inline

Definition at line 32 of file GsfVertexTrackCompatibilityEstimator.h.

Referenced by clone().

32 {}
virtual GsfVertexTrackCompatibilityEstimator::~GsfVertexTrackCompatibilityEstimator ( )
inlinevirtual

Definition at line 34 of file GsfVertexTrackCompatibilityEstimator.h.

34 {}

Member Function Documentation

virtual GsfVertexTrackCompatibilityEstimator* GsfVertexTrackCompatibilityEstimator::clone ( void  ) const
inlinevirtual
std::pair< bool, double > GsfVertexTrackCompatibilityEstimator::estimate ( const CachingVertex< 5 > &  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.

Definition at line 22 of file GsfVertexTrackCompatibilityEstimator.cc.

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

24 {
25 //checking if the track passed really belongs to the vertex
26  std::vector<RefCountedVertexTrack> tracks = vertex.tracks();
27  std::vector<RefCountedVertexTrack>::iterator pos
28  = find_if(tracks.begin(), tracks.end(), VertexTrackEqual<5>(tr));
29  if (pos != tracks.end()) {
30  return estimateFittedTrack(vertex,*pos);
31  } else {
32  return estimateNFittedTrack(vertex,tr);
33  }
34 }
BDpair estimateNFittedTrack(const CachingVertex< 5 > &v, const RefCountedVertexTrack track) const
tuple tracks
Definition: testEve_cfg.py:39
BDpair estimateFittedTrack(const CachingVertex< 5 > &v, const RefCountedVertexTrack track) const
std::pair< bool, double > GsfVertexTrackCompatibilityEstimator::estimate ( const CachingVertex< 5 > &  v,
const RefCountedLinearizedTrackState  track,
unsigned int  hint = UINT_MAX 
) const
virtual

Definition at line 38 of file GsfVertexTrackCompatibilityEstimator.cc.

References CachingVertex< N >::vertexState().

41 {
43  vertex.vertexState());
44  return estimate(vertex, vertexTrack);
45 }
CachingVertex< 5 >::RefCountedVertexTrack RefCountedVertexTrack
RefCountedVertexTrack vertexTrack(const RefCountedLinearizedTrackState lt, const VertexState vs, float weight=1.0) const
virtual BDpair estimate(const CachingVertex< 5 > &vrt, const RefCountedVertexTrack track, unsigned int hint=UINT_MAX) const
std::pair< bool, double > GsfVertexTrackCompatibilityEstimator::estimate ( const reco::Vertex vertex,
const reco::TransientTrack track 
) const
virtual

Implements VertexTrackCompatibilityEstimator< 5 >.

Definition at line 49 of file GsfVertexTrackCompatibilityEstimator.cc.

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

51 {
52 // GlobalPoint linP(vertex.position().x(), vertex.position().z(),vertex.position().z());
53  GlobalPoint linP(Basic3DVector<float> (vertex.position()));
54 
57  GlobalError err(vertex.covariance());
58  VertexState vState(linP, err);
59  RefCountedVertexTrack vertexTrack = vTrackFactory.vertexTrack(linTrack, vState);
60 
61  std::vector<RefCountedVertexTrack> initialTracks(1, vertexTrack);
62  CachingVertex<5> cachingVertex(linP, err, initialTracks,
63  vertex.chi2());
64  // FIXME: this should work also for tracks without a persistent ref.
65 // const TrackTransientTrack* ttt = dynamic_cast<const TrackTransientTrack*>(track.basicTransientTrack());
66 // if ((ttt!=0) &&
67  if (find(vertex.tracks_begin(), vertex.tracks_end(), track.trackBaseRef()) != vertex.tracks_end())
68  {
69  return estimateFittedTrack(cachingVertex, vertexTrack);
70  } else {
71  return estimateNFittedTrack(cachingVertex, vertexTrack);
72  }
73 }
CachingVertex< 5 >::RefCountedVertexTrack RefCountedVertexTrack
trackRef_iterator tracks_end() const
last iterator over tracks
Definition: Vertex.cc:44
TrackBaseRef trackBaseRef() const
RefCountedVertexTrack vertexTrack(const RefCountedLinearizedTrackState lt, const VertexState vs, float weight=1.0) const
VertexTrack< N >::RefCountedLinearizedTrackState RefCountedLinearizedTrackState
double covariance(int i, int j) const
(i, j)-th element of error matrix, i, j = 0, ... 2
Definition: Vertex.h:123
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:106
double chi2() const
chi-squares
Definition: Vertex.h:95
BDpair estimateNFittedTrack(const CachingVertex< 5 > &v, const RefCountedVertexTrack track) const
trackRef_iterator tracks_begin() const
first iterator over tracks
Definition: Vertex.cc:39
BDpair estimateFittedTrack(const CachingVertex< 5 > &v, const RefCountedVertexTrack track) const
RefCountedLinearizedTrackState linearizedTrackState(const GlobalPoint &linP, const reco::TransientTrack &track) const
std::pair< bool, double > GsfVertexTrackCompatibilityEstimator::estimateFittedTrack ( const CachingVertex< 5 > &  v,
const RefCountedVertexTrack  track 
) const
private

Definition at line 82 of file GsfVertexTrackCompatibilityEstimator.cc.

83 {
84  //remove track from the vertex using the vertex updator
85  // Using the update instead of the remove methode, we can specify a weight which
86  // is different than then one which the vertex track has been defined with.
87  if (track->refittedStateAvailable()) return BDpair(true, track->smoothedChi2());
88  throw VertexException
89  ("GsfVertexTrackCompatibilityEstimator::vertex has to be smoothed.");
90 
91 // CachingVertex rVert = updator.remove(v, track);
92 // RefCountedVertexTrack newSmoothedTrack = trackUpdator.update(v, track);
93 // return estimateDifference(v,rVert,newSmoothedTrack);
94 }
Common base class.
std::pair< bool, double > GsfVertexTrackCompatibilityEstimator::estimateNFittedTrack ( const CachingVertex< 5 > &  v,
const RefCountedVertexTrack  track 
) const
private

Definition at line 100 of file GsfVertexTrackCompatibilityEstimator.cc.

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

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

Member Data Documentation

MultiPerigeeLTSFactory GsfVertexTrackCompatibilityEstimator::lTrackFactory
private

Definition at line 67 of file GsfVertexTrackCompatibilityEstimator.h.

GsfVertexUpdator GsfVertexTrackCompatibilityEstimator::updator
private

Definition at line 65 of file GsfVertexTrackCompatibilityEstimator.h.

VertexTrackFactory<5> GsfVertexTrackCompatibilityEstimator::vTrackFactory
private

Definition at line 68 of file GsfVertexTrackCompatibilityEstimator.h.