9 #include "GaudiKernel/SystemOfUnits.h"
25 : m_sinTheta (trackTrackSurfaceIntersection.direction().
perp()),
26 m_oneOverSinTheta (1./m_sinTheta),
27 m_cotTheta (trackTrackSurfaceIntersection.direction().
z() * m_oneOverSinTheta),
28 m_qOverPt (
qOverP * m_oneOverSinTheta),
30 m_lastPosition (trackTrackSurfaceIntersection.position()),
32 trackTrackSurfaceIntersection.position().
perp(),
33 trackTrackSurfaceIntersection.position().
z(),
39 const std::string&
name,
48 return StatusCode::SUCCESS;
57 return StatusCode::SUCCESS;
62 std::optional<Trk::TrackSurfaceIntersection>
68 const auto surfaceType = surface.
type();
71 trackIntersection,
qOverP);
85 trackIntersection,
qOverP);
98 std::optional<Trk::TrackSurfaceIntersection>
101 const double qOverP)
const
105 std::optional<Trk::TrackSurfaceIntersection>
108 const double qOverP)
const
112 std::optional<Trk::TrackSurfaceIntersection>
115 const double qOverP)
const
121 if (!solenoidParametrization || endRadius > solenoidParametrization->
maximumR())
126 trackIntersection, *solenoidParametrization,
qOverP, com);
129 double radius2 = isect->position().perp2();
131 && !
extrapolateToR(*isect, radius2, *com, endRadius))
return std::nullopt;
137 std::optional<Trk::TrackSurfaceIntersection>
140 const double qOverP)
const
145 double endZ = surface.
center().z();
146 if (!solenoidParametrization || std::abs(endZ) > solenoidParametrization->
maximumZ())
150 std::optional<TrackSurfaceIntersection> isect =
152 *solenoidParametrization,
168 std::optional<Trk::TrackSurfaceIntersection>
171 const double qOverP)
const
176 if (!solenoidParametrization ||
177 std::abs(surface.
center().z()) > solenoidParametrization->
maximumZ()
182 std::optional<TrackSurfaceIntersection> isect =
184 *solenoidParametrization,
190 double radius2 =
pos.perp2();
204 if (std::abs(
dot) < 0.0001)
212 radius2 =
pos.perp2();
224 (++numberSteps > 5 ||
228 << numberSteps <<
" steps at offset " <<
offset
229 <<
" dot " << surface.
normal().dot(
dir));
232 surface, trackIntersection,
qOverP);
248 return solenoidParametrization &&
250 std::abs(endPosition.z()) < solenoidParametrization->
maximumZ()
252 && endPosition.perp() < solenoidParametrization->
maximumR()
264 const double endR)
const
269 double fieldComponent =
271 double curvature = fieldComponent * com.
m_qOverPt;
274 double radiusOfCurvature = 1. / curvature;
286 pos.x() = xCentre + radiusOfCurvature * sinPhi;
287 pos.y() = yCentre - radiusOfCurvature * cosPhi;
289 radius2 = endR * endR;
304 double sinDPhi = 0.5 * arcLength * curvature;
306 1. - 0.5 * sinDPhi * sinDPhi * (1.0 + 0.25 * sinDPhi * sinDPhi);
307 double temp = cosPhi;
308 cosPhi =
temp * cosDPhi - sinPhi * sinDPhi;
309 sinPhi =
temp * sinDPhi + sinPhi * cosDPhi;
310 dir.x() = (cosPhi * cosDPhi - sinPhi * sinDPhi) * com.
m_sinTheta;
311 dir.y() = (sinPhi * cosDPhi + cosPhi * sinDPhi) * com.
m_sinTheta;
314 pos.x() += arcLength * cosPhi;
315 pos.y() += arcLength * sinPhi;
317 radius2 = endR * endR;
321 radius2 =
pos.perp2();
325 radius2 =
pos.perp2();
340 double firstIntegral = 0.;
341 double secondIntegral = 0.;
353 sinBeta = 1. - 0.166667 * deltaPhi2Squared;
354 cosBeta = -0.5 *
deltaPhi2 * (1. - 0.083333 * deltaPhi2Squared);
363 pos.x() += radialDistance * (sinPhi * cosBeta + cosPhi * sinBeta);
364 pos.y() += radialDistance * (sinPhi * sinBeta - cosPhi * cosBeta);
373 sinAlpha =
deltaPhi1 * (1. - 0.166667 * deltaPhi1Squared);
375 1. - 0.5 * deltaPhi1Squared * (1. - 0.083333 * deltaPhi1Squared);
380 dir.x() = (cosPhi * cosAlpha - sinPhi * sinAlpha) * com.
m_sinTheta;
381 dir.y() = (sinPhi * cosAlpha + cosPhi * sinAlpha) * com.
m_sinTheta;
385 std::optional<TrackSurfaceIntersection>
392 std::unique_ptr<Constants> cache;
394 lastPosition.setZero();
397 assert(
typeid(*oldCache) ==
typeid(
Constants));
399 std::make_unique<Constants>(*
static_cast<const Constants*
>(oldCache));
402 cache = std::make_unique<Constants>(solpar, isect,
qOverP);
407 std::make_optional<TrackSurfaceIntersection>(isect, std::move(cache));
409 newIsect->position() = lastPosition;
415 std::stringstream
msg;
417 throw std::logic_error(
msg.str());