test
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
VertexDistance3D Class Reference

#include <VertexDistance3D.h>

Inheritance diagram for VertexDistance3D:
VertexDistance

Public Member Functions

virtual VertexDistance3Dclone () const
 
virtual Measurement1D signedDistance (const reco::Vertex &primVtx, const reco::Vertex &secVtx, const GlobalVector &momentum) const
 
 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

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

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 18 of file VertexDistance3D.h.

Referenced by clone().

18 {}

Member Function Documentation

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

Implements VertexDistance.

Definition at line 32 of file VertexDistance3D.h.

References VertexDistance3D().

33  {
34  return new VertexDistance3D(*this);
35  }
float VertexDistance3D::compatibility ( const GlobalPoint vtx1Position,
const GlobalError vtx1PositionError,
const GlobalPoint vtx2Position,
const GlobalError vtx2PositionError 
) const
privatevirtual

Implements VertexDistance.

Definition at line 47 of file VertexDistance3D.cc.

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

51 {
52  // error matrix of residuals
53  AlgebraicSymMatrix33 err1 = vtx1PositionError.matrix();
54  AlgebraicSymMatrix33 err2 = vtx2PositionError.matrix();
55  AlgebraicSymMatrix33 error = err1 + err2;
56  if (error == theNullMatrix) return FLT_MAX;
57 
58  // position residuals
59  GlobalVector diff = vtx2Position - vtx1Position;
60  AlgebraicVector3 vDiff;
61  vDiff[0] = diff.x();
62  vDiff[1] = diff.y();
63  vDiff[2] = diff.z();
64 
65  // Invert error matrix of residuals
66  bool ifail = !error.InvertChol();
67  if (ifail) {
68  throw cms::Exception("VertexDistance3D::matrix inversion problem");
69  }
70 
71  return ROOT::Math::Similarity(error,vDiff);
72 }
AlgebraicSymMatrix33 theNullMatrix
const AlgebraicSymMatrix33 matrix() const
T y() const
Definition: PV3DBase.h:63
list diff
Definition: mps_update.py:85
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepSym< double, 3 > > AlgebraicSymMatrix33
T z() const
Definition: PV3DBase.h:64
ROOT::Math::SVector< double, 3 > AlgebraicVector3
T x() const
Definition: PV3DBase.h:62
Measurement1D VertexDistance3D::distance ( const GlobalPoint vtx1Position,
const GlobalError vtx1PositionError,
const GlobalPoint vtx2Position,
const GlobalError vtx2PositionError 
) const
privatevirtual

Implements VertexDistance.

Definition at line 22 of file VertexDistance3D.cc.

References mps_update::diff, 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 PF_PU_AssoMapAlgos::GetCleanedKshort(), PF_PU_AssoMapAlgos::GetCleanedLambda(), PF_PU_AssoMapAlgos::GetCleanedNI(), VertexMerging::mergeVertex(), TracksClusteringFromDisplacedSeed::nearTracks(), and IPProducer< Container, Base, Helper >::produce().

26 {
27  AlgebraicSymMatrix33 error = vtx1PositionError.matrix()
28  + vtx2PositionError.matrix();
29  GlobalVector diff = vtx1Position - vtx2Position;
30  AlgebraicVector3 vDiff;
31  vDiff[0] = diff.x();
32  vDiff[1] = diff.y();
33  vDiff[2] = diff.z();
34 
35  double dist=diff.mag();
36 
37  double err2 = ROOT::Math::Similarity(error,vDiff);
38  double err = 0.;
39  if (dist != 0) err = sqrt(err2)/dist;
40 
41  return Measurement1D(dist,err);
42 }
const AlgebraicSymMatrix33 matrix() const
T y() const
Definition: PV3DBase.h:63
list diff
Definition: mps_update.py:85
T mag() const
Definition: PV3DBase.h:67
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepSym< double, 3 > > AlgebraicSymMatrix33
T sqrt(T t)
Definition: SSEVec.h:18
T z() const
Definition: PV3DBase.h:64
ROOT::Math::SVector< double, 3 > AlgebraicVector3
T x() const
Definition: PV3DBase.h:62
Measurement1D VertexDistance3D::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 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 8 of file VertexDistance3D.cc.

References mps_update::diff, HLT_25ns10e33_v2_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().

10 {
11  Measurement1D unsignedDistance = distance(vtx1, vtx2);
12  Basic3DVector<float> diff = Basic3DVector<float> (vtx2.position()) -
13  Basic3DVector<float> (vtx1.position());
14 // Basic3DVector<float> (vtx2 - vtx1);
15  if ((momentum.x()*diff.x() + momentum.y()*diff.y() * momentum.z()*diff.z()) < 0 )
16  return Measurement1D(-1.0*unsignedDistance.value(),unsignedDistance.error());
17  return unsignedDistance;
18 }
virtual Measurement1D distance(const GlobalPoint &vtx1Position, const GlobalError &vtx1PositionError, const GlobalPoint &vtx2Position, const GlobalError &vtx2PositionError) const
T y() const
Cartesian y coordinate.
T x() const
Cartesian x coordinate.
T y() const
Definition: PV3DBase.h:63
double error() const
Definition: Measurement1D.h:30
list diff
Definition: mps_update.py:85
T z() const
Cartesian z coordinate.
T z() const
Definition: PV3DBase.h:64
double value() const
Definition: Measurement1D.h:28
T x() const
Definition: PV3DBase.h:62

Member Data Documentation

AlgebraicSymMatrix33 VertexDistance3D::theNullMatrix
private

Definition at line 41 of file VertexDistance3D.h.