CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
VertexDistanceXY Class Reference

#include <VertexDistanceXY.h>

Inheritance diagram for VertexDistanceXY:
VertexDistance

Public Member Functions

virtual VertexDistanceXYclone () const
 
virtual Measurement1D signedDistance (const reco::Vertex &primVtx, const reco::Vertex &secVtx, const GlobalVector &momentum) const
 
 VertexDistanceXY ()
 
- Public Member Functions inherited from VertexDistance
virtual float compatibility (const reco::Vertex &, const reco::Vertex &) const
 
virtual float compatibility (const VertexState &, const VertexState &) const
 
virtual float compatibility (const reco::Vertex &, const VertexState &) const
 
virtual float compatibility (const VertexState &, const reco::Vertex &) const
 
Measurement1D distance (const reco::Vertex &, const reco::Vertex &) const
 
Measurement1D distance (const VertexState &, const VertexState &) const
 
Measurement1D distance (const reco::Vertex &, const VertexState &) const
 
Measurement1D distance (const VertexState &, const reco::Vertex &) const
 
virtual ~VertexDistance ()
 

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

AlgebraicSymMatrix theNullMatrix
 

Additional Inherited Members

Detailed Description

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.

Constructor & Destructor Documentation

VertexDistanceXY::VertexDistanceXY ( )
inline

Definition at line 15 of file VertexDistanceXY.h.

Referenced by clone().

15 : theNullMatrix(3, 0) {}
AlgebraicSymMatrix theNullMatrix

Member Function Documentation

virtual VertexDistanceXY* VertexDistanceXY::clone ( void  ) const
inlinevirtual

Implements VertexDistance.

Definition at line 29 of file VertexDistanceXY.h.

References VertexDistanceXY().

30  {
31  return new VertexDistanceXY(*this);
32  }
float VertexDistanceXY::compatibility ( const GlobalPoint vtx1Position,
const GlobalError vtx1PositionError,
const GlobalPoint vtx2Position,
const GlobalError vtx2PositionError 
) const
privatevirtual

Implements VertexDistance.

Definition at line 49 of file VertexDistanceXY.cc.

References diffTreeTool::diff, error, edm::hlt::Exception, GlobalErrorBase< T, ErrorWeightType >::matrix(), PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

53 {
54  // error matrix of residuals
55  AlgebraicSymMatrix err1 = vtx1PositionError.matrix();
56  AlgebraicSymMatrix err2 = vtx2PositionError.matrix();
58  error[0][0] = err1[0][0] + err2[0][0];
59  error[0][1] = err1[0][1] + err2[0][1];
60  error[1][1] = err1[1][1] + err2[1][1];
61  if (error == theNullMatrix) return FLT_MAX;
62 
63  // position residuals
64  GlobalVector diff = vtx2Position - vtx1Position;
65  AlgebraicVector vDiff(2);
66  vDiff[0] = diff.x();
67  vDiff[1] = diff.y();
68 
69  // Invert error matrix of residuals
70  int ifail;
71  error.invert(ifail);
72  if (ifail != 0) {
73  throw cms::Exception("VertexDistanceXY::matrix inversion problem");
74  }
75 
76  return error.similarity(vDiff);
77 }
T y() const
Definition: PV3DBase.h:57
AlgebraicSymMatrix matrix() const
CLHEP::HepVector AlgebraicVector
AlgebraicSymMatrix theNullMatrix
CLHEP::HepSymMatrix AlgebraicSymMatrix
T x() const
Definition: PV3DBase.h:56
Measurement1D VertexDistanceXY::distance ( const GlobalPoint vtx1Position,
const GlobalError vtx1PositionError,
const GlobalPoint vtx2Position,
const GlobalError vtx2PositionError 
) const
privatevirtual

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().

29 {
30  AlgebraicSymMatrix error = vtx1PositionError.matrix()
31  + vtx2PositionError.matrix();
32  GlobalVector diff = vtx1Position - vtx2Position;
33  AlgebraicVector vDiff(3);
34  vDiff[0] = diff.x();
35  vDiff[1] = diff.y();
36  vDiff[2] = 0.;
37 
38  double dist=sqrt(pow(diff.x(),2)+pow(diff.y(),2));
39 
40  double err2 = error.similarity(vDiff);
41  double err = 0;
42  if( dist != 0) err = sqrt(err2)/dist;
43 
44  return Measurement1D(dist,err);
45 }
T y() const
Definition: PV3DBase.h:57
AlgebraicSymMatrix matrix() const
T sqrt(T t)
Definition: SSEVec.h:28
CLHEP::HepVector AlgebraicVector
CLHEP::HepSymMatrix AlgebraicSymMatrix
T x() const
Definition: PV3DBase.h:56
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
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().

13 {
14  Measurement1D unsignedDistance = distance(vtx1, vtx2);
15  Basic3DVector<float> diff = Basic3DVector<float> (vtx2.position()) -
16  Basic3DVector<float> (vtx1.position());
17  if ((momentum.x()*diff.x() + momentum.y()*diff.y()) < 0 )
18  return Measurement1D(-1.0*unsignedDistance.value(),unsignedDistance.error());
19  return unsignedDistance;
20 }
T y() const
Cartesian y coordinate.
T x() const
Cartesian x coordinate.
T y() const
Definition: PV3DBase.h:57
double error() const
Definition: Measurement1D.h:30
virtual Measurement1D distance(const GlobalPoint &vtx1Position, const GlobalError &vtx1PositionError, const GlobalPoint &vtx2Position, const GlobalError &vtx2PositionError) const
double value() const
Definition: Measurement1D.h:28
T x() const
Definition: PV3DBase.h:56

Member Data Documentation

AlgebraicSymMatrix VertexDistanceXY::theNullMatrix
private

Definition at line 40 of file VertexDistanceXY.h.