test
CMS 3D CMS Logo

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