test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DistanceOfVertices.h
Go to the documentation of this file.
1 #ifndef DISTANCEOFVERTICES_H
2 #define DISTANCEOFVERTICES_H
3 
5 
7 #include "CLHEP/Vector/ThreeVector.h"
8 
9 // class to compute distance, error, significance of 2 Vertices
10 // This is the ABC
11 
13 
14 public:
15 
17  virtual ~DistanceOfVertices () {}
18 
19  virtual Measurement1D distance ( const TransientVertex & , const TransientVertex & ) = 0 ;
20  virtual Measurement1D signedDistance ( const TransientVertex & , const TransientVertex & , const CLHEP::Hep3Vector & ) = 0 ;
21 
22 
23 protected:
24 
25  CLHEP::Hep3Vector deltaV2V1 ( const TransientVertex & v1 , const TransientVertex & v2 ) {
26  return CLHEP::Hep3Vector ( v2.position().x() - v1.position().x() ,
27  v2.position().y() - v1.position().y() ,
28  v2.position().z() - v1.position().z() ) ;
29  }
30 
31 
32  double terms2D ( const TransientVertex & v1 , const TransientVertex & v2 ) {
33  // better to have meaningful variables ...
34  double deltaX = deltaV2V1(v1,v2).x() ;
35  double deltaY = deltaV2V1(v1,v2).y() ;
36 
37  // covariance matrix of the diff. = sum of ind. cov. matr.
38  GlobalError covDelta = v1.positionError() + v2.positionError() ;
39 
40  double covDeltaXX = covDelta.cxx() ;
41  double covDeltaYY = covDelta.cyy() ;
42  double covDeltaXY = covDelta.cyx() ;
43 
44  return ( deltaX*deltaX * covDeltaXX +
45  deltaY*deltaY * covDeltaYY +
46  2*deltaX*deltaY * covDeltaXY ) ;
47  }
48 
49 
50  double terms3D ( const TransientVertex & v1 , const TransientVertex & v2 ) {
51  //
52  double deltaX = deltaV2V1(v1,v2).x() ;
53  double deltaY = deltaV2V1(v1,v2).y() ;
54  double deltaZ = deltaV2V1(v1,v2).z() ;
55 
56  // covariance matrix of the diff. = sum of ind. cov. matr.
57  GlobalError covDelta = v1.positionError() + v2.positionError() ;
58 
59  double covDeltaZZ = covDelta.czz() ;
60  double covDeltaXZ = covDelta.czx() ;
61  double covDeltaYZ = covDelta.czy() ;
62 
63 
64  return ( terms2D ( v1 , v2 ) +
65  deltaZ*deltaZ * covDeltaZZ +
66  2*deltaX*deltaZ * covDeltaXZ +
67  2*deltaY*deltaZ * covDeltaYZ ) ;
68  }
69 
70 };
71 #endif
72 
GlobalError positionError() const
double terms2D(const TransientVertex &v1, const TransientVertex &v2)
CLHEP::Hep3Vector deltaV2V1(const TransientVertex &v1, const TransientVertex &v2)
T y() const
Definition: PV3DBase.h:63
virtual Measurement1D distance(const TransientVertex &, const TransientVertex &)=0
GlobalPoint position() const
T z() const
Definition: PV3DBase.h:64
double terms3D(const TransientVertex &v1, const TransientVertex &v2)
virtual Measurement1D signedDistance(const TransientVertex &, const TransientVertex &, const CLHEP::Hep3Vector &)=0
T x() const
Definition: PV3DBase.h:62