ATLAS Offline Software
Loading...
Searching...
No Matches
StraightLineIntersector.cxx
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#include <cmath>
12#include "CLHEP/Units/SystemOfUnits.h"
21#include "TrkSurfaces/Surface.h"
22
23namespace Trk
24{
25
27 const std::string& name,
28 const IInterface* parent)
29 : base_class (type, name, parent),
31{
32}
33
34StatusCode
36{
37 ATH_MSG_DEBUG( "finalized after " << m_countExtrapolations << " extrapolations" );
38 return StatusCode::SUCCESS;
39}
40
42std::optional<Trk::TrackSurfaceIntersection>
44 const TrackSurfaceIntersection& trackIntersection,
45 const double qOverP) const
46{
47
48 const auto surfaceType = surface.type();
49 if (surfaceType == Trk::SurfaceType::Plane) {
50 return intersectPlaneSurface(static_cast<const PlaneSurface&>(surface),
51 trackIntersection, qOverP);
52 }
53 if (surfaceType == Trk::SurfaceType::Line) {
55 static_cast<const StraightLineSurface&>(surface), trackIntersection,
56 qOverP);
57 }
58 if (surfaceType == Trk::SurfaceType::Cylinder) {
60 static_cast<const CylinderSurface&>(surface), trackIntersection,
61 qOverP);
62 }
63 if (surfaceType == Trk::SurfaceType::Disc) {
64 return intersectDiscSurface(static_cast<const DiscSurface&>(surface),
65 trackIntersection, qOverP);
66 }
67 if (surfaceType == Trk::SurfaceType::Perigee) {
68 return approachPerigeeSurface(static_cast<const PerigeeSurface&>(surface),
69 trackIntersection, qOverP);
70 }
71
72 ATH_MSG_WARNING( " unrecognized Surface" );
73 return std::nullopt;
74}
75
77std::optional<Trk::TrackSurfaceIntersection>
79 const TrackSurfaceIntersection& trackIntersection,
80 const double /*qOverP*/) const
81{
82 TrackSurfaceIntersection isect = trackIntersection;
84
85 // straight line distance along track to closest approach to line
86 const Amg::Vector3D& lineDirection = surface.transform().rotation().col(2);
87 double stepLength = distanceToLine (isect, surface.center(),lineDirection);
88 step(isect, stepLength);
89
90 return isect;
91}
92
94std::optional<Trk::TrackSurfaceIntersection>
96 const TrackSurfaceIntersection& trackIntersection,
97 const double /*qOverP*/) const
98{
99 TrackSurfaceIntersection isect = trackIntersection;
101
102 // straight line distance along track to closest approach to line
103 const Amg::Vector3D& lineDirection = surface.transform().rotation().col(2);
104 double stepLength = distanceToLine (isect, surface.center(),lineDirection);
105 step(isect, stepLength);
106
107 return isect;
108}
109
111std::optional<Trk::TrackSurfaceIntersection>
113 const TrackSurfaceIntersection& trackIntersection,
114 const double /*qOverP*/) const
115{
116 TrackSurfaceIntersection isect = trackIntersection;
118
119 // calculate straight line distance along track to intersect with cylinder radius
120 double cylinderRadius = surface.globalReferencePoint().perp();
121 double stepLength = distanceToCylinder(isect, cylinderRadius);
122 step(isect, stepLength);
123
124 return isect;
125}
126
128std::optional<Trk::TrackSurfaceIntersection>
130 const TrackSurfaceIntersection& trackIntersection,
131 const double /*qOverP*/) const
132{
133 TrackSurfaceIntersection isect = trackIntersection;
135
136 // straight line distance along track to intersect with disc
137 double stepLength = distanceToDisc(isect, surface.center().z());
138 step(isect, stepLength);
139
140 return isect;
141}
142
144std::optional<Trk::TrackSurfaceIntersection>
146 const TrackSurfaceIntersection& trackIntersection,
147 const double /*qOverP*/) const
148{
149 TrackSurfaceIntersection isect = trackIntersection;
151
152 // straight line distance along track to intersect with plane
153 double stepLength = distanceToPlane (isect, surface.center(),surface.normal());
154 step(isect, stepLength);
155 stepLength = distanceToPlane (isect, surface.center(),surface.normal());
156
157 return isect;
158}
159
160} // end of namespace
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
Class for a CylinderSurface in the ATLAS detector.
virtual const Amg::Vector3D & globalReferencePoint() const override final
Returns a global reference point: For the Cylinder this is Where denotes the averagePhi() of the cy...
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 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.
virtual const Amg::Vector3D & normal() const
Returns the normal vector of the Surface (i.e.
const Amg::Transform3D & transform() const
Returns HepGeom::Transform3D by reference.
virtual constexpr SurfaceType type() const =0
Returns the Surface type to avoid dynamic casts.
const Amg::Vector3D & center() const
Returns the center position of the Surface.
An intersection with a Surface is given by.
Eigen::Matrix< double, 3, 1 > Vector3D
Ensure that the ATLAS eigen extensions are properly loaded.
@ qOverP
perigee
Definition ParamDefs.h:67