00001 #ifndef VertexTrack_H
00002 #define VertexTrack_H
00003
00004 #include "RecoVertex/VertexPrimitives/interface/LinearizedTrackState.h"
00005 #include "RecoVertex/VertexPrimitives/interface/VertexState.h"
00006 #include "RecoVertex/VertexPrimitives/interface/RefittedTrackState.h"
00007 #include "RecoVertex/VertexPrimitives/interface/VertexException.h"
00008
00014 template <unsigned int N>
00015 class VertexTrack : public ReferenceCounted {
00016
00017 public:
00018
00019 typedef ROOT::Math::SVector<double,N> AlgebraicVectorN;
00020 typedef ROOT::Math::SMatrix<double,N-2,N-2,ROOT::Math::MatRepStd<double,N-2,N-2> > AlgebraicMatrixMM;
00021 typedef ROOT::Math::SMatrix<double,3,N-2,ROOT::Math::MatRepStd<double,3,N-2> > AlgebraicMatrix3M;
00022
00023
00024 typedef ReferenceCountingPointer<LinearizedTrackState<N> > RefCountedLinearizedTrackState;
00025 typedef ReferenceCountingPointer<RefittedTrackState<N> > RefCountedRefittedTrackState;
00026
00029 VertexTrack(const RefCountedLinearizedTrackState lt,
00030 const VertexState v,
00031 float weight);
00032
00036 VertexTrack(const RefCountedLinearizedTrackState lt,
00037 const VertexState v,
00038 float weight, const RefCountedRefittedTrackState & refittedState,
00039 float smoothedChi2);
00040
00044 VertexTrack(const RefCountedLinearizedTrackState lt,
00045 const VertexState v,
00046 float weight, const RefCountedRefittedTrackState & refittedState,
00047 float smoothedChi2, const AlgebraicMatrix3M & tVCov);
00048
00051 RefCountedLinearizedTrackState linearizedTrack() const { return theLinTrack; }
00052 VertexState vertexState() const { return theVertexState; }
00053 float weight() const { return theWeight; }
00054 bool refittedStateAvailable() const { return stAvailable; }
00055 bool tkToVertexCovarianceAvailable() const { return covAvailable; }
00056
00063 float smoothedChi2() const { return smoothedChi2_; }
00064
00065
00068 RefCountedRefittedTrackState refittedState() const {
00069 if (!refittedStateAvailable()) {
00070 throw VertexException("VertexTrack::refitted state not available");
00071 }
00072 return theRefittedState;
00073 }
00074
00077 AlgebraicMatrix3M tkToVtxCovariance() const {
00078 if (!tkToVertexCovarianceAvailable()) {
00079 throw VertexException("VertexTrack::track to vertex covariance not available");
00080 }
00081 return tkTVCovariance;
00082 }
00083
00087 bool operator==(const VertexTrack<N> & data) const
00088 {
00089 return ((*data.linearizedTrack()) == (*linearizedTrack()));
00090 }
00091
00094 AlgebraicVectorN refittedParamFromEquation() const;
00095
00096
00097 private:
00098
00099 RefCountedLinearizedTrackState theLinTrack;
00100 VertexState theVertexState;
00101 float theWeight;
00102 bool stAvailable;
00103 bool covAvailable;
00104 RefCountedRefittedTrackState theRefittedState;
00105 AlgebraicMatrix3M tkTVCovariance;
00106 float smoothedChi2_;
00107 };
00108
00109 template <unsigned int N>
00110 class VertexTrackEqual {
00111 public:
00112 typedef ReferenceCountingPointer<VertexTrack<N> > RefCountedVertexTrack;
00113 VertexTrackEqual( const RefCountedVertexTrack & t) : track_( t ) { }
00114 bool operator()( const RefCountedVertexTrack & t ) const { return t->operator==(*track_);}
00115 private:
00116 const RefCountedVertexTrack & track_;
00117 };
00118
00119 #endif