CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TrackGhostTrackState.cc
Go to the documentation of this file.
1 #include <cmath>
2 
3 #include <Math/SMatrix.h>
4 #include <Math/MatrixFunctions.h>
5 
9 
15 
17 
19 
20 using namespace reco;
21 
22 namespace {
23  static inline double sqr(double arg) { return arg * arg; }
24 
25  using namespace ROOT::Math;
26 
27  typedef SVector<double, 3> Vector3;
28 
29  typedef SMatrix<double, 3, 3, MatRepSym<double, 3> > Matrix3S;
30  typedef SMatrix<double, 6, 6, MatRepSym<double, 6> > Matrix6S;
31  typedef SMatrix<double, 3, 3> Matrix33;
32  typedef SMatrix<double, 3, 6> Matrix36;
33 
34  static inline Vector3 conv(const GlobalVector &vec)
35  {
36  Vector3 result;
37  result[0] = vec.x();
38  result[1] = vec.y();
39  result[2] = vec.z();
40  return result;
41  }
42 }
43 
45  bool initial, double lambda)
46 {
48 
49  GlobalPoint origin = pred.origin();
50  GlobalVector direction = pred.direction();
51 
52  if (isValid() && !initial) {
53  GlobalPoint pca = origin + lambda_ * direction;
54  Line line(pca, direction);
55  tsos_ = extrap.extrapolate(tsos_, line);
56  } else {
57  GlobalPoint pca = origin + lambda * direction;
58  Line line(pca, direction);
59  tsos_ = extrap.extrapolate(track_.impactPointState(), line);
60  }
61 
62  if (!isValid())
63  return false;
64 
65  lambda_ = (tsos_.globalPosition() - origin) * direction / pred.rho2();
66 
67  return true;
68 }
69 
71  double lambda)
72 {
74 
75  GlobalPoint point = pred.position(lambda);
76 
77  tsos_ = extrap.extrapolate(track_.impactPointState(), point);
78  if (!isValid())
79  return false;
80 
81  lambda_ = lambda;
82 
83  return true;
84 }
85 
87  const GhostTrackPrediction &pred, bool withMeasurementError) const
88 {
89  using namespace ROOT::Math;
90 
91  if (!isValid())
92  return Vertex();
93 
94  GlobalPoint origin = pred.origin();
95  GlobalVector direction = pred.direction();
96 
97  double rho2 = pred.rho2();
98  double rho = std::sqrt(rho2);
99  double lambda = (tsos_.globalPosition() - origin) * direction / rho2;
100  GlobalPoint pos = origin + lambda * direction;
101 
102  GlobalVector momentum = tsos_.globalMomentum();
103  double mom = momentum.mag();
104 
105  Vector3 b = conv(direction) / rho;
106  Vector3 d = conv(momentum) / mom;
107  double l = Dot(b, d);
108  double g = 1. / (1. - sqr(l));
109 
110  Vector3 ca = conv(pos - tsos_.globalPosition());
111  Vector3 bd = b - l * d;
112  b *= g;
113 
114  Matrix33 pA = TensorProd(b, bd);
115  Matrix33 pB = TensorProd(b, ca);
116 
117  Matrix36 jacobian;
118  jacobian.Place_at(-pA + Matrix33(SMatrixIdentity()), 0, 0);
119  jacobian.Place_at(pB / rho, 0, 3);
120  Matrix3S error = Similarity(jacobian, pred.cartesianError(lambda));
121 
122  if (withMeasurementError) {
123  jacobian.Place_at(pA, 0, 0);
124  jacobian.Place_at(-pB / mom, 0, 3);
125  error += Similarity(jacobian, tsos_.cartesianError().matrix());
126  }
127 
128  return Vertex(pos, error);
129 }
130 
132  const GhostTrackPrediction &pred, bool withGhostTrackError) const
133 {
134  using namespace ROOT::Math;
135 
136  if (!isValid())
137  return Vertex();
138 
139  GlobalPoint origin = pred.origin();
140  GlobalVector direction = pred.direction();
141 
142  double rho2 = pred.rho2();
143  double rho = std::sqrt(rho2);
144  double lambda = (tsos_.globalPosition() - origin) * direction / rho2;
145  GlobalPoint pos = origin + lambda * direction;
146 
147  GlobalVector momentum = tsos_.globalMomentum();
148  double mom = momentum.mag();
149 
150  Vector3 b = conv(direction) / rho;
151  Vector3 d = conv(momentum) / mom;
152  double l = Dot(b, d);
153  double g = 1. / (1. - sqr(l));
154 
155  Vector3 ca = conv(tsos_.globalPosition() - pos);
156  Vector3 bd = l * b - d;
157  d *= g;
158 
159  Matrix33 pC = TensorProd(d, bd);
160  Matrix33 pD = TensorProd(d, ca);
161 
162  Matrix36 jacobian;
163  jacobian.Place_at(pC + Matrix33(SMatrixIdentity()), 0, 0);
164  jacobian.Place_at(pD / mom, 0, 3);
165  Matrix3S error = Similarity(jacobian, tsos_.cartesianError().matrix());
166 
167  if (withGhostTrackError) {
168  jacobian.Place_at(-pC, 0, 0);
169  jacobian.Place_at(-pD / rho, 0, 3);
170  error += Similarity(jacobian, pred.cartesianError(lambda));
171  }
172 
173  return Vertex(tsos_.globalPosition(), error);
174 }
Vertex vertexStateOnGhostTrack(const GhostTrackPrediction &pred, bool withMeasurementError) const
std::pair< GlobalPoint, GlobalError > Vertex
TrajectoryStateOnSurface tsos_
const GlobalPoint origin() const
Definition: Line.h:10
static HepMC::IO_HEPEVT conv
Definition: DDAxes.h:10
const CartesianTrajectoryError cartesianError() const
T y() const
Definition: PV3DBase.h:63
GlobalPoint globalPosition() const
const MagneticField * field() const
A arg
Definition: Factorize.h:36
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
bool linearize(const GhostTrackPrediction &pred, bool initial, double lambda)
T mag() const
Definition: PV3DBase.h:67
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
const AlgebraicSymMatrix66 & matrix() 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
GlobalVector globalMomentum() const
Square< F >::type sqr(const F &f)
Definition: Square.h:13
GlobalPoint position(double lambda=0.) const
Vertex vertexStateOnMeasurement(const GhostTrackPrediction &pred, bool withGhostTrackError) const
TrajectoryStateOnSurface impactPointState() const
T x() const
Definition: PV3DBase.h:62
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
const GlobalVector direction() const