#include <VertexDistance3D.h>
Public Member Functions | |
virtual VertexDistance3D * | clone () const |
virtual Measurement1D | signedDistance (const reco::Vertex &primVtx, const reco::Vertex &secVtx, const GlobalVector &momentum) const |
VertexDistance3D () | |
Private Member Functions | |
virtual float | compatibility (const GlobalPoint &vtx1Position, const GlobalError &vtx1PositionError, const GlobalPoint &vtx2Position, const GlobalError &vtx2PositionError) const |
virtual Measurement1D | distance (const GlobalPoint &vtx1Position, const GlobalError &vtx1PositionError, const GlobalPoint &vtx2Position, const GlobalError &vtx2PositionError) const |
Private Attributes | |
AlgebraicSymMatrix33 | theNullMatrix |
Computes the distance and chi-squared compatibility between two vertices with their 3D positions.
Definition at line 13 of file VertexDistance3D.h.
VertexDistance3D::VertexDistance3D | ( | ) | [inline] |
virtual VertexDistance3D* VertexDistance3D::clone | ( | void | ) | const [inline, virtual] |
Implements VertexDistance.
Definition at line 32 of file VertexDistance3D.h.
References VertexDistance3D().
{ return new VertexDistance3D(*this); }
float VertexDistance3D::compatibility | ( | const GlobalPoint & | vtx1Position, |
const GlobalError & | vtx1PositionError, | ||
const GlobalPoint & | vtx2Position, | ||
const GlobalError & | vtx2PositionError | ||
) | const [private, virtual] |
Implements VertexDistance.
Definition at line 47 of file VertexDistance3D.cc.
References diffTreeTool::diff, error, Exception, GlobalErrorBase< T, ErrorWeightType >::matrix(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().
{ // error matrix of residuals AlgebraicSymMatrix33 err1 = vtx1PositionError.matrix(); AlgebraicSymMatrix33 err2 = vtx2PositionError.matrix(); AlgebraicSymMatrix33 error = err1 + err2; if (error == theNullMatrix) return FLT_MAX; // position residuals GlobalVector diff = vtx2Position - vtx1Position; AlgebraicVector3 vDiff; vDiff[0] = diff.x(); vDiff[1] = diff.y(); vDiff[2] = diff.z(); // Invert error matrix of residuals bool ifail = !error.InvertChol(); if (ifail) { throw cms::Exception("VertexDistance3D::matrix inversion problem"); } return ROOT::Math::Similarity(error,vDiff); }
Measurement1D VertexDistance3D::distance | ( | const GlobalPoint & | vtx1Position, |
const GlobalError & | vtx1PositionError, | ||
const GlobalPoint & | vtx2Position, | ||
const GlobalError & | vtx2PositionError | ||
) | const [private, virtual] |
Implements VertexDistance.
Definition at line 22 of file VertexDistance3D.cc.
References diffTreeTool::diff, error, PV3DBase< T, PVType, FrameType >::mag(), GlobalErrorBase< T, ErrorWeightType >::matrix(), mathSSE::sqrt(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().
Referenced by VertexMerging::mergeVertex(), InclusiveVertexFinder::nearTracks(), and TrackIPProducer::produce().
{ AlgebraicSymMatrix33 error = vtx1PositionError.matrix() + vtx2PositionError.matrix(); GlobalVector diff = vtx1Position - vtx2Position; AlgebraicVector3 vDiff; vDiff[0] = diff.x(); vDiff[1] = diff.y(); vDiff[2] = diff.z(); double dist=diff.mag(); double err2 = ROOT::Math::Similarity(error,vDiff); double err = 0.; if (dist != 0) err = sqrt(err2)/dist; return Measurement1D(dist,err); }
Measurement1D VertexDistance3D::signedDistance | ( | const reco::Vertex & | primVtx, |
const reco::Vertex & | secVtx, | ||
const GlobalVector & | momentum | ||
) | const [virtual] |
The signed distance is computed using a vector from the primary to the secondary vertex and a given reference vector. The sign is determined by the scalar product of the vector connecting the vertices and the reference vector: if the scalar product is greater than zero, the sign is +1, else -1
Implements VertexDistance.
Definition at line 8 of file VertexDistance3D.cc.
References diffTreeTool::diff, Measurement1D::error(), reco::Vertex::position(), Measurement1D::value(), PV3DBase< T, PVType, FrameType >::x(), Basic3DVector< T >::x(), PV3DBase< T, PVType, FrameType >::y(), Basic3DVector< T >::y(), PV3DBase< T, PVType, FrameType >::z(), and Basic3DVector< T >::z().
{ Measurement1D unsignedDistance = distance(vtx1, vtx2); Basic3DVector<float> diff = Basic3DVector<float> (vtx2.position()) - Basic3DVector<float> (vtx1.position()); // Basic3DVector<float> (vtx2 - vtx1); if ((momentum.x()*diff.x() + momentum.y()*diff.y() * momentum.z()*diff.z()) < 0 ) return Measurement1D(-1.0*unsignedDistance.value(),unsignedDistance.error()); return unsignedDistance; }
Definition at line 41 of file VertexDistance3D.h.