CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/RecoVertex/VertexPrimitives/interface/VertexTrack.h

Go to the documentation of this file.
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 #include "Math/SMatrix.h"
00009 #include "DataFormats/CLHEP/interface/Migration.h"
00010 
00016 template <unsigned int N>
00017 class VertexTrack : public ReferenceCounted {
00018 
00019 public:
00020 
00021   typedef ROOT::Math::SVector<double,N> AlgebraicVectorN;
00022   typedef ROOT::Math::SMatrix<double,N-2,N-2,ROOT::Math::MatRepStd<double,N-2,N-2> > AlgebraicMatrixMM;
00023   typedef ROOT::Math::SMatrix<double,3,N-2,ROOT::Math::MatRepStd<double,3,N-2> > AlgebraicMatrix3M;
00024   typedef ROOT::Math::SMatrix<double,N+1,N+1,ROOT::Math::MatRepSym<double,N+1> > AlgebraicSymMatrixOO;
00025 
00026   //typedef ReferenceCountingPointer<VertexTrack<N> > RefCountedVertexTrack;
00027   typedef ReferenceCountingPointer<LinearizedTrackState<N> > RefCountedLinearizedTrackState;
00028   typedef ReferenceCountingPointer<RefittedTrackState<N> > RefCountedRefittedTrackState;
00029 
00032   VertexTrack(const RefCountedLinearizedTrackState lt, 
00033               const VertexState v, 
00034               float weight);
00035 
00039   VertexTrack(const RefCountedLinearizedTrackState lt, 
00040               const VertexState v, 
00041               float weight, const RefCountedRefittedTrackState & refittedState,
00042               float smoothedChi2);
00043 
00047   VertexTrack(const RefCountedLinearizedTrackState lt, 
00048               const VertexState v, 
00049               float weight, const RefCountedRefittedTrackState & refittedState,
00050               float smoothedChi2, const AlgebraicSymMatrixOO & fullCov);
00051 
00054   RefCountedLinearizedTrackState linearizedTrack() const { return theLinTrack; }
00055   VertexState vertexState() const { return theVertexState; }
00056   float weight() const { return theWeight; }
00057   bool refittedStateAvailable() const { return stAvailable; }
00058   bool tkToVertexCovarianceAvailable() const { return covAvailable; }
00059   bool fullCovarianceAvailable() const { return covAvailable; }
00060 
00067   float smoothedChi2() const { return smoothedChi2_; }
00068 
00069 
00072   RefCountedRefittedTrackState refittedState() const { 
00073     if (!refittedStateAvailable()) { 
00074       throw VertexException("VertexTrack::refitted state not available"); 
00075     }
00076     return theRefittedState;
00077   }
00078 
00079 //   /** Track to vertex covariance 
00080 //    */   
00081 //   AlgebraicMatrix3M tkToVtxCovariance() const;
00082 
00085   AlgebraicSymMatrixOO fullCovariance() const {
00086     if (!tkToVertexCovarianceAvailable()) {
00087       throw VertexException("VertexTrack::track to vertex covariance not available"); 
00088     }
00089     return fullCovariance_;
00090   }
00091 
00095   bool operator==(const VertexTrack<N> & data) const
00096   {
00097     return ((*data.linearizedTrack()) == (*linearizedTrack()));
00098   }
00099 
00102   AlgebraicVectorN refittedParamFromEquation() const;
00103  
00104 
00105 private:
00106 
00107   RefCountedLinearizedTrackState theLinTrack;
00108   VertexState theVertexState;
00109   float theWeight;
00110   bool stAvailable;
00111   bool covAvailable;
00112   RefCountedRefittedTrackState theRefittedState;
00113   AlgebraicSymMatrixOO  fullCovariance_;
00114   ROOT::Math::SMatrix<double,6,6,ROOT::Math::MatRepSym<double,6> > b6;
00115   ROOT::Math::SMatrix<double,7,7,ROOT::Math::MatRepSym<double,7> > b7;
00116   float smoothedChi2_;
00117 };
00118 
00119 template <unsigned int N>
00120 class VertexTrackEqual {
00121   public:
00122     typedef ReferenceCountingPointer<VertexTrack<N> > RefCountedVertexTrack;
00123     VertexTrackEqual( const RefCountedVertexTrack & t) : track_( t ) { }
00124     bool operator()( const RefCountedVertexTrack & t ) const { return t->operator==(*track_);}
00125   private:
00126     const RefCountedVertexTrack & track_;
00127 };
00128 
00129 #endif