9#ifndef TRKEXSOLENOIDALINTERSECTOR_SOLENOIDALINTERSECTOR_H
10#define TRKEXSOLENOIDALINTERSECTOR_SOLENOIDALINTERSECTOR_H
17#include "GaudiKernel/ContextSpecificPtr.h"
18#include "GaudiKernel/ToolHandle.h"
54 virtual std::unique_ptr<IIntersectionCache>
clone()
const override {
55 return std::unique_ptr<IIntersectionCache>(
new Constants(*
this));
66 const IInterface* parent);
70 virtual StatusCode
finalize()
override;
76 const double qOverP)
const override;
82 const double qOverP)
const override;
89 const double qOverP)
const override;
96 const double qOverP)
const override;
102 const double qOverP)
const override;
108 const double qOverP)
const override;
124 return handle.
cptr();
128 double&,
double&)
const;
130 const Constants& com,
const double radius2,
131 const double endRadius)
const;
133 Constants& com,
const double endRadius)
const;
148 this,
"SolenoidParameterizationKey",
"SolenoidParametrization",
""};
150 "Trk::RungeKuttaIntersector/RungeKuttaIntersector"};
154 2.0 * Gaudi::Units::micrometer};
164 double endRadius,
double radiusOfCurvature,
double xCentre,
double yCentre,
165 double cosPhi,
double sinPhi,
double& cosPhiIntersect,
166 double& sinPhiIntersect)
const {
168 double radiusSquared = xCentre * xCentre + yCentre * yCentre;
170 (radiusSquared + radiusOfCurvature * radiusOfCurvature -
171 endRadius * endRadius) /
172 (radiusSquared * radiusOfCurvature);
173 if (std::abs(xCentre) < std::abs(yCentre)) {
174 double dx2 = yCentre * yCentre * (1. / (radiusSquared * term * term) - 1.);
178 if (yCentre * term > 0.) {
179 sinPhiIntersect = term * (-xCentre + std::sqrt(dx2));
181 sinPhiIntersect = term * (-xCentre - std::sqrt(dx2));
184 (sinPhiIntersect * xCentre + radiusSquared * term) / yCentre;
187 double dy2 = xCentre * xCentre * (1. / (radiusSquared * term * term) - 1.);
191 if (xCentre * term > 0.) {
192 cosPhiIntersect = term * (yCentre + std::sqrt(dy2));
194 cosPhiIntersect = term * (yCentre - std::sqrt(dy2));
197 (cosPhiIntersect * yCentre - radiusSquared * term) / xCentre;
202 double sinDeltaPhi = sinPhiIntersect * cosPhi - cosPhiIntersect * sinPhi;
203 if (std::abs(sinDeltaPhi) > 0.1) {
206 deltaPhi = sinDeltaPhi * (1. + 0.166667 * sinDeltaPhi * sinDeltaPhi);
208 return (radiusOfCurvature *
deltaPhi);
210 cosPhiIntersect = cosPhi;
211 sinPhiIntersect = sinPhi;
221 const double radius2,
const double endRadius)
const {
227 double radiusSquared =
228 endRadius * endRadius - radius2 + arcLength * arcLength;
229 if (radiusSquared > 0.) {
230 if (endRadius > 0.) {
231 arcLength += std::sqrt(radiusSquared);
233 arcLength -= std::sqrt(radiusSquared);
241 const Surface& surface)
const {
245 isect.position(), isect.direction(),
false,
false);
246 if (SLIntersect.
valid) {
250 isect.position() = SLIntersect.
position;
251 return std::move(isect);
Scalar deltaPhi(const MatrixBase< Derived > &vec) const
Define macros for attributes used to control the static checker.
const_pointer_type cptr()
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.
SG::ReadCondHandleKey< SolenoidParametrization > m_solenoidParametrizationKey
virtual std::optional< TrackSurfaceIntersection > intersectDiscSurface(const DiscSurface &surface, const TrackSurfaceIntersection &trackTrackSurfaceIntersection, const double qOverP) const override
IIntersector interface method for specific Surface type : DiscSurface.
std::optional< TrackSurfaceIntersection > intersection(TrackSurfaceIntersection &&isect, Constants &com, const Surface &surface) const
virtual std::optional< TrackSurfaceIntersection > approachPerigeeSurface(const PerigeeSurface &surface, const TrackSurfaceIntersection &trackTrackSurfaceIntersection, const double qOverP) const override
IIntersector interface method for specific Surface type : PerigeeSurface.
ToolHandle< IIntersector > m_rungeKuttaIntersector
static bool extrapolateToZ(TrackSurfaceIntersection &isect, Constants &com, const double endZ)
static constexpr double m_deltaPhiTolerance
virtual StatusCode finalize() override
virtual std::optional< TrackSurfaceIntersection > intersectSurface(const Surface &surface, const TrackSurfaceIntersection &trackTrackSurfaceIntersection, const double qOverP) const override
IIntersector interface method for general Surface type.
virtual bool isValid(Amg::Vector3D startPosition, Amg::Vector3D endPosition) const override
IIntersector interface method to check validity of parametrization within extrapolation range.
static std::optional< TrackSurfaceIntersection > newIntersection(const TrackSurfaceIntersection &oldIsect, const SolenoidParametrization &solpar, const double qOverP, Constants *&com)
void throwMissingCondData() const
virtual std::optional< TrackSurfaceIntersection > intersectPlaneSurface(const PlaneSurface &surface, const TrackSurfaceIntersection &trackTrackSurfaceIntersection, const double qOverP) const override
IIntersector interface method for specific Surface type : PlaneSurface.
virtual StatusCode initialize() override
bool extrapolateToR(TrackSurfaceIntersection &isect, double &radius2, Constants &com, const double endRadius) const
DoubleProperty m_surfaceTolerance
virtual std::optional< TrackSurfaceIntersection > approachStraightLineSurface(const StraightLineSurface &surface, const TrackSurfaceIntersection &trackTrackSurfaceIntersection, const double qOverP) const override
IIntersector interface method for specific Surface type : StraightLineSurface.
double linearArcLength(const TrackSurfaceIntersection &isect, const Constants &com, const double radius2, const double endRadius) const
std::atomic< unsigned long long > m_countExtrapolations
virtual std::optional< TrackSurfaceIntersection > intersectCylinderSurface(const CylinderSurface &surface, const TrackSurfaceIntersection &trackTrackSurfaceIntersection, const double qOverP) const override
IIntersector interface method for specific Surface type : CylinderSurface.
const SolenoidParametrization * getSolenoidParametrization() const
double circularArcLength(double, double, double, double, double, double, double &, double &) const
std::atomic< unsigned long long > m_countRKSwitches
virtual ~SolenoidalIntersector()=default
SolenoidalIntersector(const std::string &type, const std::string &name, const IInterface *parent)
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
Base class for cache block.
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.
Constants of motion and other cached values.
virtual std::unique_ptr< IIntersectionCache > clone() const override
Constants(const SolenoidParametrization &solpar, const TrackSurfaceIntersection &trackTrackSurfaceIntersection, const double qOverP)
const SolenoidParametrization & m_solPar
SolenoidParametrization::Parameters m_solParams
Amg::Vector3D m_lastPosition