CMS 3D CMS Logo

StraightLinePropagator.cc
Go to the documentation of this file.
2 
7 
8 std::pair<TrajectoryStateOnSurface, double> StraightLinePropagator::propagateWithPath(const FreeTrajectoryState& fts,
9  const Plane& plane) const {
10  // propagate parameters
11  LocalPoint x;
12  LocalVector p;
13  double s = 0;
14  bool parametersOK = propagateParametersOnPlane(fts, plane, x, p, s);
15  if (!parametersOK)
16  return std::make_pair(TrajectoryStateOnSurface(), 0.);
17 
18  // compute propagated state
19  if (fts.hasError()) {
20  return std::make_pair(propagatedState(fts, plane, jacobian(s), x, p), s);
21  } else {
22  // return state without errors
23  return std::make_pair(TSOS(LocalTrajectoryParameters(x, p, fts.charge()), plane, theField), s);
24  }
25 }
26 
27 std::pair<TrajectoryStateOnSurface, double> StraightLinePropagator::propagateWithPath(const FreeTrajectoryState& fts,
28  const Cylinder& cylinder) const {
29  // propagate parameters
30  GlobalPoint x;
32  double s = 0;
33  bool parametersOK = propagateParametersOnCylinder(fts, cylinder, x, p, s);
34  if (!parametersOK)
35  return std::make_pair(TrajectoryStateOnSurface(), 0.);
36 
37  // compute propagated state
38  if (fts.hasError()) {
39  return std::make_pair(propagatedState(fts, cylinder, jacobian(s), x, p), s);
40  } else {
41  // return state without errors
42  return std::make_pair(TSOS(GlobalTrajectoryParameters(x, p, fts.charge(), theField), cylinder), s);
43  }
44 }
45 
47  const Surface& surface,
48  const AlgebraicMatrix55& jacobian,
49  const LocalPoint& x,
50  const LocalVector& p) const {
51  if (fts.hasError()) {
52  // propagate error
53  TSOS tmp(fts, surface);
54  const AlgebraicSymMatrix55& eLocal = tmp.localError().matrix();
55  AlgebraicSymMatrix55 lte = ROOT::Math::Similarity(jacobian, eLocal);
56  LocalTrajectoryError eloc(lte);
57  LocalTrajectoryParameters ltp(x, p, fts.charge());
58  return TSOS(ltp, eloc, surface, theField);
59  } else {
60  // return state without errors
61  return TSOS(LocalTrajectoryParameters(x, p, fts.charge()), surface, theField);
62  }
63 }
64 
66  const Surface& surface,
67  const AlgebraicMatrix55& jacobian,
68  const GlobalPoint& x,
69  const GlobalVector& p) const {
70  if (fts.hasError()) {
71  // propagate error
72  TSOS tmp(fts, surface);
73  const AlgebraicSymMatrix55& eLocal = tmp.localError().matrix();
74  AlgebraicSymMatrix55 lte = ROOT::Math::Similarity(jacobian, eLocal);
75  LocalTrajectoryError eloc(lte);
76 
77  TSOS tmp2(tmp.localParameters(), eloc, surface, theField);
79  return TSOS(gtp, tmp2.cartesianError(), surface);
80  } else {
81  // return state without errors
82  return TSOS(GlobalTrajectoryParameters(x, p, fts.charge(), theField), surface);
83  }
84 }
85 
87  //Jacobian for 5*5 local error matrix
88  AlgebraicMatrix55 j = AlgebraicMatrixID(); //Jacobian
89 
90  double dir = (propagationDirection() == alongMomentum) ? 1. : -1.;
91  if (s * dir < 0.)
92  return j;
93 
94  j(3, 1) = s;
95  j(4, 2) = s;
96 
97  return j;
98 }
99 
101  const FTS& fts, const Cylinder& cylinder, GlobalPoint& x, GlobalVector& p, double& s) const {
102  GlobalPoint sp = cylinder.toGlobal(LocalPoint(0., 0.));
103  if (sp.x() != 0. || sp.y() != 0.) {
104  throw PropagationException("Cannot propagate to an arbitrary cylinder");
105  }
106 
107  x = fts.position();
108  p = fts.momentum();
109  s = cylinder.radius() - x.perp();
110 
111  double dir = (propagationDirection() == alongMomentum) ? 1. : -1.;
112  if (s * dir < 0.)
113  return false;
114 
115  double dt = s / p.perp();
116  x = GlobalPoint(x.x() + p.x() * dt, x.y() + p.y() * dt, x.z() + p.z() * dt);
117 
118  return true;
119 }
120 
122  const FTS& fts, const Plane& plane, LocalPoint& x, LocalVector& p, double& s) const {
123  //Do extrapolation in local frame of plane
124  // LocalPoint sp = plane.toLocal(plane.position());
125  x = plane.toLocal(fts.position());
126  p = plane.toLocal(fts.momentum());
127  s = -x.z(); // sp.z() - x.z(); local z of plane always 0
128 
129  //double dir = (propagationDirection() == alongMomentum) ? 1. : -1.;
130  //if(s*dir < 0.) return false;
131  if ((p.x() != 0 || p.y() != 0) && p.z() == 0 && s != 0)
132  return false;
133 
134  x = LocalPoint(x.x() + (p.x() / p.z()) * s, x.y() + (p.y() / p.z()) * s, x.z() + s);
135 
136  return true;
137 }
float dt
Definition: AMPTWrapper.h:136
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
ROOT::Math::SMatrixIdentity AlgebraicMatrixID
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepStd< double, 5, 5 > > AlgebraicMatrix55
virtual PropagationDirection propagationDirection() const final
Definition: Propagator.h:139
LocalPoint toLocal(const GlobalPoint &gp) const
Definition: Plane.h:16
GlobalPoint position() const
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
TrajectoryStateOnSurface propagatedState(const FreeTrajectoryState &fts, const Surface &surface, const AlgebraicMatrix55 &jacobian, const GlobalPoint &x, const GlobalVector &p) const
TrackCharge charge() const
const MagneticField * theField
AlgebraicMatrix55 jacobian(double &s) const
GlobalVector momentum() const
Common base class.
TrajectoryStateOnSurface TSOS
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:79
std::pair< TSOS, double > propagateWithPath(const FreeTrajectoryState &fts, const Plane &surface) const override
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
bool propagateParametersOnPlane(const FreeTrajectoryState &fts, const Plane &plane, LocalPoint &x, LocalVector &p, double &s) const
Scalar radius() const
Radius of the cylinder.
Definition: Cylinder.h:64
float x
tmp
align.sh
Definition: createJobs.py:716
bool propagateParametersOnCylinder(const FreeTrajectoryState &fts, const Cylinder &cylinder, GlobalPoint &x, GlobalVector &p, double &s) const