CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_14/src/RecoVertex/VertexPrimitives/interface/CachingVertex.h

Go to the documentation of this file.
00001 #ifndef CachingVertex_H
00002 #define CachingVertex_H
00003 
00004 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
00005 #include "DataFormats/GeometryCommonDetAlgo/interface/GlobalError.h"
00006 #include "DataFormats/GeometryCommonDetAlgo/interface/GlobalWeight.h"
00007 
00008 #include "RecoVertex/VertexPrimitives/interface/VertexState.h"
00009 #include "RecoVertex/VertexPrimitives/interface/TransientVertex.h"
00010 
00011 #include "DataFormats/GeometrySurface/interface/ReferenceCounted.h"
00012 #include "RecoVertex/VertexPrimitives/interface/VertexTrack.h"
00013 
00014 #include <vector>
00015 #include <map>
00016 
00017 
00018 
00024 template <unsigned int N>
00025 class CachingVertex {
00026 
00027 public:
00028 
00029   typedef ReferenceCountingPointer<VertexTrack<N> > RefCountedVertexTrack;
00030   typedef ROOT::Math::SMatrix<double,N,N,ROOT::Math::MatRepSym<double,N> > AlgebraicSymMatrixNN;
00031   typedef ROOT::Math::SMatrix<double,N-2,N-2,ROOT::Math::MatRepStd<double,N-2,N-2> > AlgebraicMatrixMM;
00032   typedef std::map<RefCountedVertexTrack, AlgebraicMatrixMM > TrackMap;
00033   typedef std::map<RefCountedVertexTrack, TrackMap > TrackToTrackMap;
00034 
00037   CachingVertex(const GlobalPoint & pos, const GlobalError & posErr, 
00038                 const std::vector<RefCountedVertexTrack> & tks, float totalChiSq);
00039 
00040   CachingVertex(const GlobalPoint & pos, const GlobalWeight & posWeight, 
00041                 const std::vector<RefCountedVertexTrack> & tks, float totalChiSq);
00042 
00043   CachingVertex(const AlgebraicVector3 & weightTimesPosition, 
00044                 const GlobalWeight & posWeight, 
00045                 const std::vector<RefCountedVertexTrack> & tks, 
00046                 float totalChiSq);
00047 
00048   CachingVertex(const GlobalPoint & priorPos, const GlobalError & priorErr,
00049                 const GlobalPoint & pos, const GlobalError & posErr, 
00050                 const std::vector<RefCountedVertexTrack> & tks, float totalChiSq);
00051 
00052   CachingVertex(const GlobalPoint & priorPos, const GlobalError & priorErr,
00053                 const GlobalPoint & pos, const GlobalWeight & posWeight, 
00054                 const std::vector<RefCountedVertexTrack> & tks, float totalChiSq);
00055 
00056   CachingVertex(const GlobalPoint & priorPos, const GlobalError & priorErr,
00057                 const AlgebraicVector3 & weightTimesPosition, 
00058                 const GlobalWeight & posWeight, 
00059                 const std::vector<RefCountedVertexTrack> & tks, 
00060                 float totalChiSq);
00061 
00062 
00063   CachingVertex(const VertexState & aVertexState, 
00064                 const std::vector<RefCountedVertexTrack> & tks, float totalChiSq);
00065 
00066   CachingVertex(const VertexState & priorVertexState, 
00067                 const VertexState & aVertexState,
00068                 const std::vector<RefCountedVertexTrack> & tks, float totalChiSq);
00069 
00070   CachingVertex(const VertexState & aVertexState,
00071                 const std::vector<RefCountedVertexTrack> & tks, 
00072                 float totalChiSq, const TrackToTrackMap & covMap);
00073 
00074   CachingVertex(const VertexState & priorVertexState, 
00075                 const VertexState & aVertexState,
00076                 const std::vector<RefCountedVertexTrack> & tks, 
00077                 float totalChiSq, const TrackToTrackMap & covMap);
00078 
00081   CachingVertex();
00082 
00085   VertexState vertexState() const {return theVertexState;}
00086   VertexState priorVertexState() const {return thePriorVertexState;}
00087   GlobalPoint position() const;
00088   GlobalError error() const;
00089   GlobalWeight weight() const;
00090   AlgebraicVector3 weightTimesPosition() const;
00091   std::vector<RefCountedVertexTrack> tracks() const { return theTracks; }
00092   GlobalPoint priorPosition() const {return priorVertexState().position();}
00093   GlobalError priorError() const {return priorVertexState().error();}
00094   bool hasPrior() const {return withPrior;}
00095   bool isValid() const {return theValid;}
00096 
00099   float totalChiSquared() const { return theChiSquared; }
00100   float degreesOfFreedom() const;
00101 
00104   AlgebraicMatrixMM tkToTkCovariance(const RefCountedVertexTrack t1, 
00105                                    const RefCountedVertexTrack t2) const;
00106   bool tkToTkCovarianceIsAvailable() const { return theCovMapAvailable; }
00107 
00108   operator TransientVertex() const;
00109 
00110 private:
00111 
00112   void computeNDF() const;
00113 
00114   mutable VertexState theVertexState;
00115   float theChiSquared;
00116   mutable float theNDF;
00117   mutable bool theNDFAvailable;
00118   std::vector<RefCountedVertexTrack> theTracks;
00119   TrackToTrackMap theCovMap;
00120   bool theCovMapAvailable;
00121   mutable VertexState thePriorVertexState;
00122   bool withPrior;
00123 
00124   bool theValid;
00125 };
00126 
00127 
00128 #endif