CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TransverseImpactPointExtrapolator.cc
Go to the documentation of this file.
4 
11 
13 
15 
17  : thePropagator(new AnalyticalPropagator(field, anyDirection)) {}
18 
21 }
22 
24  const GlobalPoint& vtx) const {
25  return doExtrapolation(fts, vtx, *thePropagator);
26 }
27 
29  const GlobalPoint& vtx) const {
30  if (!tsos.isValid())
31  return tsos;
32  return doExtrapolation(tsos, vtx, *thePropagator);
33 }
34 
36  const GlobalPoint& vtx,
37  const Propagator& p) const {
38  //
39  // set propagator for bidirectional propagation
40  //
41  std::unique_ptr<Propagator> p_cloned = SetPropagationDirection(p, anyDirection);
42  return doExtrapolation(fts, vtx, *(p_cloned.get()));
43 }
44 
46  const GlobalPoint& vtx,
47  const Propagator& p) const {
48  if (!tsos.isValid())
49  return tsos;
50  //
51  // set propagator for bidirectional propagation
52  //
53  std::unique_ptr<Propagator> p_cloned = SetPropagationDirection(p, anyDirection);
54  return doExtrapolation(tsos, vtx, *(p_cloned.get()));
55 }
56 
58  const GlobalPoint& vtx,
59  const Propagator& p) const {
60  //
61  // Compute tip surface
62  //
63  if (fabs(tsos.freeState()->transverseCurvature()) < 1.E-6) {
64  LogDebug("TransverseImpactPointExtrapolator") << "negligeable curvature: using a trick to extrapolate:\n" << tsos;
65 
66  //0T field probably
67  //x is perpendicular to the momentum
68  GlobalVector xLocal = GlobalVector(-tsos.globalMomentum().y(), tsos.globalMomentum().x(), 0).unit();
69  //y along global Z
70  GlobalVector yLocal(0., 0., 1.);
71  //z accordingly
72  GlobalVector zLocal(xLocal.cross(yLocal));
73 
74  const Surface::PositionType& origin(vtx);
75  Surface::RotationType rotation(xLocal, yLocal, zLocal);
76  ReferenceCountingPointer<Plane> surface = PlaneBuilder().plane(origin, rotation);
77 
78  return p.propagate(*tsos.freeState(), *surface);
79  } else {
81  tipSurface(tsos.globalPosition(), tsos.globalMomentum(), 1. / tsos.transverseCurvature(), vtx);
82  //
83  // propagate
84  //
85  return p.propagate(tsos, *surface);
86  }
87 }
88 
90  const GlobalPoint& vtx,
91  const Propagator& p) const {
92  //
93  // Compute tip surface
94  //
95  if (fabs(fts.transverseCurvature()) < 1.E-6) {
96  LogDebug("TransverseImpactPointExtrapolator") << "negligeable curvature: using a trick to extrapolate:\n" << fts;
97 
98  //0T field probably
99  //x is perpendicular to the momentum
100  GlobalVector xLocal = GlobalVector(-fts.momentum().y(), fts.momentum().x(), 0).unit();
101  //y along global Z
102  GlobalVector yLocal(0., 0., 1.);
103  //z accordingly
104  GlobalVector zLocal(xLocal.cross(yLocal));
105 
106  const Surface::PositionType& origin(vtx);
107  Surface::RotationType rotation(xLocal, yLocal, zLocal);
108  ReferenceCountingPointer<Plane> surface = PlaneBuilder().plane(origin, rotation);
109 
110  return p.propagate(fts, *surface);
111  } else {
113  tipSurface(fts.position(), fts.momentum(), 1. / fts.transverseCurvature(), vtx);
114  //
115  // propagate
116  //
117  return p.propagate(fts, *surface);
118  }
119 }
120 
122  const GlobalVector& momentum,
123  const double& signedTransverseRadius,
124  const GlobalPoint& vertex) const {
125  LogDebug("TransverseImpactPointExtrapolator") << position << "\n"
126  << momentum << "\n"
127  << "signedTransverseRadius : " << signedTransverseRadius << "\n"
128  << vertex;
129 
130  typedef Point2DBase<double, GlobalTag> PositionType2D;
131  typedef Vector2DBase<double, GlobalTag> DirectionType2D;
132 
133  PositionType2D x0(position.x(), position.y());
134  DirectionType2D t0(-momentum.y(), momentum.x());
135  t0 = t0 / t0.mag();
136 
137  PositionType2D xc(x0 + signedTransverseRadius * t0);
138 
139  DirectionType2D vtxDirection(xc.x() - vertex.x(), xc.y() - vertex.y());
140  double vtxDistance = vtxDirection.mag();
141 
142  const Surface::PositionType& origin(vertex);
143  GlobalVector xLocal(vtxDirection.x() / vtxDistance, vtxDirection.y() / vtxDistance, 0.);
144  if (vtxDistance < fabs(signedTransverseRadius)) {
145  LogDebug("TransverseImpactPointExtrapolator") << "Inverting the x axis.";
146  xLocal = -xLocal;
147  }
148  GlobalVector yLocal(0., 0., 1.);
149  GlobalVector zLocal(xLocal.cross(yLocal));
150  if (zLocal.dot(momentum) < 0.) {
151  LogDebug("TransverseImpactPointExtrapolator") << "Inverting the y,z frame.";
152  yLocal = -yLocal;
153  zLocal = -zLocal;
154  }
155  Surface::RotationType rotation(xLocal, yLocal, zLocal);
156 
157  LogDebug("TransverseImpactPointExtrapolator") << "plane center: " << origin << "\n"
158  << "plane rotation axis:\n"
159  << xLocal << "\n"
160  << yLocal << "\n"
161  << zLocal << "\n"
162  << "x0: " << x0 << "\n"
163  << "t0: " << t0 << "\n"
164  << "xc: " << xc << "\n"
165  << "vtxDirection: " << vtxDirection;
166 
167  return PlaneBuilder().plane(origin, rotation);
168 }
Vector3DBase< typename PreciseFloatType< T, U >::Type, FrameTag > cross(const Vector3DBase< U, FrameTag > &v) const
Definition: Vector3DBase.h:110
virtual void setPropagationDirection(PropagationDirection dir)
Definition: Propagator.h:130
ReferenceCountingPointer< Plane > tipSurface(const GlobalPoint &position, const GlobalVector &momentum, const double &signedTransverseRadius, const GlobalPoint &vtx) const
computation of the TIP surface
ReturnType plane(const PositionType &pos, const RotationType &rot) const
Definition: PlaneBuilder.h:21
T y() const
Definition: PV3DBase.h:60
GlobalPoint globalPosition() const
TransverseImpactPointExtrapolator()
constructor with default geometrical propagator
std::unique_ptr< Propagator > SetPropagationDirection(Propagator const &iprop, PropagationDirection dir)
TrajectoryStateOnSurface doExtrapolation(const TrajectoryStateOnSurface tsos, const GlobalPoint &vtx, const Propagator &u) const
extrapolation of (multi) TSOS with (internal or user-supplied) propagator
FreeTrajectoryState const * freeState(bool withErrors=true) const
GlobalVector momentum() const
GlobalPoint position() const
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
TrajectoryStateOnSurface extrapolate(const FreeTrajectoryState &fts, const GlobalPoint &vtx) const
extrapolation with default (=geometrical) propagator
GlobalVector globalMomentum() const
static int position[264][3]
Definition: ReadPGInfo.cc:289
DeepCopyPointerByClone< Propagator > thePropagator
T x() const
Definition: PV3DBase.h:59
Global3DVector GlobalVector
Definition: GlobalVector.h:10
Basic3DVector unit() const
#define LogDebug(id)