CMS 3D CMS Logo

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