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) const
 
virtual BDpair estimate (const CachingVertex< 5 > &v, const RefCountedLinearizedTrackState track) 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) const =0
 
virtual BDpair estimate (const CachingVertex< N > &v, const RefCountedVertexTrack track) 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 
) 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 pos, 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 
) const
virtual

Definition at line 38 of file GsfVertexTrackCompatibilityEstimator.cc.

References CachingVertex< N >::vertexState().

40 {
42  vertex.vertexState());
43  return estimate(vertex, vertexTrack);
44 }
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) const
std::pair< bool, double > GsfVertexTrackCompatibilityEstimator::estimate ( const reco::Vertex vertex,
const reco::TransientTrack track 
) const
virtual

Implements VertexTrackCompatibilityEstimator< 5 >.

Definition at line 48 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().

50 {
51 // GlobalPoint linP(vertex.position().x(), vertex.position().z(),vertex.position().z());
52  GlobalPoint linP(Basic3DVector<float> (vertex.position()));
53 
56  GlobalError err(vertex.covariance());
57  VertexState vState(linP, err);
58  RefCountedVertexTrack vertexTrack = vTrackFactory.vertexTrack(linTrack, vState);
59 
60  std::vector<RefCountedVertexTrack> initialTracks(1, vertexTrack);
61  CachingVertex<5> cachingVertex(linP, err, initialTracks,
62  vertex.chi2());
63  // FIXME: this should work also for tracks without a persistent ref.
64 // const TrackTransientTrack* ttt = dynamic_cast<const TrackTransientTrack*>(track.basicTransientTrack());
65 // if ((ttt!=0) &&
66  if (find(vertex.tracks_begin(), vertex.tracks_end(), track.trackBaseRef()) != vertex.tracks_end())
67  {
68  return estimateFittedTrack(cachingVertex, vertexTrack);
69  } else {
70  return estimateNFittedTrack(cachingVertex, vertexTrack);
71  }
72 }
CachingVertex< 5 >::RefCountedVertexTrack RefCountedVertexTrack
trackRef_iterator tracks_end() const
last iterator over tracks
Definition: Vertex.cc:45
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:110
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:93
double chi2() const
chi-squares
Definition: Vertex.h:82
BDpair estimateNFittedTrack(const CachingVertex< 5 > &v, const RefCountedVertexTrack track) const
trackRef_iterator tracks_begin() const
first iterator over tracks
Definition: Vertex.cc:40
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 81 of file GsfVertexTrackCompatibilityEstimator.cc.

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

Definition at line 99 of file GsfVertexTrackCompatibilityEstimator.cc.

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

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

Member Data Documentation

MultiPerigeeLTSFactory GsfVertexTrackCompatibilityEstimator::lTrackFactory
private

Definition at line 65 of file GsfVertexTrackCompatibilityEstimator.h.

GsfVertexUpdator GsfVertexTrackCompatibilityEstimator::updator
private

Definition at line 63 of file GsfVertexTrackCompatibilityEstimator.h.

VertexTrackFactory<5> GsfVertexTrackCompatibilityEstimator::vTrackFactory
private

Definition at line 66 of file GsfVertexTrackCompatibilityEstimator.h.