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 }
Vector3DBase< float, LocalTag >
FreeTrajectoryState::momentum
GlobalVector momentum() const
Definition: FreeTrajectoryState.h:68
Cylinder.h
Cylinder::radius
Scalar radius() const
Radius of the cylinder.
Definition: Cylinder.h:64
FreeTrajectoryState::hasError
bool hasError() const
Definition: FreeTrajectoryState.h:77
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
PropagationException
Common base class.
Definition: PropagationExceptions.h:14
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
StraightLinePropagator::propagateWithPath
std::pair< TSOS, double > propagateWithPath(const FreeTrajectoryState &fts, const Plane &surface) const override
Definition: StraightLinePropagator.cc:8
FreeTrajectoryState::charge
TrackCharge charge() const
Definition: FreeTrajectoryState.h:69
Surface
Definition: Surface.h:36
StraightLinePropagator::theField
const MagneticField * theField
Definition: StraightLinePropagator.h:39
DDAxes::x
FreeTrajectoryState::position
GlobalPoint position() const
Definition: FreeTrajectoryState.h:67
align::LocalPoint
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
StraightLinePropagator::jacobian
AlgebraicMatrix55 jacobian(double &s) const
Definition: StraightLinePropagator.cc:86
LocalTrajectoryParameters
Definition: LocalTrajectoryParameters.h:25
AlgebraicMatrixID
ROOT::Math::SMatrixIdentity AlgebraicMatrixID
Definition: AlgebraicROOTObjects.h:72
dt
float dt
Definition: AMPTWrapper.h:136
Plane.h
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
alignCSCRings.s
s
Definition: alignCSCRings.py:92
AlgebraicMatrix55
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepStd< double, 5, 5 > > AlgebraicMatrix55
Definition: AlgebraicROOTObjects.h:55
StraightLinePropagator::propagateParametersOnCylinder
bool propagateParametersOnCylinder(const FreeTrajectoryState &fts, const Cylinder &cylinder, GlobalPoint &x, GlobalVector &p, double &s) const
Definition: StraightLinePropagator.cc:100
Propagator::propagationDirection
virtual PropagationDirection propagationDirection() const final
Definition: Propagator.h:139
Surface::toGlobal
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:79
StraightLinePropagator::propagateParametersOnPlane
bool propagateParametersOnPlane(const FreeTrajectoryState &fts, const Plane &plane, LocalPoint &x, LocalVector &p, double &s) const
Definition: StraightLinePropagator.cc:121
GlobalTrajectoryParameters
Definition: GlobalTrajectoryParameters.h:15
GlobalPoint
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
Point3DBase< float, LocalTag >
LocalTrajectoryError
Definition: LocalTrajectoryError.h:20
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
StraightLinePropagator.h
FreeTrajectoryState
Definition: FreeTrajectoryState.h:27
StraightLinePropagator::TSOS
TrajectoryStateOnSurface TSOS
Definition: StraightLinePropagator.h:19
GloballyPositioned::toLocal
LocalPoint toLocal(const GlobalPoint &gp) const
Definition: GloballyPositioned.h:98
StraightLinePropagator::propagatedState
TrajectoryStateOnSurface propagatedState(const FreeTrajectoryState &fts, const Surface &surface, const AlgebraicMatrix55 &jacobian, const GlobalPoint &x, const GlobalVector &p) const
Definition: StraightLinePropagator.cc:65
genVertex_cff.x
x
Definition: genVertex_cff.py:12
Plane
Definition: Plane.h:16
Cylinder
Definition: Cylinder.h:19
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
PropagationExceptions.h
AlgebraicSymMatrix55
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
Definition: AlgebraicROOTObjects.h:23
AlgebraicROOTObjects.h
alongMomentum
Definition: PropagationDirection.h:4
DeadROC_duringRun.dir
dir
Definition: DeadROC_duringRun.py:23