CMS 3D CMS Logo

VertexDistanceXY.cc
Go to the documentation of this file.
5 #include <cfloat>
6 
7 using namespace reco;
8 
10  const Vertex& vtx2,
11  const GlobalVector& momentum) const {
12  Measurement1D unsignedDistance = distance(vtx1, vtx2);
14  if ((momentum.x() * diff.x() + momentum.y() * diff.y()) < 0)
15  return Measurement1D(-1.0 * unsignedDistance.value(), unsignedDistance.error());
16  return unsignedDistance;
17 }
18 
20  const GlobalError& vtx1PositionError,
21  const GlobalPoint& vtx2Position,
22  const GlobalError& vtx2PositionError) const {
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 }
39 
40 float VertexDistanceXY::compatibility(const GlobalPoint& vtx1Position,
41  const GlobalError& vtx1PositionError,
42  const GlobalPoint& vtx2Position,
43  const GlobalError& vtx2PositionError) const {
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 }
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
VertexDistanceXY::signedDistance
Measurement1D signedDistance(const reco::Vertex &primVtx, const reco::Vertex &secVtx, const GlobalVector &momentum) const override
Definition: VertexDistanceXY.cc:9
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
Measurement1D::value
double value() const
Definition: Measurement1D.h:25
VertexDistanceXY::compatibility
float compatibility(const GlobalPoint &vtx1Position, const GlobalError &vtx1PositionError, const GlobalPoint &vtx2Position, const GlobalError &vtx2PositionError) const override
Definition: VertexDistanceXY.cc:40
reco::Vertex::position
const Point & position() const
position
Definition: Vertex.h:114
GlobalErrorBase::matrix
const AlgebraicSymMatrix33 matrix() const
Definition: GlobalErrorBase.h:121
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
relativeConstraints.error
error
Definition: relativeConstraints.py:53
VertexDistanceXY.h
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
VertexState.h
Point3DBase< float, GlobalTag >
Measurement1D::error
double error() const
Definition: Measurement1D.h:27
AlgebraicVector2
ROOT::Math::SVector< double, 2 > AlgebraicVector2
Definition: AlgebraicROOTObjects.h:11
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
GlobalErrorBase< double, ErrorMatrixTag >
submitPVResolutionJobs.err
err
Definition: submitPVResolutionJobs.py:85
VertexDistanceXY::distance
Measurement1D distance(const GlobalPoint &vtx1Position, const GlobalError &vtx1PositionError, const GlobalPoint &vtx2Position, const GlobalError &vtx2PositionError) const override
Definition: VertexDistanceXY.cc:19
Exception
Definition: hltDiff.cc:245
GlobalVector.h
Exception.h
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
HLT_FULL_cff.distance
distance
Definition: HLT_FULL_cff.py:7733
Basic3DVector< float >
AlgebraicSymMatrix22
ROOT::Math::SMatrix< double, 2, 2, ROOT::Math::MatRepSym< double, 2 > > AlgebraicSymMatrix22
Definition: AlgebraicROOTObjects.h:20
reco::Vertex
Definition: Vertex.h:35