CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_1/src/DataFormats/PatCandidates/interface/Vertexing.h

Go to the documentation of this file.
00001 #ifndef DataFormats_PatCandidates_interface_Vertexing_h
00002 #define DataFormats_PatCandidates_interface_Vertexing_h
00003 
00004 #include "DataFormats/VertexReco/interface/VertexFwd.h"
00005 #include "DataFormats/VertexReco/interface/Vertex.h"
00006 #include "DataFormats/TrackReco/interface/Track.h"
00007 #include "DataFormats/Common/interface/Ptr.h"
00008 #include "DataFormats/GeometryCommonDetAlgo/interface/Measurement1DFloat.h"
00009 #include "DataFormats/GeometryCommonDetAlgo/interface/Measurement1D.h"
00010 
00026 namespace pat {
00027     class VertexAssociation {
00028         public:
00030             VertexAssociation() {}
00032             VertexAssociation(const reco::VertexRef &vertex) : vertex_(vertex) {}
00036             VertexAssociation(const reco::VertexRef &vertex, const reco::TrackBaseRef &tk) : vertex_(vertex), track_(tk) {}
00037             // --- Methods to mimick VertexRef
00039             bool  isNull() const      { return vertex_.isNull(); }
00041             bool  isNonnull() const   { return vertex_.isNonnull(); }
00043             bool  isAvailable() const { return vertex_.isAvailable(); }
00045             const reco::Vertex & operator*()  const { return * operator->(); }
00047             const reco::Vertex * operator->() const { return vertex_.isNull() ? 0 : vertex_.get(); }
00048             // --- Methods to get the Vertex and track
00050             const reco::VertexRef & vertexRef() const  { return vertex_; }
00052             const reco::Vertex    * vertex()    const  { return vertex_.isNull() ? 0 : vertex_.get(); }
00054             bool                       hasTrack() const { return !track_.isNull(); }
00056             const reco::TrackBaseRef & trackRef() const { return track_; }
00058             const reco::Track        * track()    const { return hasTrack() ? track_.get() : 0; }
00059             // --- Methods to return distances
00062             const Measurement1DFloat & dz() const { return dz_; }
00064             const Measurement1DFloat & dr() const { return dr_; }
00066             bool  hasTransverseIP() const { return (dr_.value() != 0); }
00068             bool  hasErrors()       const { return (dz_.error() != 0) && ( !hasTransverseIP() || dr_.error() != 0 ); }
00069             // ---- Methods to set distances 
00070             void setDz(const Measurement1DFloat & dz) { dz_ = dz; }
00071             void setDr(const Measurement1DFloat & dr) { dr_ = dr; }
00072             void setDz(const Measurement1D & dz)      { dz_ = Measurement1DFloat(dz.value(), dz.error()); }
00073             void setDr(const Measurement1D & dr)      { dr_ = Measurement1DFloat(dr.value(), dr.error()); }
00075             void setDistances(const AlgebraicVector3 & dist, const AlgebraicSymMatrix33 &err) ;
00079             template<typename T1, typename T2>
00080             void setDistances(const T1 & p1, const T2 &p2, const AlgebraicSymMatrix33 &err) {
00081                 AlgebraicVector3 dist(p1.x() - p2.x(), p1.y() - p2.y(), p1.z() - p2.z());
00082                 setDistances(dist, err);
00083             }
00084             // ---- 3D significance of the impact parameter
00085             // float signif3d()           const { return signif3d_; }
00086             // bool  hasSignif3d()        const { return signif3d_ != 0; }
00087             // void setSignif3d(float signif3d) { signif3d_ = signif3d; }
00088         private:
00089             // basic information
00090             reco::VertexRef vertex_;
00091             Measurement1DFloat dz_, dr_;
00092             // float signif3d_;
00093             // extended info
00094             reco::TrackBaseRef track_;
00095             // fixme: add refitted momentum
00096     };
00097 }
00098 
00099 #endif