1 |
econte |
1.1 |
#include "TrackingTools/PatternTools/interface/TransverseImpactPointExtrapolator.h"
|
2 |
|
|
#include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h"
|
3 |
|
|
#include "DataFormats/GeometrySurface/interface/Surface.h"
|
4 |
|
|
#include "boost/intrusive_ptr.hpp"
|
5 |
|
|
#include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h"
|
6 |
|
|
#include "DataFormats/TrajectorySeed/interface/PropagationDirection.h"
|
7 |
|
|
#include "TrackingTools/GeomPropagators/interface/AnalyticalPropagator.h"
|
8 |
|
|
#include "DataFormats/GeometryVector/interface/Point2DBase.h"
|
9 |
|
|
#include "DataFormats/GeometryVector/interface/Vector2DBase.h"
|
10 |
|
|
#include "DataFormats/GeometrySurface/interface/PlaneBuilder.h"
|
11 |
|
|
|
12 |
|
|
#include "FWCore/MessageLogger/interface/MessageLogger.h"
|
13 |
|
|
|
14 |
|
|
|
15 |
|
|
TransverseImpactPointExtrapolator::TransverseImpactPointExtrapolator () :
|
16 |
|
|
thePropagator(0) {}
|
17 |
|
|
|
18 |
|
|
|
19 |
|
|
TransverseImpactPointExtrapolator::TransverseImpactPointExtrapolator (const MagneticField* field) :
|
20 |
|
|
thePropagator(new AnalyticalPropagator(field, anyDirection)) {}
|
21 |
|
|
|
22 |
|
|
TransverseImpactPointExtrapolator::TransverseImpactPointExtrapolator (const Propagator& u) :
|
23 |
|
|
thePropagator(u.clone())
|
24 |
|
|
{
|
25 |
|
|
thePropagator->setPropagationDirection(anyDirection);
|
26 |
|
|
}
|
27 |
|
|
|
28 |
|
|
TrajectoryStateOnSurface
|
29 |
|
|
TransverseImpactPointExtrapolator::extrapolate (const FreeTrajectoryState& fts,
|
30 |
|
|
const GlobalPoint& vtx) const
|
31 |
|
|
{
|
32 |
|
|
return doExtrapolation(fts, vtx, *thePropagator);
|
33 |
|
|
}
|
34 |
|
|
|
35 |
|
|
TrajectoryStateOnSurface
|
36 |
|
|
TransverseImpactPointExtrapolator::extrapolate (const TrajectoryStateOnSurface tsos,
|
37 |
|
|
const GlobalPoint& vtx) const
|
38 |
|
|
{
|
39 |
|
|
if ( !tsos.isValid() ) return tsos;
|
40 |
|
|
return doExtrapolation(tsos, vtx, *thePropagator);
|
41 |
|
|
}
|
42 |
|
|
|
43 |
|
|
TrajectoryStateOnSurface
|
44 |
|
|
TransverseImpactPointExtrapolator::extrapolate (const FreeTrajectoryState& fts,
|
45 |
|
|
const GlobalPoint& vtx,
|
46 |
|
|
const Propagator& p) const
|
47 |
|
|
{
|
48 |
|
|
//
|
49 |
|
|
// set propagator for bidirectional propagation
|
50 |
|
|
//
|
51 |
|
|
SetPropagationDirection setter(p,anyDirection);
|
52 |
|
|
return doExtrapolation(fts,vtx,p);
|
53 |
|
|
}
|
54 |
|
|
|
55 |
|
|
TrajectoryStateOnSurface
|
56 |
|
|
TransverseImpactPointExtrapolator::extrapolate (const TrajectoryStateOnSurface tsos,
|
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 |
|
|
SetPropagationDirection setter(p,anyDirection);
|
65 |
|
|
return doExtrapolation(tsos,vtx,p);
|
66 |
|
|
}
|
67 |
|
|
|
68 |
|
|
TrajectoryStateOnSurface
|
69 |
|
|
TransverseImpactPointExtrapolator::doExtrapolation (const TrajectoryStateOnSurface tsos,
|
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<BoundPlane> surface = PlaneBuilder().plane(origin,rotation);
|
90 |
|
|
|
91 |
|
|
return p.propagate(*tsos.freeState(),*surface);
|
92 |
|
|
}else{
|
93 |
|
|
ReferenceCountingPointer<BoundPlane> surface =
|
94 |
|
|
tipSurface(tsos.globalPosition(),tsos.globalMomentum(),
|
95 |
|
|
1./tsos.transverseCurvature(),vtx);
|
96 |
|
|
//
|
97 |
|
|
// propagate
|
98 |
|
|
//
|
99 |
|
|
return p.propagate(tsos,*surface);
|
100 |
|
|
}
|
101 |
|
|
}
|
102 |
|
|
|
103 |
|
|
TrajectoryStateOnSurface
|
104 |
|
|
TransverseImpactPointExtrapolator::doExtrapolation (const FreeTrajectoryState& fts,
|
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<BoundPlane> surface = PlaneBuilder().plane(origin,rotation);
|
125 |
|
|
|
126 |
|
|
return p.propagate(fts,*surface);
|
127 |
|
|
}else{
|
128 |
|
|
ReferenceCountingPointer<BoundPlane> surface =
|
129 |
|
|
tipSurface(fts.position(),fts.momentum(),
|
130 |
|
|
1./fts.transverseCurvature(),vtx);
|
131 |
|
|
//
|
132 |
|
|
// propagate
|
133 |
|
|
//
|
134 |
|
|
return p.propagate(fts,*surface);
|
135 |
|
|
}
|
136 |
|
|
}
|
137 |
|
|
|
138 |
|
|
ReferenceCountingPointer<BoundPlane>
|
139 |
|
|
TransverseImpactPointExtrapolator::tipSurface (const GlobalPoint& position,
|
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 |
|
|
}
|