CMS 3D CMS Logo

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