10#ifndef TRKEXRUNGEKUTTAINTERSECTOR_RUNGEKUTTAINTERSECTOR_H
11#define TRKEXRUNGEKUTTAINTERSECTOR_RUNGEKUTTAINTERSECTOR_H
17#include "GaudiKernel/PhysicalConstants.h"
18#include "GaudiKernel/ToolHandle.h"
32 const IInterface* parent);
36 virtual StatusCode
finalize()
override;
41 const double qOverP)
const override;
47 const double qOverP)
const override;
54 const double qOverP)
const override;
61 const double qOverP)
const override;
67 const double qOverP)
const override;
73 const double qOverP)
const override;
85 double& stepLength)
const;
88 const double rStart,
const double zStart,
89 const bool trapped)
const;
91 const double cylinderRadius,
92 const double offsetRadius,
94 double& stepLength)
const;
96 const double discZ,
double& stepLength)
const;
101 double& stepLength)
const;
106 double& stepLength)
const;
115 const double qOverP,
const double rStart,
const double zStart)
const;
119 const double qOverP)
const;
122 double& stepLength,
const double qOverP,
126 this,
"AtlasFieldCacheCondObj",
"fieldCondObj",
127 "Name of the Magnetic Field conditions object key"};
223 double& stepLength)
const {
226 double sinThsqinv = 1. / dir.perp2();
227 stepLength = (offset.x() * dir.x() + offset.y() * dir.y()) * sinThsqinv;
228 double deltaRSq = (cylinderRadius - offsetRadius) *
229 (cylinderRadius + offsetRadius) * sinThsqinv +
230 stepLength * stepLength;
232 stepLength += sqrt(deltaRSq);
233 return std::abs(stepLength);
238 double& stepLength)
const {
242 double distance = discZ - pos.z();
243 stepLength = distance / dir.z();
244 return std::abs(distance);
249 const Amg::Vector3D& lineDirection,
double& stepLength)
const {
260 double cosAngle = lineDirection.dot(dir);
261 stepLength = (linePosition - pos).
dot(dir - lineDirection * cosAngle) /
262 (1. - cosAngle * cosAngle);
263 return std::abs(stepLength);
268 const Amg::Vector3D& planeNormal,
double& stepLength)
const {
275 double distance = planeNormal.dot(planePosition - pos);
276 stepLength = distance / planeNormal.dot(dir);
277 return std::abs(distance);
285 ATH_MSG_FATAL(
"Failed to get magnetic field conditions data "
288 fieldCondObj->getInitializedCache(fieldCache);
295 fieldCache.
getField(position.data(), fieldValue.data());
301 const double qOverP,
const double rStart,
const double zStart)
const {
304 isect.position(), isect.direction(),
false,
false);
305 if (SLIntersect.
valid) {
306 isect.position() = SLIntersect.
position;
307 return std::move(isect);
311 if (msgLvl(MSG::DEBUG)){
Local cache for magnetic field (based on MagFieldServices/AtlasFieldSvcTLS.h)
void getField(const double *ATH_RESTRICT xyz, double *ATH_RESTRICT bxyz, double *ATH_RESTRICT deriv=nullptr)
get B field value at given position xyz[3] is in mm, bxyz[3] is in kT if deriv[9] is given,...
Class for a CylinderSurface in the ATLAS detector.
Class for a DiscSurface in the ATLAS detector.
Class describing the Line to which the Perigee refers to.
Class for a planaer rectangular or trapezoidal surface in the ATLAS detector.
BooleanProperty m_productionMode
virtual std::optional< TrackSurfaceIntersection > intersectDiscSurface(const DiscSurface &surface, const TrackSurfaceIntersection &trackIntersection, const double qOverP) const override
IIntersector interface method for specific Surface type : DiscSurface.
virtual ~RungeKuttaIntersector()=default
virtual StatusCode initialize() override
const double m_shortStepMin
std::optional< TrackSurfaceIntersection > newIntersection(TrackSurfaceIntersection &&isect, const Surface &surface, const double qOverP, const double rStart, const double zStart) const
virtual bool isValid(Amg::Vector3D, Amg::Vector3D) const override
IIntersector interface method for validity check over a particular extrapolation range.
const double m_momentumWarnThreshold
virtual std::optional< TrackSurfaceIntersection > approachPerigeeSurface(const PerigeeSurface &surface, const TrackSurfaceIntersection &trackIntersection, const double qOverP) const override
IIntersector interface method for specific Surface type : PerigeeSurface.
void debugFailure(TrackSurfaceIntersection &&isect, const Surface &surface, const double qOverP, const double rStart, const double zStart, const bool trapped) const
SG::ReadCondHandleKey< AtlasFieldCacheCondObj > m_fieldCacheCondObjInputKey
void step(TrackSurfaceIntersection &isect, Amg::Vector3D &fieldValue, double &stepLength, const double qOverP, MagField::AtlasFieldCache &fieldCache) const
void assignStepLength(const TrackSurfaceIntersection &isect, double &stepLength) const
double distanceToPlane(const TrackSurfaceIntersection &isect, const Amg::Vector3D &planePosition, const Amg::Vector3D &planeNormal, double &stepLength) const
std::atomic< unsigned long long > m_countStepReduction
double distanceToLine(const TrackSurfaceIntersection &isect, const Amg::Vector3D &linePosition, const Amg::Vector3D &lineDirection, double &stepLength) const
std::atomic< unsigned long long > m_countStep
virtual std::optional< TrackSurfaceIntersection > approachStraightLineSurface(const StraightLineSurface &surface, const TrackSurfaceIntersection &trackIntersection, const double qOverP) const override
IIntersector interface method for specific Surface type : StraightLineSurface.
RungeKuttaIntersector(const std::string &type, const std::string &name, const IInterface *parent)
double distanceToCylinder(const TrackSurfaceIntersection &isect, const double cylinderRadius, const double offsetRadius, const Amg::Vector3D &offset, double &stepLength) const
double distanceToDisc(const TrackSurfaceIntersection &isect, const double discZ, double &stepLength) const
std::atomic< unsigned long long > m_countExtrapolations
virtual std::optional< TrackSurfaceIntersection > intersectPlaneSurface(const PlaneSurface &surface, const TrackSurfaceIntersection &trackIntersection, const double qOverP) const override
IIntersector interface method for specific Surface type : PlaneSurface.
virtual std::optional< TrackSurfaceIntersection > intersectSurface(const Surface &surface, const TrackSurfaceIntersection &trackIntersection, const double qOverP) const override
IIntersector interface method for general Surface type.
void initializeFieldCache(MagField::AtlasFieldCache &fieldCache) const
std::atomic< unsigned long long > m_countShortStep
virtual std::optional< TrackSurfaceIntersection > intersectCylinderSurface(const CylinderSurface &surface, const TrackSurfaceIntersection &trackIntersection, const double qOverP) const override
IIntersector interface method for specific Surface type : CylinderSurface.
const double m_momentumThreshold
virtual StatusCode finalize() override
void shortStep(TrackSurfaceIntersection &isect, const Amg::Vector3D &fieldValue, const double stepLength, const double qOverP) const
Amg::Vector3D field(const Amg::Vector3D &point, MagField::AtlasFieldCache &fieldCache) const
Class for a StraightLineSurface in the ATLAS detector to describe dirft tube and straw like detectors...
Abstract Base Class for tracking surfaces.
Intersection straightLineIntersection(const T &pars, bool forceDir=false, const Trk::BoundaryCheck &bchk=false) const
fst straight line intersection schema - templated for charged and neutral parameters
An intersection with a Surface is given by.
const Amg::Vector3D & direction() const
Method to retrieve the direction at the Intersection.
const Amg::Vector3D & position() const
Method to retrieve the position of the Intersection.
Eigen::Matrix< double, 3, 1 > Vector3D
Ensure that the ATLAS eigen extensions are properly loaded.