CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
VertexGhostTrackState.cc
Go to the documentation of this file.
1 #include <cmath>
2 
3 #include <Math/SMatrix.h>
4 #include <Math/MatrixFunctions.h>
5 
8 
10 
12 
13 using namespace reco;
14 
15 namespace {
16 #ifndef __clang__
17  static inline double sqr(double arg) { return arg * arg; }
18 #endif
19  using namespace ROOT::Math;
20 
21  typedef SVector<double, 3> Vector3;
22 
23  typedef SMatrix<double, 3, 3, MatRepSym<double, 3> > Matrix3S;
24  typedef SMatrix<double, 6, 6, MatRepSym<double, 6> > Matrix6S;
25  typedef SMatrix<double, 3, 3> Matrix33;
26  typedef SMatrix<double, 3, 6> Matrix36;
27 
28  static inline Vector3 conv(const GlobalVector &vec)
29  {
30  Vector3 result;
31  result[0] = vec.x();
32  result[1] = vec.y();
33  result[2] = vec.z();
34  return result;
35  }
36 }
37 
39  const GhostTrackPrediction &pred, bool withMeasurementError) const
40 {
41  using namespace ROOT::Math;
42 
43  GlobalPoint origin = pred.origin();
44  GlobalVector direction = pred.direction();
45 
46  double rho2 = pred.rho2();
47  double rho = std::sqrt(rho2);
48  double lambda = (position_ - origin) * direction / rho2;
49  GlobalPoint pos = origin + lambda * direction;
50 
51  Vector3 b = conv(direction) / rho;
52  Vector3 ca = conv(position_ - pos);
53 
54  Matrix33 pA = TensorProd(b, b);
55  Matrix33 pB = TensorProd(b, ca);
56 
57  Matrix36 jacobian;
58  jacobian.Place_at(-pA + Matrix33(SMatrixIdentity()), 0, 0);
59  jacobian.Place_at(pB / rho, 0, 3);
60  Matrix3S error = Similarity(jacobian, pred.cartesianError(lambda));
61 
62  if (withMeasurementError)
63  error += Similarity(pA, covariance_);
64 
65  return Vertex(pos, error);
66 }
67 
69  const GhostTrackPrediction &pred, bool withGhostTrackError) const
70 {
71  return Vertex(position_, covariance_);
72 }
std::pair< GlobalPoint, GlobalError > Vertex
const GlobalPoint origin() const
static HepMC::IO_HEPEVT conv
Definition: DDAxes.h:10
T y() const
Definition: PV3DBase.h:63
Vertex vertexStateOnMeasurement(const GhostTrackPrediction &pred, bool withGhostTrackError) const
A arg
Definition: Factorize.h:36
T sqrt(T t)
Definition: SSEVec.h:48
T z() const
Definition: PV3DBase.h:64
tuple result
Definition: query.py:137
CartesianError cartesianError(double lambda=0.) const
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< float >, ROOT::Math::GlobalCoordinateSystemTag > GlobalVector
vector in glovbal coordinate system
Definition: Vector3D.h:27
double b
Definition: hdecay.h:120
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< float >, ROOT::Math::GlobalCoordinateSystemTag > GlobalPoint
point in global coordinate system
Definition: Point3D.h:17
Vertex vertexStateOnGhostTrack(const GhostTrackPrediction &pred, bool withMeasurementError) const
Square< F >::type sqr(const F &f)
Definition: Square.h:13
T x() const
Definition: PV3DBase.h:62
const GlobalVector direction() const