CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
AnalyticalImpactPointExtrapolator.cc
Go to the documentation of this file.
9 
10 // #include "CommonDet/DetUtilities/interface/DetailedDetTimer.h"
11 
13  : thePropagator(new AnalyticalPropagator(field, anyDirection)), theField(field) {}
14 
16  const MagneticField* field)
17  : thePropagator(propagator.clone()), theField(field) {
19 }
20 
22  const GlobalPoint& vtx) const {
23  // static TimingReport::Item& timer = detailedDetTimer("AnalyticalImpactPointExtrapolator");
24  // TimeMe t(timer,false);
25 
26  return extrapolateSingleState(fts, vtx);
27 }
28 
30  const GlobalPoint& vtx) const {
31  if (tsos.isValid())
32  return extrapolateFullState(tsos, vtx);
33  else
34  return tsos;
35 }
36 
38  const GlobalPoint& vertex) const {
39  //
40  // first determine IP plane using propagation with (single) FTS
41  // could be optimised (will propagate errors even if duplicated below)
42  //
44  if (!singleState.isValid() || tsos.singleState())
45  return singleState;
46  //
47  // propagate multiTsos to plane found above
48  //
49  return thePropagator->propagate(tsos, singleState.surface());
50 }
51 
53  const GlobalPoint& vertex) const {
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  GlobalVector dx(p.dot(vertex - x) / p.mag2() * p);
67  x += dx;
68  float sign = p.dot(dx);
69  s = sign > 0 ? dx.mag() : -dx.mag();
70  }
71  //
72  // Helix case
73  //
74  else {
77  IterativeHelixExtrapolatorToLine extrapolator(helixPos, helixDir, rho, anyDirection);
78  if (!propagateWithHelix(extrapolator, vertex, x, p, s))
79  return TrajectoryStateOnSurface();
80  }
81  //
82  // Define target surface: origin on line, x_local from line
83  // to helix at closest approach, z_local along the helix
84  // and y_local to complete right-handed system
85  //
86  GlobalVector zLocal(p.unit());
87  GlobalVector yLocal(zLocal.cross(x - vertex).unit());
88  GlobalVector xLocal(yLocal.cross(zLocal));
89  Surface::RotationType rot(xLocal, yLocal, zLocal);
90  PlaneBuilder::ReturnType surface = PlaneBuilder().plane(vertex, rot);
91  //
92  // Compute propagated state
93  //
95  if (fts.hasError()) {
96  //
97  // compute jacobian
98  //
99  AnalyticalCurvilinearJacobian analyticalJacobian(fts.parameters(), gtp.position(), gtp.momentum(), s);
101  ROOT::Math::Similarity(analyticalJacobian.jacobian(), fts.curvilinearError().matrix()));
102  return TrajectoryStateOnSurface(gtp, cte, *surface);
103  } else {
104  //
105  // return state without errors
106  //
107  return TrajectoryStateOnSurface(gtp, *surface);
108  }
109 }
110 
112  const GlobalPoint& vertex,
113  GlobalPoint& x,
114  GlobalVector& p,
115  double& s) const {
116  //
117  // save absolute value of momentum
118  //
119  double pmag(p.mag());
120  //
121  // get path length to solution
122  //
123  std::pair<bool, double> propResult = extrapolator.pathLength(vertex);
124  if (!propResult.first)
125  return false;
126  s = propResult.second;
127  //
128  // get point and (normalised) direction from path length
129  //
130  HelixLineExtrapolation::PositionType xGen = extrapolator.position(s);
131  HelixLineExtrapolation::DirectionType pGen = extrapolator.direction(s);
132  //
133  // Fix normalisation and convert back to GlobalPoint / GlobalVector
134  //
135  x = GlobalPoint(xGen);
136  pGen *= pmag / pGen.mag();
137  p = GlobalVector(pGen);
138  //
139  return true;
140 }
tuple propagator
virtual void setPropagationDirection(PropagationDirection dir)
Definition: Propagator.h:130
TrajectoryStateOnSurface extrapolateSingleState(const FreeTrajectoryState &fts, const GlobalPoint &vertex) const
extrapolation of (single) FTS
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
const GlobalTrajectoryParameters & parameters() const
double sign(double x)
ReturnType plane(const PositionType &pos, const RotationType &rot) const
Definition: PlaneBuilder.h:21
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
bool propagateWithHelix(const IterativeHelixExtrapolatorToLine &extrapolator, const GlobalPoint &vertex, GlobalPoint &x, GlobalVector &p, double &s) const
the actual propagation to a new point &amp; momentum vector
TrackCharge charge() const
const CurvilinearTrajectoryError & curvilinearError() const
const SurfaceType & surface() const
T mag() const
Definition: PV3DBase.h:64
PositionType position(double s) const override
FreeTrajectoryState const * freeTrajectoryState(bool withErrors=true) const
uint16_t const *__restrict__ x
Definition: gpuClustering.h:39
DeepCopyPointerByClone< Propagator > thePropagator
TrajectoryStateOnSurface extrapolateFullState(const TrajectoryStateOnSurface tsos, const GlobalPoint &vertex) const
extrapolation of (multi) TSOS
DirectionType direction(double s) const override
GlobalVector momentum() const
AnalyticalImpactPointExtrapolator(const MagneticField *field)
constructor with default geometrical propagator
GlobalPoint position() const
std::pair< bool, double > pathLength(const GlobalPoint &point) const override
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
const AlgebraicSymMatrix55 & matrix() const
TrajectoryStateOnSurface extrapolate(const FreeTrajectoryState &fts, const GlobalPoint &vtx) const
extrapolation from FreeTrajectoryState
Global3DVector GlobalVector
Definition: GlobalVector.h:10