CMS 3D CMS Logo

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

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

Member Typedef Documentation

◆ BDpair

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

Definition at line 29 of file KalmanVertexTrackCompatibilityEstimator.h.

◆ RefCountedLinearizedTrackState

Definition at line 27 of file KalmanVertexTrackCompatibilityEstimator.h.

◆ RefCountedRefittedTrackState

Definition at line 28 of file KalmanVertexTrackCompatibilityEstimator.h.

◆ RefCountedVertexTrack

Definition at line 26 of file KalmanVertexTrackCompatibilityEstimator.h.

Constructor & Destructor Documentation

◆ KalmanVertexTrackCompatibilityEstimator()

◆ ~KalmanVertexTrackCompatibilityEstimator()

template<unsigned int N>
KalmanVertexTrackCompatibilityEstimator< N >::~KalmanVertexTrackCompatibilityEstimator ( )
inlineoverride

Definition at line 33 of file KalmanVertexTrackCompatibilityEstimator.h.

33 {}

Member Function Documentation

◆ clone()

template<unsigned int N>
KalmanVertexTrackCompatibilityEstimator<N>* KalmanVertexTrackCompatibilityEstimator< N >::clone ( ) const
inlineoverridevirtual

◆ estimate() [1/3]

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

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 8 of file KalmanVertexTrackCompatibilityEstimator.cc.

References ztail::d, DiMuonV_cfg::tracks, and bphysicsOniaDQM_cfi::vertex.

Referenced by MultiVertexFitter::updateWeights().

9  {
10  //checking if the track passed really belongs to the vertex
11 
12  const std::vector<RefCountedVertexTrack> &tracks = vertex.tracksRef();
13 
14  if (tracks.empty())
15  return estimateNFittedTrack(vertex, tr);
16 
17  if (hint < tracks.size()) {
19  if (d(tracks[hint]))
20  return estimateFittedTrack(vertex, tracks[hint]);
21  }
22 
23  typename std::vector<RefCountedVertexTrack>::const_iterator pos =
24  find_if(tracks.begin(), tracks.end(), VertexTrackEqual<N>(tr));
25  if (pos != tracks.end()) {
26  return estimateFittedTrack(vertex, *pos);
27  } else {
28  return estimateNFittedTrack(vertex, tr);
29  }
30 }
d
Definition: ztail.py:151
BDpair estimateFittedTrack(const CachingVertex< N > &v, const RefCountedVertexTrack track) const
BDpair estimateNFittedTrack(const CachingVertex< N > &v, const RefCountedVertexTrack track) const

◆ estimate() [2/3]

template<unsigned int N>
KalmanVertexTrackCompatibilityEstimator< N >::BDpair KalmanVertexTrackCompatibilityEstimator< N >::estimate ( const CachingVertex< N > &  v,
const RefCountedLinearizedTrackState  track,
unsigned int  hint = UINT_MAX 
) const
overridevirtual

Methods giving back the compatibility estimation

Implements VertexTrackCompatibilityEstimator< N >.

Definition at line 33 of file KalmanVertexTrackCompatibilityEstimator.cc.

References HLT_2024v12_cff::track, and bphysicsOniaDQM_cfi::vertex.

34  {
35  RefCountedVertexTrack vertexTrack = vTrackFactory.vertexTrack(track, vertex.vertexState());
36  return estimate(vertex, vertexTrack, hint);
37 }
BDpair estimate(const CachingVertex< N > &vrt, const RefCountedVertexTrack track, unsigned int hint=UINT_MAX) const override
CachingVertex< N >::RefCountedVertexTrack RefCountedVertexTrack

◆ estimate() [3/3]

template<unsigned int N>
KalmanVertexTrackCompatibilityEstimator< N >::BDpair KalmanVertexTrackCompatibilityEstimator< N >::estimate ( const reco::Vertex vertex,
const reco::TransientTrack track 
) const
overridevirtual

Implements VertexTrackCompatibilityEstimator< N >.

Definition at line 40 of file KalmanVertexTrackCompatibilityEstimator.cc.

References submitPVResolutionJobs::err, spr::find(), LinearizedTrackStateFactory::linearizedTrackState(), HLT_2024v12_cff::track, and bphysicsOniaDQM_cfi::vertex.

41  {
42  // GlobalPoint linP(vertex.position().x(), vertex.position().z(),vertex.position().z());
43  GlobalPoint linP(Basic3DVector<float>(vertex.position()));
44 
45  LinearizedTrackStateFactory lTrackFactory;
46  RefCountedLinearizedTrackState linTrack = lTrackFactory.linearizedTrackState(linP, track);
47  GlobalError err(vertex.covariance());
48  VertexState vState(linP, err);
49  RefCountedVertexTrack vertexTrack = vTrackFactory.vertexTrack(linTrack, vState);
50 
51  std::vector<RefCountedVertexTrack> initialTracks(1, vertexTrack);
52  CachingVertex<N> cachingVertex(linP, err, initialTracks, vertex.chi2());
53  // FIXME: this should work also for tracks without a persistent ref.
54  // return estimateNFittedTrack(cachingVertex, vertexTrack);
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 }
RefCountedLinearizedTrackState linearizedTrackState(const GlobalPoint &linP, const reco::TransientTrack &track) const override
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
VertexTrack< N >::RefCountedLinearizedTrackState RefCountedLinearizedTrackState
BDpair estimateFittedTrack(const CachingVertex< N > &v, const RefCountedVertexTrack track) const
CachingVertex< N >::RefCountedVertexTrack RefCountedVertexTrack
BDpair estimateNFittedTrack(const CachingVertex< N > &v, const RefCountedVertexTrack track) const

◆ estimateDifference()

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 95 of file KalmanVertexTrackCompatibilityEstimator.cc.

References gpuVertexFinder::more, and HLT_2024v12_cff::track.

97  {
98  BDpair trackRes = helper.trackParameterChi2(track);
99  return BDpair(trackRes.first, trackRes.second + helper.vertexChi2(less, more));
100 }
Definition: helper.py:1

◆ estimateFittedTrack()

template<unsigned int N>
KalmanVertexTrackCompatibilityEstimator< N >::BDpair KalmanVertexTrackCompatibilityEstimator< N >::estimateFittedTrack ( const CachingVertex< N > &  v,
const RefCountedVertexTrack  track 
) const
private

Definition at line 67 of file KalmanVertexTrackCompatibilityEstimator.cc.

References HLT_2024v12_cff::track, and findQualityFiles::v.

68  {
69  //remove track from the vertex using the vertex updator
70  // Using the update instead of the remove methode, we can specify a weight which
71  // is different than then one which the vertex track has been defined with.
72  //CachingVertex rVert = updator.remove(v, track);
73  RefCountedVertexTrack newSmoothedTrack = trackUpdator.update(v, track);
74  // std::cout << newSmoothedTrack->smoothedChi2()<<" "<<estimateDifference(v,rVert,newSmoothedTrack)<<std::endl;
75  // return estimateDifference(v,rVert,newSmoothedTrack);
76  return BDpair(true, newSmoothedTrack->smoothedChi2());
77 }
CachingVertex< N >::RefCountedVertexTrack RefCountedVertexTrack

◆ estimateNFittedTrack()

template<unsigned int N>
KalmanVertexTrackCompatibilityEstimator< N >::BDpair KalmanVertexTrackCompatibilityEstimator< N >::estimateNFittedTrack ( const CachingVertex< N > &  v,
const RefCountedVertexTrack  track 
) const
private

Definition at line 83 of file KalmanVertexTrackCompatibilityEstimator.cc.

References CachingVertex< N >::isValid(), CachingVertex< N >::totalChiSquared(), HLT_2024v12_cff::track, HLT_2024v12_cff::updator, and findQualityFiles::v.

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

Member Data Documentation

◆ helper

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

Definition at line 66 of file KalmanVertexTrackCompatibilityEstimator.h.

◆ trackUpdator

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

Definition at line 64 of file KalmanVertexTrackCompatibilityEstimator.h.

◆ updator

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

Definition at line 63 of file KalmanVertexTrackCompatibilityEstimator.h.

◆ vTrackFactory

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

Definition at line 65 of file KalmanVertexTrackCompatibilityEstimator.h.