CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TransverseImpactPointExtrapolator.cc
Go to the documentation of this file.
4 #include "boost/intrusive_ptr.hpp"
11 
13 
14 
16  thePropagator(0) {}
17 
18 
20  thePropagator(new AnalyticalPropagator(field, anyDirection)) {}
21 
23  thePropagator(u.clone())
24 {
26 }
27 
30  const GlobalPoint& vtx) const
31 {
32  return doExtrapolation(fts, vtx, *thePropagator);
33 }
34 
37  const GlobalPoint& vtx) const
38 {
39  if ( !tsos.isValid() ) return tsos;
40  return doExtrapolation(tsos, vtx, *thePropagator);
41 }
42 
45  const GlobalPoint& vtx,
46  const Propagator& p) const
47 {
48  //
49  // set propagator for bidirectional propagation
50  //
51  std::unique_ptr<Propagator> p_cloned = SetPropagationDirection(p, anyDirection);
52  return doExtrapolation(fts, vtx, *(p_cloned.get()));
53 }
54 
57  const GlobalPoint& vtx,
58  const Propagator& p) const
59 {
60  if ( !tsos.isValid() ) return tsos;
61  //
62  // set propagator for bidirectional propagation
63  //
64  std::unique_ptr<Propagator> p_cloned = SetPropagationDirection(p, anyDirection);
65  return doExtrapolation(tsos, vtx, *(p_cloned.get()));
66 }
67 
70  const GlobalPoint& vtx,
71  const Propagator& p) const
72 {
73  //
74  // Compute tip surface
75  //
76  if (fabs(tsos.freeState()->transverseCurvature())<1.E-6){
77  LogDebug("TransverseImpactPointExtrapolator")<< "negligeable curvature: using a trick to extrapolate:\n"<<tsos;
78 
79  //0T field probably
80  //x is perpendicular to the momentum
81  GlobalVector xLocal = GlobalVector(-tsos.globalMomentum().y(),tsos.globalMomentum().x(),0).unit();
82  //y along global Z
83  GlobalVector yLocal(0.,0.,1.);
84  //z accordingly
85  GlobalVector zLocal(xLocal.cross(yLocal));
86 
87  Surface::PositionType origin(vtx);
88  Surface::RotationType rotation(xLocal,yLocal,zLocal);
89  ReferenceCountingPointer<Plane> surface = PlaneBuilder().plane(origin,rotation);
90 
91  return p.propagate(*tsos.freeState(),*surface);
92  }else{
95  1./tsos.transverseCurvature(),vtx);
96  //
97  // propagate
98  //
99  return p.propagate(tsos,*surface);
100  }
101 }
102 
105  const GlobalPoint& vtx,
106  const Propagator& p) const
107 {
108  //
109  // Compute tip surface
110  //
111  if (fabs(fts.transverseCurvature())<1.E-6){
112  LogDebug("TransverseImpactPointExtrapolator")<< "negligeable curvature: using a trick to extrapolate:\n"<<fts;
113 
114  //0T field probably
115  //x is perpendicular to the momentum
116  GlobalVector xLocal = GlobalVector(-fts.momentum().y(),fts.momentum().x(),0).unit();
117  //y along global Z
118  GlobalVector yLocal(0.,0.,1.);
119  //z accordingly
120  GlobalVector zLocal(xLocal.cross(yLocal));
121 
122  Surface::PositionType origin(vtx);
123  Surface::RotationType rotation(xLocal,yLocal,zLocal);
124  ReferenceCountingPointer<Plane> surface = PlaneBuilder().plane(origin,rotation);
125 
126  return p.propagate(fts,*surface);
127  }else{
129  tipSurface(fts.position(),fts.momentum(),
130  1./fts.transverseCurvature(),vtx);
131  //
132  // propagate
133  //
134  return p.propagate(fts,*surface);
135  }
136 }
137 
140  const GlobalVector& momentum,
141  const double& signedTransverseRadius,
142  const GlobalPoint& vertex) const
143 {
144 
145  LogDebug("TransverseImpactPointExtrapolator")<< position<<"\n"
146  <<momentum<<"\n"
147  <<"signedTransverseRadius : "<<signedTransverseRadius<<"\n"
148  <<vertex;
149 
150  typedef Point2DBase<double,GlobalTag> PositionType2D;
151  typedef Vector2DBase<double,GlobalTag> DirectionType2D;
152 
153  PositionType2D x0(position.x(),position.y());
154  DirectionType2D t0(-momentum.y(),momentum.x());
155  t0 = t0/t0.mag();
156 
157  PositionType2D xc(x0+signedTransverseRadius*t0);
158 
159  DirectionType2D vtxDirection(xc.x()-vertex.x(),xc.y()-vertex.y());
160  double vtxDistance = vtxDirection.mag();
161 
162  Surface::PositionType origin(vertex);
163  GlobalVector xLocal(vtxDirection.x()/vtxDistance,
164  vtxDirection.y()/vtxDistance,
165  0.);
166  if ( vtxDistance<fabs(signedTransverseRadius) ) {
167  LogDebug("TransverseImpactPointExtrapolator")<<"Inverting the x axis.";
168  xLocal = -xLocal;
169  }
170  GlobalVector yLocal(0.,0.,1.);
171  GlobalVector zLocal(xLocal.cross(yLocal));
172  if ( zLocal.dot(momentum)<0. ) {
173  LogDebug("TransverseImpactPointExtrapolator")<<"Inverting the y,z frame.";
174  yLocal = -yLocal;
175  zLocal = -zLocal;
176  }
177  Surface::RotationType rotation(xLocal,yLocal,zLocal);
178 
179  LogDebug("TransverseImpactPointExtrapolator")<<"plane center: "<<origin<<"\n"
180  <<"plane rotation axis:\n"
181  <<xLocal<<"\n"
182  <<yLocal<<"\n"
183  <<zLocal<<"\n"
184  <<"x0: "<<x0<<"\n"
185  <<"t0: "<<t0<<"\n"
186  <<"xc: "<<xc<<"\n"
187  <<"vtxDirection: "<<vtxDirection;
188 
189  return PlaneBuilder().plane(origin,rotation);
190 }
#define LogDebug(id)
virtual void setPropagationDirection(PropagationDirection dir)
Definition: Propagator.h:140
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:22
T y() const
Definition: PV3DBase.h:63
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
string unit
Definition: csvLumiCalc.py:46
FreeTrajectoryState const * freeState(bool withErrors=true) const
Vector3DBase< typename PreciseFloatType< T, U >::Type, FrameTag > cross(const Vector3DBase< U, FrameTag > &v) const
Definition: Vector3DBase.h:119
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:53
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:509
DeepCopyPointerByClone< Propagator > thePropagator
T x() const
Definition: PV3DBase.h:62
Global3DVector GlobalVector
Definition: GlobalVector.h:10