forked from sPHENIX-Collaboration/acts
/
ConeSurface.hpp
256 lines (225 loc) · 10.4 KB
/
ConeSurface.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
// This file is part of the Acts project.
//
// Copyright (C) 2016-2020 CERN for the benefit of the Acts project
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#pragma once
#include "Acts/Geometry/GeometryContext.hpp"
#include "Acts/Geometry/Polyhedron.hpp"
#include "Acts/Surfaces/ConeBounds.hpp"
#include "Acts/Surfaces/Surface.hpp"
#include "Acts/Utilities/Definitions.hpp"
#include "Acts/Utilities/ParameterDefinitions.hpp"
#include "Acts/Utilities/detail/RealQuadraticEquation.hpp"
namespace Acts {
/// @class ConeSurface
///
/// Class for a conical surface in the Tracking geometry.
/// It inherits from Surface.
///
/// The ConeSurface is special since no corresponding
/// Track parameters exist since they're numerical instable
/// at the tip of the cone.
/// Propagations to a cone surface will be returned in
/// curvilinear coordinates.
class ConeSurface : public Surface {
friend Surface;
protected:
/// Constructor form HepTransform and an opening angle
///
/// @param transform is the transform to place to cone in a 3D frame
/// @param alpha is the opening angle of the cone
/// @param symmetric indicates if the cones are built to +/1 z
ConeSurface(const Transform3D& transform, double alpha,
bool symmetric = false);
/// Constructor form HepTransform and an opening angle
///
/// @param transform is the transform that places the cone in the global frame
/// @param alpha is the opening angle of the cone
/// @param zmin is the z range over which the cone spans
/// @param zmax is the z range over which the cone spans
/// @param halfPhi is the openen angle for cone ssectors
ConeSurface(const Transform3D& transform, double alpha, double zmin,
double zmax, double halfPhi = M_PI);
/// Constructor from HepTransform and ConeBounds
///
/// @param transform is the transform that places the cone in the global frame
/// @param cbounds is the boundary class, the bounds must exit
ConeSurface(const Transform3D& transform,
const std::shared_ptr<const ConeBounds>& cbounds);
/// Copy constructor
///
/// @param other is the source cone surface
ConeSurface(const ConeSurface& other);
/// Copy constructor - with shift
///
/// @param gctx The current geometry context object, e.g. alignment
/// @param other is the source cone surface
/// @param shift is the additional transfrom applied after copying
ConeSurface(const GeometryContext& gctx, const ConeSurface& other,
const Transform3D& shift);
public:
~ConeSurface() override = default;
ConeSurface() = delete;
/// Assignment operator
///
/// @param other is the source surface for the assignment
ConeSurface& operator=(const ConeSurface& other);
/// The binning position method - is overloaded for r-type binning
///
/// @param gctx The current geometry context object, e.g. alignment
/// @param bValue defines the type of binning applied in the global frame
///
/// @return The return type is a vector for positioning in the global frame
Vector3D binningPosition(const GeometryContext& gctx,
BinningValue bValue) const final;
/// Return the surface type
SurfaceType type() const override;
/// Return the measurement frame - this is needed for alignment, in particular
/// for StraightLine and Perigee Surface
/// - the default implementation is the the RotationMatrix3D of the transform
///
/// @param gctx The current geometry context object, e.g. alignment
/// @param position is the global position where the measurement frame is
/// constructed
/// @param momentum is the momentum used for the measurement frame
/// construction
/// @return matrix that indicates the measurement frame
RotationMatrix3D referenceFrame(const GeometryContext& gctx,
const Vector3D& position,
const Vector3D& momentum) const final;
/// Return method for surface normal information
///
/// @param gctx The current geometry context object, e.g. alignment
/// @param lposition is the local position at normal vector request
/// @return Vector3D normal vector in global frame
Vector3D normal(const GeometryContext& gctx,
const Vector2D& lposition) const final;
/// Return method for surface normal information
///
/// @param gctx The current geometry context object, e.g. alignment
/// @param position is the global position as normal vector base
/// @return Vector3D normal vector in global frame
Vector3D normal(const GeometryContext& gctx,
const Vector3D& position) const final;
/// Normal vector return without argument
using Surface::normal;
// Return method for the rotational symmetry axis
///
/// @param gctx The current geometry context object, e.g. alignment
///
// @return This returns the local z axis
virtual Vector3D rotSymmetryAxis(const GeometryContext& gctx) const;
/// This method returns the ConeBounds by reference
const ConeBounds& bounds() const final;
/// Local to global transformation
///
/// @param gctx The current geometry context object, e.g. alignment
/// @param lposition is the local position to be transformed
/// @param momentum is the global momentum (ignored in this operation)
///
/// @return The global position by value
Vector3D localToGlobal(const GeometryContext& gctx, const Vector2D& lposition,
const Vector3D& momentum) const final;
/// Global to local transformation
///
/// @param gctx The current geometry context object, e.g. alignment
/// @param position is the global position to be transformed
/// @param momentum is the global momentum (ignored in this operation)
///
/// @return a Result<Vector2D> which can be !ok() if the operation fails
Result<Vector2D> globalToLocal(const GeometryContext& gctx,
const Vector3D& position,
const Vector3D& momentum) const final;
/// Straight line intersection schema from position/direction
///
/// @param gctx The current geometry context object, e.g. alignment
/// @param position The position to start from
/// @param direction The direction at start
/// @param bcheck the Boundary Check
///
/// If possible returns both solutions for the cylinder
///
/// @return SurfaceIntersection object (contains intersection & surface)
SurfaceIntersection intersect(const GeometryContext& gctx,
const Vector3D& position,
const Vector3D& direction,
const BoundaryCheck& bcheck) const final;
/// The pathCorrection for derived classes with thickness
///
/// @param gctx The current geometry context object, e.g. alignment
/// @param position is the global potion at the correction point
/// @param direction is the momentum direction at the correction point
/// @return is the path correction due to incident angle
double pathCorrection(const GeometryContext& gctx, const Vector3D& position,
const Vector3D& direction) const final;
/// Return a Polyhedron for the surfaces
///
/// @param gctx The current geometry context object, e.g. alignment
/// @param lseg Number of segments along curved lines, it represents
/// the full 2*M_PI coverange, if lseg is set to 1 only the extrema
/// are given
/// @note that a surface transform can invalidate the extrema
/// in the transformed space
///
/// @return A list of vertices and a face/facett description of it
Polyhedron polyhedronRepresentation(const GeometryContext& gctx,
size_t lseg) const override;
/// Return properly formatted class name for screen output
std::string name() const override;
/// Calculate the derivative of bound track parameters local position w.r.t.
/// position in local 3D Cartesian coordinates
///
/// @param gctx The current geometry context object, e.g. alignment
/// @param position The position of the paramters in global
///
/// @return Derivative of bound local position w.r.t. position in local 3D
/// cartesian coordinates
LocalCartesianToBoundLocalMatrix localCartesianToBoundLocalDerivative(
const GeometryContext& gctx, const Vector3D& position) const final;
protected:
std::shared_ptr<const ConeBounds> m_bounds; ///< bounds (shared)
private:
/// Implementation of the intersection solver
///
/// <b>mathematical motivation:</b>
///
/// The calculation will be done in the 3-dim frame of the cone,
/// i.e. the symmetry axis of the cone is the z-axis, x- and y-axis are
/// perpendicular
/// to the the z-axis. In this frame the cone is centered around the origin.
/// Therefore the two points describing the line have to be first
/// recalculated
/// into the new frame.
/// Suppose, this is done, the points of intersection can be
/// obtained as follows:<br>
///
/// The cone is described by the implicit equation
/// @f$x^2 + y^2 = z^2 \tan \alpha@f$
/// where @f$\alpha@f$ is opening half-angle of the cone the and
/// the line by the parameter equation (with @f$t@f$ the
/// parameter and @f$x_1@f$ and @f$x_2@f$ are points on the line)
/// @f$(x,y,z) = \vec x_1 + (\vec x_2 - \vec x_2) t @f$.
/// The intersection is the given to the value of @f$t@f$ where
/// the @f$(x,y,z)@f$ coordinates of the line satisfy the implicit
/// equation of the cone. Inserting the expression for the points
/// on the line into the equation of the cone and rearranging to
/// the form of a gives (letting @f$ \vec x_d = \frac{\vec x_2 - \vec
/// x_1}{|\vec x_2 - \vec x_1|} @f$):
/// @f$t^2 (x_d^2 + y_d^2 - z_d^2 \tan^2 \alpha) + 2 t (x_1 x_d +
/// y_1 y_d - z_1 z_d \tan^2 \alpha) + (x_1^2 + y_1^2 - z_1^2
/// \tan^2 \alpha) = 0 @f$
/// Solving the above for @f$t@f$ and putting the values into the
/// equation of the line gives the points of intersection. @f$t@f$
/// is also the length of the path, since we normalized @f$x_d@f$
/// to be unit length.
///
/// @return the quadratic equation
detail::RealQuadraticEquation intersectionSolver(
const GeometryContext& gctx, const Vector3D& position,
const Vector3D& direction) const;
};
#include "Acts/Surfaces/detail/ConeSurface.ipp"
} // namespace Acts