CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/RecoVertex/VertexPrimitives/interface/TransientVertex.h

Go to the documentation of this file.
00001 #ifndef _Vtx_TransientVertex_H_
00002 #define _Vtx_TransientVertex_H_
00003 
00004 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
00005 #include "DataFormats/GeometryCommonDetAlgo/interface/GlobalError.h"
00006 #include "TrackingTools/TransientTrack/interface/TransientTrack.h"
00007 #include "RecoVertex/VertexPrimitives/interface/VertexState.h"
00008 #include "RecoVertex/VertexPrimitives/interface/TTtoTTmap.h"
00009 #include "DataFormats/VertexReco/interface/Vertex.h"
00010 
00011 #include <vector>
00012 #include <map>
00013 
00017 class TransientVertex {//: public reco::Vertex {
00018 
00019 public:
00020 
00021   typedef std::map<reco::TransientTrack, float> TransientTrackToFloatMap;
00022 
00025   TransientVertex();
00026 
00033   TransientVertex(const GlobalPoint & pos, const GlobalError & posError,
00034             const std::vector<reco::TransientTrack> & tracks, float chi2);
00035 
00041   TransientVertex(const GlobalPoint & pos, const GlobalError & posError,
00042             const std::vector<reco::TransientTrack> & tracks, float chi2, float ndf);
00043 
00050   TransientVertex(const GlobalPoint & priorPos, const GlobalError & priorErr,
00051             const GlobalPoint & pos, const GlobalError & posError,
00052             const std::vector<reco::TransientTrack> & tracks, float chi2);
00053 
00059   TransientVertex(const GlobalPoint & priorPos, const GlobalError & priorErr,
00060             const GlobalPoint & pos, const GlobalError & posError,
00061             const std::vector<reco::TransientTrack> & tracks, float chi2, float ndf);
00062 
00069   TransientVertex(const VertexState & state, 
00070                     const std::vector<reco::TransientTrack> & tracks, float chi2);
00071 
00077   TransientVertex(const VertexState & state, 
00078                     const std::vector<reco::TransientTrack> & tracks, float chi2, float ndf);
00079 
00086   TransientVertex(const VertexState & prior,
00087                     const VertexState & state,
00088                     const std::vector<reco::TransientTrack> & tracks, float chi2);
00089 
00095   TransientVertex(const VertexState & prior,
00096                     const VertexState & state,
00097                     const std::vector<reco::TransientTrack> & tracks, float chi2, float ndf);
00098 
00099 
00100 //   /** Constructor defining the RecVertex by its 3D position
00101 //    *  and position uncertainty, its associated tracks, its chi-squared
00102 //    *  and its number of degrees of freedom, and the track weights. 
00103 //    *  The ndf can be a float.
00104 //    */
00105 //   TransientVertex(const VertexState & state, 
00106 //                  const std::vector<reco::TransientTrack> & tracks, float chi2, float ndf, 
00107 //                  const reco::TransientTrackToFloatMap & weightMap);
00108 
00109 
00112   VertexState vertexState() const { return theVertexState; }
00113   GlobalPoint position() const { return theVertexState.position(); }
00114   GlobalError positionError() const { return theVertexState.error(); }
00115   GlobalPoint priorPosition() const { return thePriorVertexState.position(); }
00116   GlobalError priorError() const { return thePriorVertexState.error(); }
00117   bool hasPrior() const { return withPrior; }
00118 
00119 //   /** Implements method of abstract Vertex.
00120 //    *  Returns track pointer container by value
00121 //    */
00122 //   Vertex::TrackPtrContainer tracks() const;
00123 
00124   float totalChiSquared() const { return theChi2; }
00125   float normalisedChiSquared() const {
00126     return totalChiSquared() / degreesOfFreedom();
00127   }
00128   float degreesOfFreedom() const { return theNDF; }
00129 
00133   bool isValid() const {
00134     return vertexValid;
00135   }
00136 
00140   std::vector<reco::TransientTrack> originalTracks() const {
00141     return theOriginalTracks;
00142   }
00143 
00144 
00149   bool hasRefittedTracks() const { return withRefittedTracks; }
00150 
00151 
00155   std::vector<reco::TransientTrack> refittedTracks() const {
00156     return theRefittedTracks;
00157   }
00158 
00164   reco::TransientTrack originalTrack(const reco::TransientTrack & refTrack) const;
00165 
00170   reco::TransientTrack refittedTrack(const reco::TransientTrack & track) const;
00171 
00172 
00175   void refittedTracks(const std::vector<reco::TransientTrack> & refittedTracks);
00176 
00180   bool hasTrackWeight() const { return theWeightMapIsAvailable; }
00181 
00182 
00190   float trackWeight(const reco::TransientTrack & track) const;
00191 
00192   TransientTrackToFloatMap weightMap() const { return theWeightMap; }
00193 
00194   void weightMap(const TransientTrackToFloatMap & theMap);
00195 
00199   bool tkToTkCovarianceIsAvailable() const { return theCovMapAvailable; }
00200 
00206   AlgebraicMatrix33 tkToTkCovariance(const reco::TransientTrack& t1, 
00207                                 const reco::TransientTrack& t2) const;
00208   void tkToTkCovariance(const TTtoTTmap covMap);
00209 
00210   operator reco::Vertex() const;
00211 
00212 private:
00213 
00214 
00215   mutable VertexState thePriorVertexState;
00216   mutable VertexState theVertexState;
00217 
00218 //   void addTracks(const std::vector<reco::TransientTrack> & tracks);
00219 
00220   std::vector<reco::TransientTrack> theOriginalTracks;
00221   std::vector<reco::TransientTrack> theRefittedTracks;
00222 
00223 
00224   float theChi2;
00225   float theNDF;
00226   bool vertexValid;
00227   bool withPrior, theWeightMapIsAvailable, theCovMapAvailable;
00228   bool withRefittedTracks;
00229   TTtoTTmap theCovMap;
00230   TransientTrackToFloatMap theWeightMap;
00231 
00232 };
00233 
00234 #endif