CMS 3D CMS Logo

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 >

List of all members.

Public Types

typedef std::pair< bool, double > BDpair
typedef VertexTrack< N >
::RefCountedLinearizedTrackState 
RefCountedLinearizedTrackState
typedef VertexTrack< N >
::RefCountedRefittedTrackState 
RefCountedRefittedTrackState
typedef CachingVertex< N >
::RefCountedVertexTrack 
RefCountedVertexTrack

Public Member Functions

virtual
KalmanVertexTrackCompatibilityEstimator
< N > * 
clone () 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
virtual BDpair estimate (const CachingVertex< N > &vrt, const RefCountedVertexTrack track, unsigned int hint=UINT_MAX) const
 KalmanVertexTrackCompatibilityEstimator ()
virtual ~KalmanVertexTrackCompatibilityEstimator ()

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< N > helper
KalmanVertexTrackUpdator< N > trackUpdator
KalmanVertexUpdator< N > updator
VertexTrackFactory< N > vTrackFactory

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 32 of file KalmanVertexTrackCompatibilityEstimator.h.


Constructor & Destructor Documentation

template<unsigned int N>
virtual KalmanVertexTrackCompatibilityEstimator< N >::~KalmanVertexTrackCompatibilityEstimator ( ) [inline, virtual]

Definition at line 37 of file KalmanVertexTrackCompatibilityEstimator.h.

{}

Member Function Documentation

template<unsigned int N>
virtual KalmanVertexTrackCompatibilityEstimator<N>* KalmanVertexTrackCompatibilityEstimator< N >::clone ( ) const [inline, virtual]
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 pos, testEve_cfg::tracks, and CachingVertex< N >::tracksRef().

Referenced by MultiVertexFitter::updateWeights().

{
//checking if the track passed really belongs to the vertex

  const std::vector<RefCountedVertexTrack> &tracks = vertex.tracksRef();

  if ( tracks.size()==0)
   return estimateNFittedTrack(vertex,tr);

  if (hint<tracks.size() ) {
    VertexTrackEqual<N> d(tr);
    if ( d(tracks[hint]))
      return estimateFittedTrack(vertex,tracks[hint]);
  }

  typename std::vector<RefCountedVertexTrack>::const_iterator pos 
    = find_if(tracks.begin(), tracks.end(), VertexTrackEqual<N>(tr));
  if(pos != tracks.end()) {
    return estimateFittedTrack(vertex,*pos);
  } else {
    return estimateNFittedTrack(vertex,tr);
  }
} 
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().

{
  RefCountedVertexTrack vertexTrack = vTrackFactory.vertexTrack(track,
                                                 vertex.vertexState());
  return estimate(vertex, vertexTrack,hint);
}
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().

{       
//   GlobalPoint linP(vertex.position().x(), vertex.position().z(),vertex.position().z());
    GlobalPoint linP(Basic3DVector<float> (vertex.position()));

  LinearizedTrackStateFactory lTrackFactory;
  RefCountedLinearizedTrackState linTrack = 
                        lTrackFactory.linearizedTrackState(linP, track);
  GlobalError err(vertex.covariance());
  VertexState vState(linP, err);
  RefCountedVertexTrack vertexTrack = vTrackFactory.vertexTrack(linTrack, vState);

  std::vector<RefCountedVertexTrack> initialTracks(1, vertexTrack);
  CachingVertex<N> cachingVertex(linP, err, initialTracks,
                            vertex.chi2());
  // FIXME: this should work also for tracks without a persistent ref.
//   return estimateNFittedTrack(cachingVertex, vertexTrack);
  if (find(vertex.tracks_begin(), vertex.tracks_end(), track.trackBaseRef()) != vertex.tracks_end())
  {
    return estimateFittedTrack(cachingVertex, vertexTrack);
  } else {
    return estimateNFittedTrack(cachingVertex, vertexTrack);
  }
}
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.

{
  BDpair trackRes = helper.trackParameterChi2(track);
  return BDpair(trackRes.first, trackRes.second + helper.vertexChi2(less, more)) ;
}
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.

{
  //remove track from the vertex using the vertex updator
  // Using the update instead of the remove methode, we can specify a weight which
  // is different than then one which the vertex track has been defined with.
  //CachingVertex rVert = updator.remove(v, track);
  RefCountedVertexTrack newSmoothedTrack = trackUpdator.update(v, track);
//   std::cout << newSmoothedTrack->smoothedChi2()<<" "<<estimateDifference(v,rVert,newSmoothedTrack)<<std::endl;
//   return estimateDifference(v,rVert,newSmoothedTrack);
  return BDpair(true, newSmoothedTrack->smoothedChi2());
}
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(), and CachingVertex< N >::totalChiSquared().

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

Member Data Documentation

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

Definition at line 72 of file KalmanVertexTrackCompatibilityEstimator.h.

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.