CMS 3D CMS Logo

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