CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
VertexDistance3D Class Reference

#include <VertexDistance3D.h>

Inheritance diagram for VertexDistance3D:
VertexDistance

Public Member Functions

VertexDistance3Dclone () const override
 
virtual float compatibility (const GlobalPoint &vtx1Position, const GlobalError &vtx1PositionError, const GlobalPoint &vtx2Position, const GlobalError &vtx2PositionError) const=0
 
virtual float compatibility (const reco::Vertex &, const reco::Vertex &) const
 
virtual float compatibility (const reco::Vertex &, const VertexState &) const
 
virtual float compatibility (const VertexState &, const reco::Vertex &) const
 
virtual float compatibility (const VertexState &, const VertexState &) const
 
virtual Measurement1D distance (const GlobalPoint &vtx1Position, const GlobalError &vtx1PositionError, const GlobalPoint &vtx2Position, const GlobalError &vtx2PositionError) const=0
 
Measurement1D distance (const reco::Vertex &, const reco::Vertex &) const
 
Measurement1D distance (const reco::Vertex &, const VertexState &) const
 
Measurement1D distance (const VertexState &, const reco::Vertex &) const
 
Measurement1D distance (const VertexState &, const VertexState &) const
 
Measurement1D signedDistance (const reco::Vertex &primVtx, const reco::Vertex &secVtx, const GlobalVector &momentum) const override
 
 VertexDistance3D ()
 
- Public Member Functions inherited from VertexDistance
virtual float compatibility (const reco::Vertex &, const reco::Vertex &) const
 
virtual float compatibility (const reco::Vertex &, const VertexState &) const
 
virtual float compatibility (const VertexState &, const reco::Vertex &) const
 
virtual float compatibility (const VertexState &, const VertexState &) const
 
Measurement1D distance (const reco::Vertex &, const reco::Vertex &) const
 
Measurement1D distance (const reco::Vertex &, const VertexState &) const
 
Measurement1D distance (const VertexState &, const reco::Vertex &) const
 
Measurement1D distance (const VertexState &, const VertexState &) const
 
virtual ~VertexDistance ()
 

Private Member Functions

float compatibility (const GlobalPoint &vtx1Position, const GlobalError &vtx1PositionError, const GlobalPoint &vtx2Position, const GlobalError &vtx2PositionError) const override
 
Measurement1D distance (const GlobalPoint &vtx1Position, const GlobalError &vtx1PositionError, const GlobalPoint &vtx2Position, const GlobalError &vtx2PositionError) const override
 

Private Attributes

AlgebraicSymMatrix33 theNullMatrix
 

Additional Inherited Members

Detailed Description

Computes the distance and chi-squared compatibility between two vertices with their 3D positions.

Definition at line 13 of file VertexDistance3D.h.

Constructor & Destructor Documentation

◆ VertexDistance3D()

VertexDistance3D::VertexDistance3D ( )
inline

Definition at line 17 of file VertexDistance3D.h.

17 {}

Referenced by clone().

Member Function Documentation

◆ clone()

VertexDistance3D* VertexDistance3D::clone ( void  ) const
inlineoverridevirtual

Implements VertexDistance.

Definition at line 31 of file VertexDistance3D.h.

31 { return new VertexDistance3D(*this); }

References VertexDistance3D().

◆ compatibility() [1/6]

float VertexDistance3D::compatibility ( const GlobalPoint vtx1Position,
const GlobalError vtx1PositionError,
const GlobalPoint vtx2Position,
const GlobalError vtx2PositionError 
) const
overrideprivatevirtual

Implements VertexDistance.

Definition at line 38 of file VertexDistance3D.cc.

41  {
42  // error matrix of residuals
43  AlgebraicSymMatrix33 err1 = vtx1PositionError.matrix();
44  AlgebraicSymMatrix33 err2 = vtx2PositionError.matrix();
45  AlgebraicSymMatrix33 error = err1 + err2;
46  if (error == theNullMatrix)
47  return FLT_MAX;
48 
49  // position residuals
50  GlobalVector diff = vtx2Position - vtx1Position;
51  AlgebraicVector3 vDiff;
52  vDiff[0] = diff.x();
53  vDiff[1] = diff.y();
54  vDiff[2] = diff.z();
55 
56  // Invert error matrix of residuals
57  bool ifail = !error.InvertChol();
58  if (ifail) {
59  throw cms::Exception("VertexDistance3D::matrix inversion problem");
60  }
61 
62  return ROOT::Math::Similarity(error, vDiff);
63 }

References change_name::diff, relativeConstraints::error, Exception, and GlobalErrorBase< T, ErrorWeightType >::matrix().

◆ compatibility() [2/6]

virtual float VertexDistance::compatibility

◆ compatibility() [3/6]

float VertexDistance::compatibility

Definition at line 51 of file VertexDistance.cc.

51  {
52  return compatibility(GlobalPoint(Basic3DVector<float>(vtx1.position())),
53  GlobalError(vtx1.covariance()),
54  GlobalPoint(Basic3DVector<float>(vtx2.position())),
55  GlobalError(vtx2.covariance()));
56 }

◆ compatibility() [4/6]

float VertexDistance::compatibility

Definition at line 37 of file VertexDistance.cc.

37  {
38  return compatibility(GlobalPoint(Basic3DVector<float>(vtx1.position())),
39  GlobalError(vtx1.covariance()),
40  vtx2.position(),
41  vtx2.error());
42 }

◆ compatibility() [5/6]

float VertexDistance::compatibility

Definition at line 44 of file VertexDistance.cc.

44  {
45  return compatibility(vtx1.position(),
46  vtx1.error(),
47  GlobalPoint(Basic3DVector<float>(vtx2.position())),
48  GlobalError(vtx2.covariance()));
49 }

◆ compatibility() [6/6]

float VertexDistance::compatibility

Definition at line 33 of file VertexDistance.cc.

33  {
34  return compatibility(vtx1.position(), vtx1.error(), vtx2.position(), vtx2.error());
35 }

◆ distance() [1/6]

Measurement1D VertexDistance3D::distance ( const GlobalPoint vtx1Position,
const GlobalError vtx1PositionError,
const GlobalPoint vtx2Position,
const GlobalError vtx2PositionError 
) const
overrideprivatevirtual

◆ distance() [2/6]

virtual Measurement1D VertexDistance::distance

◆ distance() [3/6]

Measurement1D VertexDistance::distance

Definition at line 26 of file VertexDistance.cc.

26  {
27  return distance(GlobalPoint(Basic3DVector<float>(vtx1.position())),
28  GlobalError(vtx1.covariance()),
29  GlobalPoint(Basic3DVector<float>(vtx2.position())),
30  GlobalError(vtx2.covariance()));
31 }

◆ distance() [4/6]

Measurement1D VertexDistance::distance

Definition at line 12 of file VertexDistance.cc.

12  {
13  return distance(GlobalPoint(Basic3DVector<float>(vtx1.position())),
14  GlobalError(vtx1.covariance()),
15  vtx2.position(),
16  vtx2.error());
17 }

◆ distance() [5/6]

Measurement1D VertexDistance::distance

Definition at line 19 of file VertexDistance.cc.

19  {
20  return distance(vtx1.position(),
21  vtx1.error(),
22  GlobalPoint(Basic3DVector<float>(vtx2.position())),
23  GlobalError(vtx2.covariance()));
24 }

◆ distance() [6/6]

Measurement1D VertexDistance::distance

Definition at line 8 of file VertexDistance.cc.

8  {
9  return distance(vtx1.position(), vtx1.error(), vtx2.position(), vtx2.error());
10 }

◆ signedDistance()

Measurement1D VertexDistance3D::signedDistance ( const reco::Vertex primVtx,
const reco::Vertex secVtx,
const GlobalVector momentum 
) const
overridevirtual

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 6 of file VertexDistance3D.cc.

8  {
9  Measurement1D unsignedDistance = distance(vtx1, vtx2);
10  Basic3DVector<float> diff = Basic3DVector<float>(vtx2.position()) - Basic3DVector<float>(vtx1.position());
11  // Basic3DVector<float> (vtx2 - vtx1);
12  if ((momentum.x() * diff.x() + momentum.y() * diff.y() * momentum.z() * diff.z()) < 0)
13  return Measurement1D(-1.0 * unsignedDistance.value(), unsignedDistance.error());
14  return unsignedDistance;
15 }

References change_name::diff, HLT_FULL_cff::distance, Measurement1D::error(), reco::Vertex::position(), Measurement1D::value(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Member Data Documentation

◆ theNullMatrix

AlgebraicSymMatrix33 VertexDistance3D::theNullMatrix
private

Definition at line 36 of file VertexDistance3D.h.

Vector3DBase
Definition: Vector3DBase.h:8
change_name.diff
diff
Definition: change_name.py:13
AlgebraicVector3
ROOT::Math::SVector< double, 3 > AlgebraicVector3
Definition: AlgebraicROOTObjects.h:12
Measurement1D
Definition: Measurement1D.h:11
AlgebraicSymMatrix33
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepSym< double, 3 > > AlgebraicSymMatrix33
Definition: AlgebraicROOTObjects.h:21
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
Measurement1D::value
double value() const
Definition: Measurement1D.h:25
VertexDistance3D::distance
Measurement1D distance(const GlobalPoint &vtx1Position, const GlobalError &vtx1PositionError, const GlobalPoint &vtx2Position, const GlobalError &vtx2PositionError) const override
Definition: VertexDistance3D.cc:17
GlobalErrorBase::matrix
const AlgebraicSymMatrix33 matrix() const
Definition: GlobalErrorBase.h:121
relativeConstraints.error
error
Definition: relativeConstraints.py:53
VertexDistance3D::compatibility
float compatibility(const GlobalPoint &vtx1Position, const GlobalError &vtx1PositionError, const GlobalPoint &vtx2Position, const GlobalError &vtx2PositionError) const override
Definition: VertexDistance3D.cc:38
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
GlobalError
GlobalErrorBase< double, ErrorMatrixTag > GlobalError
Definition: GlobalError.h:13
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
VertexDistance3D::VertexDistance3D
VertexDistance3D()
Definition: VertexDistance3D.h:17
GlobalPoint
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
VertexDistance3D::theNullMatrix
AlgebraicSymMatrix33 theNullMatrix
Definition: VertexDistance3D.h:36
Measurement1D::error
double error() const
Definition: Measurement1D.h:27
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
submitPVResolutionJobs.err
err
Definition: submitPVResolutionJobs.py:85
Exception
Definition: hltDiff.cc:246
Basic3DVector< float >