26 double& previousDistance,
27 unsigned long long& stepsUntilTrapped)
34 if (stepsUntilTrapped <= 0) {
51 const std::string&
name,
75 return StatusCode::SUCCESS;
85 msg(MSG::INFO) << std::setiosflags(std::ios::fixed)
86 <<
" taking an average" << std::setw(7) << std::setprecision(1)
88 <<
" full steps," << std::setw(5) << std::setprecision(2)
90 <<
" step reductions and" << std::setw(5) << std::setprecision(2)
92 <<
" short final steps";
96 return StatusCode::SUCCESS;
100 std::optional<Trk::TrackSurfaceIntersection>
103 const double qOverP)
const
112 const auto surfaceType = surface.
type();
115 trackIntersection,
qOverP);
129 trackIntersection,
qOverP);
133 trackIntersection,
qOverP);
141 std::optional<Trk::TrackSurfaceIntersection>
144 const double qOverP)
const
149 const double rStart =
pos.perp();
150 const double zStart =
pos.z();
157 double stepLength = 0;
160 double previousDistance = 1.1*
distance;
165 if (isTrapped(
distance, previousDistance, stepsUntilTrapped)) {
168 rStart, zStart,
true);
183 std::optional<Trk::TrackSurfaceIntersection>
186 const double qOverP)
const
191 const double rStart =
pos.perp();
192 const double zStart =
pos.z();
199 double stepLength = 0;
202 double previousDistance = 1.1*
distance;
207 if (isTrapped(
distance, previousDistance, stepsUntilTrapped)) {
210 rStart, zStart,
true);
225 std::optional<Trk::TrackSurfaceIntersection>
228 const double qOverP)
const
233 const double rStart =
pos.perp();
234 const double zStart =
pos.z();
242 double rCurrent =
offset.perp();
243 double stepLength = 0;
246 double previousDistance = 1.1*
distance;
247 bool trapped =
false;
252 if (isTrapped(
distance, previousDistance, stepsUntilTrapped)) {
257 double rPrevious= rCurrent;
261 double deltaR1 = rCurrent - rPrevious;
262 double deltaR2 = cylinderRadius - rCurrent;
292 rStart, zStart,
true);
297 std::optional<Trk::TrackSurfaceIntersection>
300 const double qOverP)
const
305 const double rStart =
pos.perp();
306 const double zStart =
pos.z();
312 double stepLength = 0;
315 double previousDistance = 1.1*
distance;
320 if (isTrapped(
distance, previousDistance, stepsUntilTrapped)) {
323 rStart, zStart,
true);
338 std::optional<Trk::TrackSurfaceIntersection>
341 const double qOverP)
const
346 const double rStart =
pos.perp();
347 const double zStart =
pos.z();
353 double stepLength = 0;
356 double previousDistance = 1.1*
distance;
361 if (isTrapped(
distance, previousDistance, stepsUntilTrapped)) {
364 rStart, zStart,
true);
383 double& stepLength)
const
386 const double sinTheta = isect.
direction().perp();
391 const double zCurrent = std::abs(
pos.z());
392 const double rCurrent =
pos.perp();
406 }
else if (zCurrent >
m_inDetZ2 || sinTheta < 0.35) {
412 else if (zCurrent >
m_inDetZ1 && sinTheta < 0.60) {
435 else if (rCurrent < 1000.)
437 if (zCurrent > 700.) {
444 else if (zCurrent > 420. && sinTheta < 0.60) {
449 if (rCurrent > 900.) {
460 if (zCurrent < 3000.)
491 }
else if (
radius < 5300.) {
499 else if (
phi > 0.04 ||
550 }
else if (zCurrent < m_toroidZ0 || zCurrent >
m_toroidZ1 ||
575 if (std::abs(stepLength) < stepMax)
577 if (stepLength > 0.) {
578 stepLength = stepMax;
580 stepLength = -stepMax;
590 const bool trapped)
const
596 const double sinTheta = isect.direction().perp();
599 const double rCurrent = isect.position().perp();
602 if (rCurrent > rStart)
604 log <<
MSG::DEBUG << std::setiosflags(std::ios::fixed|std::ios::right)
605 <<
" fail to intersect surface when extrapolating outwards from R,Z"
606 << std::setw(8) << std::setprecision(1) << rStart <<
","
607 << std::setw(7) << std::setprecision(0) << zStart <<
" mm, with pt"
608 << std::setw(7) << std::setprecision(2) <<
pt <<
" GeV, direction eta"
609 << std::setw(5) << std::setprecision(2) << isect.direction().eta();
613 log <<
MSG::DEBUG << std::setiosflags(std::ios::fixed|std::ios::right)
614 <<
" fail to intersect surface when extrapolating inwards from R,Z"
615 << std::setw(8) << std::setprecision(1) << rStart <<
","
616 << std::setw(7) << std::setprecision(0) << zStart <<
" mm, with pt"
617 << std::setw(7) << std::setprecision(2) <<
pt <<
" GeV, direction eta"
618 << std::setw(5) << std::setprecision(2) << isect.direction().eta();
625 double stepLength = 0;
627 log <<
MSG::DEBUG << std::setiosflags(std::ios::fixed|std::ios::right) <<
" PlaneSurface"
628 <<
" at R,Z" << std::setw(8) << std::setprecision(1) << surface.
center().perp() <<
","
629 << std::setw(7) << std::setprecision(0) << surface.
center().z()
630 <<
" at line distance " << std::setw(9) << std::setprecision(1) << stepLength;
638 double rCurrent =
offset.perp();
639 double stepLength = 0;
643 log <<
MSG::DEBUG << std::setiosflags(std::ios::fixed|std::ios::right)
644 <<
" closest approach to CylinderSurface at radius "
645 << std::setw(9) << std::setprecision(4) << rCurrent
646 <<
" mm. Cylinder radius " << std::setw(9) << std::setprecision(4) << cylinderRadius <<
" mm"
651 log <<
MSG::DEBUG << std::setiosflags(std::ios::fixed|std::ios::right) <<
" CylinderSurface"
652 <<
" radius " << std::setw(6) << std::setprecision(1) << cylinderRadius
653 <<
" rCurrent " << std::setw(6) << std::setprecision(1) << rCurrent
654 <<
" distance " << std::setw(6) << std::setprecision(1) << stepLength;
659 else if (
dynamic_cast<const DiscSurface*
>(&surface))
661 double stepLength = 0;
663 log <<
MSG::DEBUG << std::setiosflags(std::ios::fixed|std::ios::right) <<
" DiscSurface"
664 <<
" at R,Z" << std::setw(8) << std::setprecision(1) << surface.
center().perp() <<
","
665 << std::setw(7) << std::setprecision(0) << surface.
center().z()
666 <<
" at line distance " << std::setw(9) << std::setprecision(1) << stepLength;
672 log <<
MSG::DEBUG << std::setiosflags(std::ios::fixed|std::ios::right) <<
" PerigeeSurface "
677 log <<
MSG::DEBUG << std::setiosflags(std::ios::fixed|std::ios::right) <<
" StraightLineSurface "
686 const double stepLength,
687 const double qOverP)
const
694 double stepOverP = 0.5*stepLength*cOverP;
702 pos += stepLength*(
dir +
m_third*(product0+product1+product2));
705 dir +=
m_third*(product0+product3 + 2.*(product1+product2));
721 double stepOverP = 0.5*stepLength*cOverP;
728 Amg::Vector3D product1 = stepOverP*direction1.cross(fieldValue1);
730 Amg::Vector3D product2 = stepOverP*direction2.cross(fieldValue1);
737 if ((fieldValue1 - 0.5 * (
fieldValue + fieldAtEnd)).
mag() > 0.00001 &&
739 if (stepLength > 0.) {
745 stepOverP = 0.5 * stepLength * cOverP;
749 pos + 0.5 * stepLength * (
dir + 0.5 * product0);
752 product1 = stepOverP * direction1p.cross(fieldValue1p);
754 product2 = stepOverP * direction2p.cross(fieldValue1p);
757 stepLength * (
dir +
m_third * (product0 + product1 + product2));
758 fieldAtEnd =
field(
pos + offsetAtEnd, fieldCache);
762 Amg::Vector3D product3 = stepOverP * direction3.cross(fieldAtEnd);
763 dir +=
m_third * (product0 + product3 + 2. * (product1 + product2));