CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions
TrajectoryExtrapolatorToLine Class Reference

#include <TrajectoryExtrapolatorToLine.h>

Public Member Functions

TrajectoryStateOnSurface extrapolate (const FreeTrajectoryState &fts, const Line &L, const Propagator &p) const
 extrapolation with user-supplied propagator More...
 

Detailed Description

Definition at line 8 of file TrajectoryExtrapolatorToLine.h.

Member Function Documentation

TrajectoryStateOnSurface TrajectoryExtrapolatorToLine::extrapolate ( const FreeTrajectoryState fts,
const Line L,
const Propagator p 
) const

extrapolation with user-supplied propagator

Definition at line 9 of file TrajectoryExtrapolatorToLine.cc.

References anyDirection, newFWLiteAna::build, Propagator::clone(), Line::closerPointToLine(), Line::distance(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), TrajectoryStateOnSurface::isValid(), LogDebug, PV3DBase< T, PVType, FrameType >::mag(), AlCaHLTBitMon_ParallelJobs::p, FreeTrajectoryState::parameters(), makeMuonMisalignmentScenario::rot, Vector3DBase< T, FrameTag >::unit(), and XX.

Referenced by TSCBLBuilderWithPropagator::operator()().

12 {
13  DeepCopyPointerByClone<Propagator> p(aPropagator.clone());
15 
16  FreeTrajectoryState fastFts(fts.parameters());
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 
25  while (refining) {
26 
27  // describe orientation of target surface on basis of track parameters
28  n_iter++;
29  Line T(T0,T1);
30  GlobalPoint B = T.closerPointToLine(L);
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 
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) {refining = false;}
53  if (old_distance-distance<0.){
54  refining=false;
55  LogDebug("TrajectoryExtrapolatorToLine")<< "TETL- stop to skip loops";
56  }
57  }
58  }
59  //
60  // Now propagate with errors and (not for the moment) perform rotation
61  //
62  // Origin of local system: point of closest approach on the line
63  // (w.r.t. to tangent to helix at last iteration)
64  //
65  Line T(T0,T1);
66  GlobalPoint origin(L.closerPointToLine(T));
67  //
68  // Axes of local system:
69  // x from line to helix at closest approach
70  // z along the helix
71  // y to complete right-handed system
72  //
73  GlobalVector ZZ(T1.unit());
74  GlobalVector YY(ZZ.cross(T0-origin).unit());
75  GlobalVector XX(YY.cross(ZZ));
78  TrajectoryStateOnSurface tsos = p->propagate(fts, *surface);
79 
80  return tsos;
81 
82 }
#define LogDebug(id)
virtual FreeTrajectoryState propagate(const FreeTrajectoryState &ftsStart, const GlobalPoint &pDest) const final
Definition: Propagator.h:119
virtual void setPropagationDirection(PropagationDirection dir)
Definition: Propagator.h:144
const GlobalTrajectoryParameters & parameters() const
Definition: Line.h:10
double_binary B
Definition: DDStreamer.cc:234
double XX[2]
Definition: herwig.h:152
GlobalPoint globalPosition() const
GlobalVector distance(const Line &aLine) const
Definition: Line.h:38
T mag() const
Definition: PV3DBase.h:67
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
long double T