CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
 
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 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

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

Definition at line 17 of file VertexDistance3D.h.

Referenced by clone().

17 {}

Member Function Documentation

VertexDistance3D* VertexDistance3D::clone ( void  ) const
inlineoverridevirtual

Implements VertexDistance.

Definition at line 31 of file VertexDistance3D.h.

References VertexDistance3D().

31 { return new VertexDistance3D(*this); }
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.

References change_name::diff, relativeConstraints::error, Exception, GlobalErrorBase< T, ErrorWeightType >::matrix(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

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 }
AlgebraicSymMatrix33 theNullMatrix
const AlgebraicSymMatrix33 matrix() const
T y() const
Definition: PV3DBase.h:60
T z() const
Definition: PV3DBase.h:61
ROOT::Math::SVector< double, 3 > AlgebraicVector3
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepSym< double, 3 > > AlgebraicSymMatrix33
T x() const
Definition: PV3DBase.h:59
Measurement1D VertexDistance3D::distance ( const GlobalPoint vtx1Position,
const GlobalError vtx1PositionError,
const GlobalPoint vtx2Position,
const GlobalError vtx2PositionError 
) const
overrideprivatevirtual

Implements VertexDistance.

Definition at line 17 of file VertexDistance3D.cc.

References change_name::diff, submitPVValidationJobs::err, relativeConstraints::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 DiMuonVertexValidation::analyze(), AlignmentTrackFromVertexSelector::findClosestVertex(), PF_PU_AssoMapAlgos::GetCleanedKshort(), PF_PU_AssoMapAlgos::GetCleanedLambda(), PF_PU_AssoMapAlgos::GetCleanedNI(), VertexMerging::mergeVertex(), TracksClusteringFromDisplacedSeed::nearTracks(), BJetEnergyRegressionVarProducer< T >::produce(), IPProducer< Container, Base, Helper >::produce(), and btagbtvdeep::vertexD3d().

20  {
21  AlgebraicSymMatrix33 error = vtx1PositionError.matrix() + vtx2PositionError.matrix();
22  GlobalVector diff = vtx1Position - vtx2Position;
23  AlgebraicVector3 vDiff;
24  vDiff[0] = diff.x();
25  vDiff[1] = diff.y();
26  vDiff[2] = diff.z();
27 
28  double dist = diff.mag();
29 
30  double err2 = ROOT::Math::Similarity(error, vDiff);
31  double err = 0.;
32  if (dist != 0)
33  err = sqrt(err2) / dist;
34 
35  return Measurement1D(dist, err);
36 }
const AlgebraicSymMatrix33 matrix() const
T y() const
Definition: PV3DBase.h:60
T mag() const
Definition: PV3DBase.h:64
T sqrt(T t)
Definition: SSEVec.h:19
T z() const
Definition: PV3DBase.h:61
ROOT::Math::SVector< double, 3 > AlgebraicVector3
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepSym< double, 3 > > AlgebraicSymMatrix33
T x() const
Definition: PV3DBase.h:59
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.

References change_name::diff, HLT_FULL_cff::distance, 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().

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 }
T y() const
Cartesian y coordinate.
T x() const
Cartesian x coordinate.
T y() const
Definition: PV3DBase.h:60
double error() const
Definition: Measurement1D.h:27
T z() const
Cartesian z coordinate.
T z() const
Definition: PV3DBase.h:61
Measurement1D distance(const GlobalPoint &vtx1Position, const GlobalError &vtx1PositionError, const GlobalPoint &vtx2Position, const GlobalError &vtx2PositionError) const override
double value() const
Definition: Measurement1D.h:25
T x() const
Definition: PV3DBase.h:59

Member Data Documentation

AlgebraicSymMatrix33 VertexDistance3D::theNullMatrix
private

Definition at line 36 of file VertexDistance3D.h.