CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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

GsfVertexTrackCompatibilityEstimatorclone () const override
 
BDpair estimate (const CachingVertex< 5 > &vrt, const RefCountedVertexTrack track, unsigned int hint=UINT_MAX) const override
 
BDpair estimate (const CachingVertex< 5 > &v, const RefCountedLinearizedTrackState track, unsigned int hint=UINT_MAX) const override
 
BDpair estimate (const reco::Vertex &vertex, const reco::TransientTrack &track) const override
 
 GsfVertexTrackCompatibilityEstimator ()
 
 ~GsfVertexTrackCompatibilityEstimator () override
 
- 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 24 of file GsfVertexTrackCompatibilityEstimator.h.

Member Typedef Documentation

Definition at line 26 of file GsfVertexTrackCompatibilityEstimator.h.

Constructor & Destructor Documentation

GsfVertexTrackCompatibilityEstimator::GsfVertexTrackCompatibilityEstimator ( )
inline

Definition at line 28 of file GsfVertexTrackCompatibilityEstimator.h.

Referenced by clone().

28 {}
GsfVertexTrackCompatibilityEstimator::~GsfVertexTrackCompatibilityEstimator ( )
inlineoverride

Definition at line 30 of file GsfVertexTrackCompatibilityEstimator.h.

30 {}

Member Function Documentation

GsfVertexTrackCompatibilityEstimator* GsfVertexTrackCompatibilityEstimator::clone ( void  ) const
inlineoverridevirtual
std::pair< bool, double > GsfVertexTrackCompatibilityEstimator::estimate ( const CachingVertex< 5 > &  vrt,
const RefCountedVertexTrack  track,
unsigned int  hint = UINT_MAX 
) const
override

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 20 of file GsfVertexTrackCompatibilityEstimator.cc.

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

22  {
23  //checking if the track passed really belongs to the vertex
24  std::vector<RefCountedVertexTrack> tracks = vertex.tracks();
25  std::vector<RefCountedVertexTrack>::iterator pos = find_if(tracks.begin(), tracks.end(), VertexTrackEqual<5>(tr));
26  if (pos != tracks.end()) {
27  return estimateFittedTrack(vertex, *pos);
28  } else {
29  return estimateNFittedTrack(vertex, tr);
30  }
31 }
auto const & tracks
cannot be loose
BDpair estimateNFittedTrack(const CachingVertex< 5 > &v, const RefCountedVertexTrack track) const
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
override

Definition at line 33 of file GsfVertexTrackCompatibilityEstimator.cc.

References CachingVertex< N >::vertexState().

35  {
36  RefCountedVertexTrack vertexTrack = vTrackFactory.vertexTrack(track, vertex.vertexState());
37  return estimate(vertex, vertexTrack);
38 }
CachingVertex< 5 >::RefCountedVertexTrack RefCountedVertexTrack
RefCountedVertexTrack vertexTrack(const RefCountedLinearizedTrackState lt, const VertexState vs, float weight=1.0) const
BDpair estimate(const CachingVertex< 5 > &vrt, const RefCountedVertexTrack track, unsigned int hint=UINT_MAX) const override
std::pair< bool, double > GsfVertexTrackCompatibilityEstimator::estimate ( const reco::Vertex vertex,
const reco::TransientTrack track 
) const
overridevirtual

Implements VertexTrackCompatibilityEstimator< 5 >.

Definition at line 40 of file GsfVertexTrackCompatibilityEstimator.cc.

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

41  {
42  // GlobalPoint linP(vertex.position().x(), vertex.position().z(),vertex.position().z());
44 
46  GlobalError err(vertex.covariance());
47  VertexState vState(linP, err);
48  RefCountedVertexTrack vertexTrack = vTrackFactory.vertexTrack(linTrack, vState);
49 
50  std::vector<RefCountedVertexTrack> initialTracks(1, vertexTrack);
51  CachingVertex<5> cachingVertex(linP, err, initialTracks, vertex.chi2());
52  // FIXME: this should work also for tracks without a persistent ref.
53  // const TrackTransientTrack* ttt = dynamic_cast<const TrackTransientTrack*>(track.basicTransientTrack());
54  // if ((ttt!=0) &&
55  if (find(vertex.tracks_begin(), vertex.tracks_end(), track.trackBaseRef()) != vertex.tracks_end()) {
56  return estimateFittedTrack(cachingVertex, vertexTrack);
57  } else {
58  return estimateNFittedTrack(cachingVertex, vertexTrack);
59  }
60 }
CachingVertex< 5 >::RefCountedVertexTrack RefCountedVertexTrack
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:148
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
const Point & position() const
position
Definition: Vertex.h:127
double chi2() const
chi-squares
Definition: Vertex.h:116
trackRef_iterator tracks_end() const
last iterator over tracks
Definition: Vertex.h:110
BDpair estimateNFittedTrack(const CachingVertex< 5 > &v, const RefCountedVertexTrack track) const
trackRef_iterator tracks_begin() const
first iterator over tracks
Definition: Vertex.h:108
RefCountedLinearizedTrackState linearizedTrackState(const GlobalPoint &linP, const reco::TransientTrack &track) const override
BDpair estimateFittedTrack(const CachingVertex< 5 > &v, const RefCountedVertexTrack track) const
std::pair< bool, double > GsfVertexTrackCompatibilityEstimator::estimateFittedTrack ( const CachingVertex< 5 > &  v,
const RefCountedVertexTrack  track 
) const
private

Definition at line 65 of file GsfVertexTrackCompatibilityEstimator.cc.

66  {
67  //remove track from the vertex using the vertex updator
68  // Using the update instead of the remove methode, we can specify a weight which
69  // is different than then one which the vertex track has been defined with.
70  if (track->refittedStateAvailable())
71  return BDpair(true, track->smoothedChi2());
72  throw VertexException("GsfVertexTrackCompatibilityEstimator::vertex has to be smoothed.");
73 
74  // CachingVertex rVert = updator.remove(v, track);
75  // RefCountedVertexTrack newSmoothedTrack = trackUpdator.update(v, track);
76  // return estimateDifference(v,rVert,newSmoothedTrack);
77 }
Common base class.
std::pair< bool, double > GsfVertexTrackCompatibilityEstimator::estimateNFittedTrack ( const CachingVertex< 5 > &  v,
const RefCountedVertexTrack  track 
) const
private

Definition at line 81 of file GsfVertexTrackCompatibilityEstimator.cc.

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

82  {
83  // Using the update instead of the add methode, we can specify a weight which
84  // is different than then one which the vertex track has been defined with.
85  CachingVertex<5> rVert = updator.add(v, track);
86  if (!rVert.isValid())
87  return BDpair(false, -1.);
88  return BDpair(true, rVert.totalChiSquared() - v.totalChiSquared());
89 }
CachingVertex< 5 > add(const CachingVertex< 5 > &oldVertex, const RefCountedVertexTrack track) const override
float totalChiSquared() const
bool isValid() const

Member Data Documentation

MultiPerigeeLTSFactory GsfVertexTrackCompatibilityEstimator::lTrackFactory
private

Definition at line 60 of file GsfVertexTrackCompatibilityEstimator.h.

GsfVertexUpdator GsfVertexTrackCompatibilityEstimator::updator
private

Definition at line 58 of file GsfVertexTrackCompatibilityEstimator.h.

VertexTrackFactory<5> GsfVertexTrackCompatibilityEstimator::vTrackFactory
private

Definition at line 61 of file GsfVertexTrackCompatibilityEstimator.h.