ATLAS Offline Software
Loading...
Searching...
No Matches
StraightLineIntersector.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
6// provide straight line intersection to a surface
7// (useful for abstract interfaces in track/segment fitters)
8// (c) ATLAS Tracking software
10
11#ifndef TRKEXSTRAIGHTLINEINTERSECTOR_STRAIGHTLINEINTERSECTOR_H
12#define TRKEXSTRAIGHTLINEINTERSECTOR_STRAIGHTLINEINTERSECTOR_H
13
14#include <atomic>
15
19
20namespace Trk {
21
22class StraightLineIntersector final: public extends<AthAlgTool, IIntersector> {
23
24 public:
25 StraightLineIntersector(const std::string& type, const std::string& name,
26 const IInterface* parent);
27
28 virtual StatusCode finalize() override;
29
31 virtual std::optional<TrackSurfaceIntersection> intersectSurface(
32 const Surface& surface,
33 const TrackSurfaceIntersection& trackTrackSurfaceIntersection,
34 const double qOverP) const override;
35
37 virtual std::optional<TrackSurfaceIntersection> approachPerigeeSurface(
38 const PerigeeSurface& surface,
39 const TrackSurfaceIntersection& trackTrackSurfaceIntersection,
40 const double /*qOverP*/) const override;
41
44 virtual std::optional<TrackSurfaceIntersection> approachStraightLineSurface(
45 const StraightLineSurface& surface,
46 const TrackSurfaceIntersection& trackTrackSurfaceIntersection,
47 const double /*qOverP*/) const override;
48
51 virtual std::optional<TrackSurfaceIntersection> intersectCylinderSurface(
52 const CylinderSurface& surface,
53 const TrackSurfaceIntersection& trackTrackSurfaceIntersection,
54 const double /*qOverP*/) const override;
55
57 virtual std::optional<TrackSurfaceIntersection> intersectDiscSurface(
58 const DiscSurface& surface,
59 const TrackSurfaceIntersection& trackTrackSurfaceIntersection,
60 const double /*qOverP*/) const override;
61
63 virtual std::optional<TrackSurfaceIntersection> intersectPlaneSurface(
64 const PlaneSurface& surface,
65 const TrackSurfaceIntersection& trackTrackSurfaceIntersection,
66 const double /*qOverP*/) const override;
67
70 virtual bool isValid(Amg::Vector3D /*startPosition*/,
71 Amg::Vector3D /*endPosition*/) const override {
72 return true;
73 }
74
75 private:
76 // private methods
78 const double cylinderRadius) const;
79 double distanceToDisc(const TrackSurfaceIntersection& isect,
80 const double discZ) const;
81 double distanceToLine(const TrackSurfaceIntersection& isect,
82 const Amg::Vector3D& linePosition,
83 const Amg::Vector3D& lineDirection) const;
84 double distanceToPlane(const TrackSurfaceIntersection& isect,
85 const Amg::Vector3D& planePosition,
86 const Amg::Vector3D& planeNormal) const;
87 void step(TrackSurfaceIntersection& isect, double stepLength) const;
88
89 // counters
90 mutable std::atomic<unsigned long long> m_countExtrapolations;
91};
92
93//<<<<<< INLINE PRIVATE MEMBER FUNCTIONS >>>>>>
94
96 const TrackSurfaceIntersection& isect, const double cylinderRadius) const {
97 const Amg::Vector3D& pos = isect.position();
98 const Amg::Vector3D& dir = isect.direction();
99 double sinThsqinv = 1. / dir.perp2();
100 double stepLength = (-pos.x() * dir.x() - pos.y() * dir.y()) * sinThsqinv;
101 double deltaRSq =
102 (cylinderRadius * cylinderRadius - pos.perp2()) * sinThsqinv +
103 stepLength * stepLength;
104 if (deltaRSq > 0.)
105 stepLength += sqrt(deltaRSq);
106 return stepLength;
107}
108
110 const TrackSurfaceIntersection& isect, const double discZ) const {
111 const Amg::Vector3D& pos = isect.position();
112 const Amg::Vector3D& dir = isect.direction();
113 return (discZ - pos.z()) / dir.z();
114}
115
117 const TrackSurfaceIntersection& isect, const Amg::Vector3D& linePosition,
118 const Amg::Vector3D& lineDirection) const {
119 // offset joining track to line is given by
120 // offset = linePosition + a*lineDirection - trackPosition -
121 // b*trackDirection
122 //
123 // offset is perpendicular to both line and track at solution i.e.
124 // lineDirection.dot(offset) = 0
125 // trackDirection.dot(offset) = 0
126 const Amg::Vector3D& pos = isect.position();
127 const Amg::Vector3D& dir = isect.direction();
128 double cosAngle = lineDirection.dot(dir);
129 return (linePosition - pos).dot(dir - lineDirection * cosAngle) /
130 (1. - cosAngle * cosAngle);
131}
132
134 const TrackSurfaceIntersection& isect, const Amg::Vector3D& planePosition,
135 const Amg::Vector3D& planeNormal) const {
136 // take the normal component of the offset from track position to plane
137 // position this is equal to the normal component of the required distance
138 // along the track direction
139 const Amg::Vector3D& pos = isect.position();
140 const Amg::Vector3D& dir = isect.direction();
141 return planeNormal.dot(planePosition - pos) / planeNormal.dot(dir);
142}
143
145 double stepLength) const {
146 isect.position() += stepLength * isect.direction();
147 isect.pathlength() += stepLength;
148}
149
150} // namespace Trk
151
152#endif // TRKEXSTRAIGHTLINEINTERSECTOR_STRAIGHTLINEINTERSECTOR_H
Class for a CylinderSurface in the ATLAS detector.
Class for a DiscSurface in the ATLAS detector.
Definition DiscSurface.h:54
Class describing the Line to which the Perigee refers to.
Class for a planaer rectangular or trapezoidal surface in the ATLAS detector.
virtual std::optional< TrackSurfaceIntersection > approachStraightLineSurface(const StraightLineSurface &surface, const TrackSurfaceIntersection &trackTrackSurfaceIntersection, const double) const override
IIntersector interface method for specific Surface type : StraightLineSurface.
double distanceToDisc(const TrackSurfaceIntersection &isect, const double discZ) const
double distanceToPlane(const TrackSurfaceIntersection &isect, const Amg::Vector3D &planePosition, const Amg::Vector3D &planeNormal) const
virtual bool isValid(Amg::Vector3D, Amg::Vector3D) const override
IIntersector interface method for validity check over a particular extrapolation range.
virtual std::optional< TrackSurfaceIntersection > approachPerigeeSurface(const PerigeeSurface &surface, const TrackSurfaceIntersection &trackTrackSurfaceIntersection, const double) const override
IIntersector interface method for specific Surface type : PerigeeSurface.
virtual std::optional< TrackSurfaceIntersection > intersectPlaneSurface(const PlaneSurface &surface, const TrackSurfaceIntersection &trackTrackSurfaceIntersection, const double) const override
IIntersector interface method for specific Surface type : PlaneSurface.
std::atomic< unsigned long long > m_countExtrapolations
virtual std::optional< TrackSurfaceIntersection > intersectSurface(const Surface &surface, const TrackSurfaceIntersection &trackTrackSurfaceIntersection, const double qOverP) const override
IIntersector interface method for general Surface type.
void step(TrackSurfaceIntersection &isect, double stepLength) const
double distanceToLine(const TrackSurfaceIntersection &isect, const Amg::Vector3D &linePosition, const Amg::Vector3D &lineDirection) const
double distanceToCylinder(const TrackSurfaceIntersection &isect, const double cylinderRadius) const
StraightLineIntersector(const std::string &type, const std::string &name, const IInterface *parent)
virtual std::optional< TrackSurfaceIntersection > intersectCylinderSurface(const CylinderSurface &surface, const TrackSurfaceIntersection &trackTrackSurfaceIntersection, const double) const override
IIntersector interface method for specific Surface type : CylinderSurface.
virtual StatusCode finalize() override
virtual std::optional< TrackSurfaceIntersection > intersectDiscSurface(const DiscSurface &surface, const TrackSurfaceIntersection &trackTrackSurfaceIntersection, const double) const override
IIntersector interface method for specific Surface type : DiscSurface.
Class for a StraightLineSurface in the ATLAS detector to describe dirft tube and straw like detectors...
Abstract Base Class for tracking surfaces.
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.
double pathlength() const
Method to retrieve the pathlength propagated till the Intersection.
Eigen::Matrix< double, 3, 1 > Vector3D
Ensure that the ATLAS eigen extensions are properly loaded.
@ qOverP
perigee
Definition ParamDefs.h:67