CMS 3D CMS Logo

TrajectoryExtrapolatorToLine.cc
Go to the documentation of this file.
1 
8 
10  const Line& L,
11  const Propagator& aPropagator) const {
13  p->setPropagationDirection(anyDirection);
14 
15  FreeTrajectoryState fastFts(fts.parameters(), fts.curvilinearError());
16  GlobalVector T1 = fastFts.momentum().unit();
17  GlobalPoint T0 = fastFts.position();
18  double distance = 9999999.9;
19  double old_distance;
20  bool refining = true;
21 
22  LogDebug("TrajectoryExtrapolatorToLine") << "START REFINING";
23  while (refining) {
24  LogDebug("TrajectoryExtrapolatorToLine") << "Refining cycle...";
25  // describe orientation of target surface on basis of track parameters
26  Line T(T0, T1);
27  GlobalPoint B = T.closerPointToLine(L);
28  old_distance = distance;
29 
30  //create surface
31  GlobalPoint BB = B + 0.3 * (T0 - B);
33  GlobalVector XX(T1.y(), -T1.x(), 0.);
34  GlobalVector YY(T1.cross(XX));
37  LogDebug("TrajectoryExtrapolatorToLine") << "Current plane position: " << surface->toGlobal(LocalPoint(0., 0., 0.));
38  LogDebug("TrajectoryExtrapolatorToLine") << "Current plane normal: " << surface->toGlobal(LocalVector(0, 0, 1));
39  LogDebug("TrajectoryExtrapolatorToLine") << "Current momentum: " << T1;
40 
41  // extrapolate fastFts to target surface
42  TrajectoryStateOnSurface tsos = p->propagate(fastFts, *surface);
43 
44  if (!tsos.isValid()) {
45  LogDebug("TrajectoryExtrapolatorToLine") << "TETL - extrapolation failed";
46  return tsos;
47  } else {
48  T0 = tsos.globalPosition();
49  T1 = tsos.globalMomentum().unit();
50  GlobalVector D = L.distance(T0);
51  distance = D.mag();
52  if (fabs(old_distance - distance) < 0.000001) {
53  refining = false;
54  }
55  if (old_distance - distance < 0.) {
56  refining = false;
57  LogDebug("TrajectoryExtrapolatorToLine") << "TETL- stop to skip loops";
58  }
59  }
60  }
61  //
62  // Now propagate with errors and (not for the moment) perform rotation
63  //
64  // Origin of local system: point of closest approach on the line
65  // (w.r.t. to tangent to helix at last iteration)
66  //
67  Line T(T0, T1);
68  GlobalPoint origin(L.closerPointToLine(T));
69  //
70  // Axes of local system:
71  // x from line to helix at closest approach
72  // z along the helix
73  // y to complete right-handed system
74  //
75  GlobalVector ZZ(T1.unit());
76  GlobalVector YY(ZZ.cross(T0 - origin).unit());
77  GlobalVector XX(YY.cross(ZZ));
80  TrajectoryStateOnSurface tsos = p->propagate(fts, *surface);
81 
82  return tsos;
83 }
Local3DVector LocalVector
Definition: LocalVector.h:12
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
const CurvilinearTrajectoryError & curvilinearError() const
Definition: APVGainStruct.h:7
Definition: Line.h:10
virtual Propagator * clone() const =0
const GlobalTrajectoryParameters & parameters() const
static PlanePointer build(Args &&... args)
Definition: Plane.h:33
TrajectoryStateOnSurface extrapolate(const FreeTrajectoryState &fts, const Line &L, const Propagator &p) const
extrapolation with user-supplied propagator
GlobalPoint globalPosition() const
DecomposeProduct< arg, typename Div::arg > D
Definition: Factorize.h:141
GlobalVector globalMomentum() const
Vector3DBase unit() const
Definition: Vector3DBase.h:54
long double T
#define LogDebug(id)