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  static inline double sqr(double arg) { return arg * arg; }
17 
18  using namespace ROOT::Math;
19 
20  typedef SVector<double, 3> Vector3;
21 
22  typedef SMatrix<double, 3, 3, MatRepSym<double, 3> > Matrix3S;
23  typedef SMatrix<double, 6, 6, MatRepSym<double, 6> > Matrix6S;
24  typedef SMatrix<double, 3, 3> Matrix33;
25  typedef SMatrix<double, 3, 6> Matrix36;
26 
27  static inline Vector3 conv(const GlobalVector &vec)
28  {
29  Vector3 result;
30  result[0] = vec.x();
31  result[1] = vec.y();
32  result[2] = vec.z();
33  return result;
34  }
35 }
36 
38  const GhostTrackPrediction &pred, bool withMeasurementError) const
39 {
40  using namespace ROOT::Math;
41 
42  GlobalPoint origin = pred.origin();
43  GlobalVector direction = pred.direction();
44 
45  double rho2 = pred.rho2();
46  double rho = std::sqrt(rho2);
47  double lambda = (position_ - origin) * direction / rho2;
48  GlobalPoint pos = origin + lambda * direction;
49 
50  Vector3 b = conv(direction) / rho;
51  Vector3 ca = conv(position_ - pos);
52 
53  Matrix33 pA = TensorProd(b, b);
54  Matrix33 pB = TensorProd(b, ca);
55 
56  Matrix36 jacobian;
57  jacobian.Place_at(-pA + Matrix33(SMatrixIdentity()), 0, 0);
58  jacobian.Place_at(pB / rho, 0, 3);
59  Matrix3S error = Similarity(jacobian, pred.cartesianError(lambda));
60 
61  if (withMeasurementError)
62  error += Similarity(pA, covariance_);
63 
64  return Vertex(pos, error);
65 }
66 
68  const GhostTrackPrediction &pred, bool withGhostTrackError) const
69 {
70  return Vertex(position_, covariance_);
71 }
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:28
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:18
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