CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
AnalyticalTrajectoryExtrapolatorToLine.cc
Go to the documentation of this file.
2 
8 
11 
12 #include <cmath>
13 
15  : thePropagator(new AnalyticalPropagator(field, anyDirection)) {}
16 
18  : thePropagator(propagator.clone()) {
20 }
21 
23  const Line& line) const {
24  return extrapolateSingleState(fts, line);
25 }
26 
28  const Line& line) const {
29  if (tsos.isValid())
30  return extrapolateFullState(tsos, line);
31  else
32  return tsos;
33 }
34 
36  const TrajectoryStateOnSurface tsos, const Line& line) const {
37  //
38  // first determine IP plane using propagation with (single) FTS
39  // could be optimised (will propagate errors even if duplicated below)
40  //
42  if (!singleState.isValid() || tsos.singleState())
43  return singleState;
44  //
45  // propagate multiTsos to plane found above
46  //
47  return thePropagator->propagate(tsos, singleState.surface());
48 }
49 
51  const Line& line) const {
52  // static TimingReport::Item& timer = detailedDetTimer("AnalyticalTrajectoryExtrapolatorToLine");
53  // TimeMe t(timer,false);
54  //
55  // initialisation of position, momentum and transverse curvature
56  //
57  GlobalPoint x(fts.position());
58  GlobalVector p(fts.momentum());
59  double rho = fts.transverseCurvature();
60  //
61  // Straight line approximation? |rho|<1.e-10 equivalent to ~ 1um
62  // difference in transversal position at 10m.
63  //
64  double s(0);
65  if (fabs(rho) < 1.e-10) {
66  Line tangent(x, p);
67  GlobalPoint xold(x);
68  x = tangent.closerPointToLine(line);
69  GlobalVector dx(x - xold);
70  float sign = p.dot(x - xold);
71  s = sign > 0 ? dx.mag() : -dx.mag();
72  }
73  //
74  // Helix case
75  //
76  else {
79  IterativeHelixExtrapolatorToLine extrapolator(helixPos, helixDir, rho, anyDirection);
80  if (!propagateWithHelix(extrapolator, line, x, p, s))
81  return TrajectoryStateOnSurface();
82  }
83  //
84  // Define target surface: origin on line, x_local from line
85  // to helix at closest approach, z_local along the helix
86  // and y_local to complete right-handed system
87  //
88  GlobalPoint origin(line.closerPointToLine(Line(x, p)));
89  GlobalVector zLocal(p.unit());
90  GlobalVector yLocal(zLocal.cross(x - origin).unit());
91  GlobalVector xLocal(yLocal.cross(zLocal));
92  Surface::RotationType rot(xLocal, yLocal, zLocal);
93  PlaneBuilder::ReturnType surface = PlaneBuilder().plane(origin, rot);
94  //
95  // Compute propagated state
96  //
98  if (fts.hasError()) {
99  //
100  // compute jacobian
101  //
102  AnalyticalCurvilinearJacobian analyticalJacobian(fts.parameters(), gtp.position(), gtp.momentum(), s);
103  const AlgebraicMatrix55& jacobian = analyticalJacobian.jacobian();
104  CurvilinearTrajectoryError cte(ROOT::Math::Similarity(jacobian, fts.curvilinearError().matrix()));
105  return TrajectoryStateOnSurface(gtp, cte, *surface);
106  } else {
107  //
108  // return state without errors
109  //
110  return TrajectoryStateOnSurface(gtp, *surface);
111  }
112 }
113 
115  const Line& line,
116  GlobalPoint& x,
117  GlobalVector& p,
118  double& s) const {
119  //
120  // save absolute value of momentum
121  //
122  double pmag(p.mag());
123  //
124  // get path length to solution
125  //
126  std::pair<bool, double> propResult = extrapolator.pathLength(line);
127  if (!propResult.first)
128  return false;
129  s = propResult.second;
130  //
131  // get point and (normalised) direction from path length
132  //
133  HelixLineExtrapolation::PositionType xGen = extrapolator.position(s);
134  HelixLineExtrapolation::DirectionType pGen = extrapolator.direction(s);
135  //
136  // Fix normalisation and convert back to GlobalPoint / GlobalVector
137  //
138  x = GlobalPoint(xGen);
139  pGen *= pmag / pGen.mag();
140  p = GlobalVector(pGen);
141  //
142  return true;
143 }
tuple propagator
virtual void setPropagationDirection(PropagationDirection dir)
Definition: Propagator.h:130
AnalyticalTrajectoryExtrapolatorToLine(const MagneticField *field)
constructor with default geometrical propagator
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
const GlobalTrajectoryParameters & parameters() const
Definition: Line.h:10
const AlgebraicMatrix55 & jacobian() const
double sign(double x)
ReturnType plane(const PositionType &pos, const RotationType &rot) const
Definition: PlaneBuilder.h:21
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
TrajectoryStateOnSurface extrapolate(const FreeTrajectoryState &fts, const Line &L) const
extrapolation from FreeTrajectoryState
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepStd< double, 5, 5 > > AlgebraicMatrix55
TrackCharge charge() const
const CurvilinearTrajectoryError & curvilinearError() const
const SurfaceType & surface() const
T mag() const
Definition: PV3DBase.h:64
PositionType position(double s) const override
TrajectoryStateOnSurface extrapolateFullState(const TrajectoryStateOnSurface tsos, const Line &line) const
extrapolation of (multi) TSOS
FreeTrajectoryState const * freeTrajectoryState(bool withErrors=true) const
TrajectoryStateOnSurface extrapolateSingleState(const FreeTrajectoryState &fts, const Line &line) const
extrapolation of (single) FTS
uint16_t const *__restrict__ x
Definition: gpuClustering.h:39
DirectionType direction(double s) const override
GlobalVector momentum() const
GlobalPoint position() const
std::pair< bool, double > pathLength(const GlobalPoint &point) const override
GlobalPoint closerPointToLine(const Line &aLine) const
Definition: Line.h:27
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:50
double transverseCurvature() const
virtual const MagneticField * magneticField() const =0
const AlgebraicSymMatrix55 & matrix() const
bool propagateWithHelix(const IterativeHelixExtrapolatorToLine &extrapolator, const Line &line, GlobalPoint &x, GlobalVector &p, double &s) const
the actual propagation to a new point &amp; momentum vector
Global3DVector GlobalVector
Definition: GlobalVector.h:10