#include <VertexDistanceXY.h>
Public Member Functions | |
virtual VertexDistanceXY * | clone () const |
virtual Measurement1D | signedDistance (const reco::Vertex &primVtx, const reco::Vertex &secVtx, const GlobalVector &momentum) const |
VertexDistanceXY () | |
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 | |
AlgebraicSymMatrix22 | theNullMatrix |
Computes the distance between two vertices as the chi-squared formed with their positions in the transverse plane.
Definition at line 11 of file VertexDistanceXY.h.
VertexDistanceXY::VertexDistanceXY | ( | ) | [inline] |
virtual VertexDistanceXY* VertexDistanceXY::clone | ( | void | ) | const [inline, virtual] |
Implements VertexDistance.
Definition at line 29 of file VertexDistanceXY.h.
References VertexDistanceXY().
{ return new VertexDistanceXY(*this); }
float VertexDistanceXY::compatibility | ( | const GlobalPoint & | vtx1Position, |
const GlobalError & | vtx1PositionError, | ||
const GlobalPoint & | vtx2Position, | ||
const GlobalError & | vtx2PositionError | ||
) | const [private, virtual] |
Implements VertexDistance.
Definition at line 49 of file VertexDistanceXY.cc.
References diffTreeTool::diff, error, Exception, GlobalErrorBase< T, ErrorWeightType >::matrix(), PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().
{ // error matrix of residuals AlgebraicSymMatrix33 err1 = vtx1PositionError.matrix(); AlgebraicSymMatrix33 err2 = vtx2PositionError.matrix(); AlgebraicSymMatrix22 error; error[0][0] = err1[0][0] + err2[0][0]; error[0][1] = err1[0][1] + err2[0][1]; error[1][1] = err1[1][1] + err2[1][1]; if (error == theNullMatrix) return FLT_MAX; // position residuals GlobalVector diff = vtx2Position - vtx1Position; AlgebraicVector2 vDiff; vDiff[0] = diff.x(); vDiff[1] = diff.y(); // Invert error matrix of residuals bool ifail = !error.Invert(); if (ifail) { throw cms::Exception("VertexDistanceXY::matrix inversion problem"); } return ROOT::Math::Similarity(error,vDiff); }
Measurement1D VertexDistanceXY::distance | ( | const GlobalPoint & | vtx1Position, |
const GlobalError & | vtx1PositionError, | ||
const GlobalPoint & | vtx2Position, | ||
const GlobalError & | vtx2PositionError | ||
) | const [private, virtual] |
Implements VertexDistance.
Definition at line 25 of file VertexDistanceXY.cc.
References diffTreeTool::diff, error, GlobalErrorBase< T, ErrorWeightType >::matrix(), funct::pow(), mathSSE::sqrt(), PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().
{ AlgebraicSymMatrix33 error = vtx1PositionError.matrix() + vtx2PositionError.matrix(); GlobalVector diff = vtx1Position - vtx2Position; AlgebraicVector3 vDiff; vDiff[0] = diff.x(); vDiff[1] = diff.y(); vDiff[2] = 0.; double dist=sqrt(pow(diff.x(),2)+pow(diff.y(),2)); double err2 = ROOT::Math::Similarity(error,vDiff); double err = 0; if( dist != 0) err = sqrt(err2)/dist; return Measurement1D(dist,err); }
Measurement1D VertexDistanceXY::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 x,y component 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 11 of file VertexDistanceXY.cc.
References diffTreeTool::diff, Measurement1D::error(), reco::Vertex::position(), Measurement1D::value(), PV3DBase< T, PVType, FrameType >::x(), Basic3DVector< T >::x(), PV3DBase< T, PVType, FrameType >::y(), and Basic3DVector< T >::y().
{ Measurement1D unsignedDistance = distance(vtx1, vtx2); Basic3DVector<float> diff = Basic3DVector<float> (vtx2.position()) - Basic3DVector<float> (vtx1.position()); if ((momentum.x()*diff.x() + momentum.y()*diff.y()) < 0 ) return Measurement1D(-1.0*unsignedDistance.value(),unsignedDistance.error()); return unsignedDistance; }
Definition at line 40 of file VertexDistanceXY.h.