CMS 3D CMS Logo

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

VertexDistanceXYclone () const override
 
virtual float compatibility (const reco::Vertex &, const reco::Vertex &) const
 
virtual float compatibility (const GlobalPoint &vtx1Position, const GlobalError &vtx1PositionError, const GlobalPoint &vtx2Position, const GlobalError &vtx2PositionError) const=0
 
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 VertexState &) const
 
virtual Measurement1D distance (const GlobalPoint &vtx1Position, const GlobalError &vtx1PositionError, const GlobalPoint &vtx2Position, const GlobalError &vtx2PositionError) const=0
 
Measurement1D distance (const VertexState &, const reco::Vertex &) const
 
Measurement1D distance (const VertexState &, const VertexState &) const
 
Measurement1D distance (const reco::Vertex &, const reco::Vertex &) const
 
Measurement1D signedDistance (const reco::Vertex &primVtx, const reco::Vertex &secVtx, const GlobalVector &momentum) const override
 
 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

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

AlgebraicSymMatrix22 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::VertexDistanceXY ( )
inline

Definition at line 13 of file VertexDistanceXY.h.

Referenced by clone().

13 {}

Member Function Documentation

◆ clone()

VertexDistanceXY* VertexDistanceXY::clone ( void  ) const
inlineoverridevirtual

Implements VertexDistance.

Definition at line 27 of file VertexDistanceXY.h.

References VertexDistanceXY().

27 { return new VertexDistanceXY(*this); }

◆ compatibility() [1/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 }
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
GlobalErrorBase< double, ErrorMatrixTag > GlobalError
Definition: GlobalError.h:13
float compatibility(const GlobalPoint &vtx1Position, const GlobalError &vtx1PositionError, const GlobalPoint &vtx2Position, const GlobalError &vtx2PositionError) const override

◆ compatibility() [2/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 }
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
GlobalErrorBase< double, ErrorMatrixTag > GlobalError
Definition: GlobalError.h:13
float compatibility(const GlobalPoint &vtx1Position, const GlobalError &vtx1PositionError, const GlobalPoint &vtx2Position, const GlobalError &vtx2PositionError) const override

◆ compatibility() [3/6]

virtual float VertexDistance::compatibility

◆ compatibility() [4/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 }
float compatibility(const GlobalPoint &vtx1Position, const GlobalError &vtx1PositionError, const GlobalPoint &vtx2Position, const GlobalError &vtx2PositionError) const override

◆ compatibility() [5/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 }
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
GlobalErrorBase< double, ErrorMatrixTag > GlobalError
Definition: GlobalError.h:13
float compatibility(const GlobalPoint &vtx1Position, const GlobalError &vtx1PositionError, const GlobalPoint &vtx2Position, const GlobalError &vtx2PositionError) const override

◆ compatibility() [6/6]

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

Implements VertexDistance.

Definition at line 40 of file VertexDistanceXY.cc.

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

Referenced by DiMuonVertexMonitor::analyze(), and DiMuonVertexValidation::analyze().

43  {
44  // error matrix of residuals
45  AlgebraicSymMatrix33 err1 = vtx1PositionError.matrix();
46  AlgebraicSymMatrix33 err2 = vtx2PositionError.matrix();
48  error[0][0] = err1[0][0] + err2[0][0];
49  error[0][1] = err1[0][1] + err2[0][1];
50  error[1][1] = err1[1][1] + err2[1][1];
51  if (error == theNullMatrix)
52  return FLT_MAX;
53 
54  // position residuals
55  GlobalVector diff = vtx2Position - vtx1Position;
56  AlgebraicVector2 vDiff;
57  vDiff[0] = diff.x();
58  vDiff[1] = diff.y();
59 
60  // Invert error matrix of residuals
61  bool ifail = !error.Invert();
62  if (ifail) {
63  throw cms::Exception("VertexDistanceXY::matrix inversion problem");
64  }
65 
66  return ROOT::Math::Similarity(error, vDiff);
67 }
ROOT::Math::SVector< double, 2 > AlgebraicVector2
const AlgebraicSymMatrix33 matrix() const
ROOT::Math::SMatrix< double, 2, 2, ROOT::Math::MatRepSym< double, 2 > > AlgebraicSymMatrix22
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepSym< double, 3 > > AlgebraicSymMatrix33
AlgebraicSymMatrix22 theNullMatrix

◆ distance() [1/6]

virtual Measurement1D VertexDistance::distance

◆ distance() [2/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 }
Measurement1D distance(const GlobalPoint &vtx1Position, const GlobalError &vtx1PositionError, const GlobalPoint &vtx2Position, const GlobalError &vtx2PositionError) const override

◆ distance() [3/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 }
Measurement1D distance(const GlobalPoint &vtx1Position, const GlobalError &vtx1PositionError, const GlobalPoint &vtx2Position, const GlobalError &vtx2PositionError) const override
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
GlobalErrorBase< double, ErrorMatrixTag > GlobalError
Definition: GlobalError.h:13

◆ distance() [4/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 }
Measurement1D distance(const GlobalPoint &vtx1Position, const GlobalError &vtx1PositionError, const GlobalPoint &vtx2Position, const GlobalError &vtx2PositionError) const override
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
GlobalErrorBase< double, ErrorMatrixTag > GlobalError
Definition: GlobalError.h:13

◆ distance() [5/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 }
Measurement1D distance(const GlobalPoint &vtx1Position, const GlobalError &vtx1PositionError, const GlobalPoint &vtx2Position, const GlobalError &vtx2PositionError) const override
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
GlobalErrorBase< double, ErrorMatrixTag > GlobalError
Definition: GlobalError.h:13

◆ distance() [6/6]

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

Implements VertexDistance.

Definition at line 19 of file VertexDistanceXY.cc.

References change_name::diff, submitPVResolutionJobs::err, relativeConstraints::error, GlobalErrorBase< T, ErrorWeightType >::matrix(), funct::pow(), and mathSSE::sqrt().

Referenced by DiMuonVertexMonitor::analyze(), DiMuonVertexValidation::analyze(), DiElectronVertexValidation::analyze(), VertexAnalysis::dist2D(), DiMuonMassBiasMonitor::fillDecayHistograms(), HeavyFlavorDQMAnalyzer::fillDecayHistograms(), Onia2MuMuPAT::produce(), VertexTableProducer::produce(), TemplatedInclusiveVertexFinder< InputContainer, VTX >::produce(), and btagbtvdeep::vertexDxy().

22  {
23  AlgebraicSymMatrix33 error = vtx1PositionError.matrix() + vtx2PositionError.matrix();
24  GlobalVector diff = vtx1Position - vtx2Position;
25  AlgebraicVector3 vDiff;
26  vDiff[0] = diff.x();
27  vDiff[1] = diff.y();
28  vDiff[2] = 0.;
29 
30  double dist = sqrt(pow(diff.x(), 2) + pow(diff.y(), 2));
31 
32  double err2 = ROOT::Math::Similarity(error, vDiff);
33  double err = 0;
34  if (dist != 0)
35  err = sqrt(err2) / dist;
36 
37  return Measurement1D(dist, err);
38 }
T sqrt(T t)
Definition: SSEVec.h:19
const AlgebraicSymMatrix33 matrix() const
ROOT::Math::SVector< double, 3 > AlgebraicVector3
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepSym< double, 3 > > AlgebraicSymMatrix33
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ signedDistance()

Measurement1D VertexDistanceXY::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 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 9 of file VertexDistanceXY.cc.

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

11  {
12  Measurement1D unsignedDistance = distance(vtx1, vtx2);
13  Basic3DVector<float> diff = Basic3DVector<float>(vtx2.position()) - Basic3DVector<float>(vtx1.position());
14  if ((momentum.x() * diff.x() + momentum.y() * diff.y()) < 0)
15  return Measurement1D(-1.0 * unsignedDistance.value(), unsignedDistance.error());
16  return unsignedDistance;
17 }
Measurement1D distance(const GlobalPoint &vtx1Position, const GlobalError &vtx1PositionError, const GlobalPoint &vtx2Position, const GlobalError &vtx2PositionError) const override
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
double value() const
Definition: Measurement1D.h:25
double error() const
Definition: Measurement1D.h:27

Member Data Documentation

◆ theNullMatrix

AlgebraicSymMatrix22 VertexDistanceXY::theNullMatrix
private

Definition at line 33 of file VertexDistanceXY.h.