CMS 3D CMS Logo

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