13 #include "GaudiKernel/MsgStream.h"
24 , m_referencePoint(nullptr)
25 , m_rotSymmetryAxis(nullptr)
31 , m_bounds(csf.m_bounds)
32 , m_referencePoint(nullptr)
33 , m_rotSymmetryAxis(nullptr)
40 , m_bounds(csf.m_bounds)
41 , m_referencePoint(nullptr)
42 , m_rotSymmetryAxis(nullptr)
51 , m_referencePoint(nullptr)
52 , m_rotSymmetryAxis(nullptr)
62 , m_referencePoint(nullptr)
63 , m_rotSymmetryAxis(nullptr)
68 std::shared_ptr<const Trk::CylinderBounds> cbounds)
70 , m_bounds(std::move(cbounds))
71 , m_referencePoint(nullptr)
72 , m_rotSymmetryAxis(nullptr)
80 , m_referencePoint(nullptr)
81 , m_rotSymmetryAxis(nullptr)
88 , m_referencePoint(nullptr)
89 , m_rotSymmetryAxis(nullptr)
98 , m_referencePoint(nullptr)
99 , m_rotSymmetryAxis(nullptr)
105 , m_bounds(std::move(cbounds))
106 , m_referencePoint(nullptr)
107 , m_rotSymmetryAxis(nullptr)
117 m_referencePoint.store(
nullptr);
118 m_rotSymmetryAxis.store(
nullptr);
127 double l1,
double l2,
double phi,
double theta,
double qop,
129 return std::make_unique<ParametersT<5, Charged, CylinderSurface>>(
139 return std::make_unique<ParametersT<5, Charged, CylinderSurface>>(
147 double l1,
double l2,
double phi,
double theta,
double qop,
149 return std::make_unique<ParametersT<5, Neutral, CylinderSurface>>(
159 return std::make_unique<ParametersT<5, Neutral, CylinderSurface>>(
166 if (!m_referencePoint) {
167 double rMedium = bounds().r();
168 double phi = bounds().averagePhi();
170 m_referencePoint.set(std::make_unique<Amg::Vector3D>(
transform() * gp));
172 return (*m_referencePoint);
198 measY.cross(measDepth).unit());
200 mFrame.col(0) = measX;
201 mFrame.col(1) = measY;
202 mFrame.col(2) = measDepth;
210 if (!m_rotSymmetryAxis) {
212 m_rotSymmetryAxis.set(std::make_unique<Amg::Vector3D>(
zAxis));
214 return (*m_rotSymmetryAxis);
225 double r = bounds().r();
243 double inttol = bounds().r() * 0.0001;
248 Amg::Vector3D loc3Dframe(inverseTransformMultHelper(glopos));
249 locpos =
Amg::Vector2D(bounds().
r() * loc3Dframe.phi(), loc3Dframe.z());
250 radius = loc3Dframe.perp();
256 return (fabs(
radius - bounds().
r()) <= inttol);
267 return (bchk ? bounds().inside3D(loc3Dframe,
268 tol1 + s_onSurfaceTolerance,
269 tol2 + s_onSurfaceTolerance)
279 bool needsTransform = m_transforms || m_associatedDetElement;
283 if (needsTransform) {
285 point1 = invTrans *
pos;
286 direction = invTrans.linear() *
dir;
289 double R = bounds().r();
294 double idirx = 1. / direction.x();
295 double k = direction.y() * idirx;
296 double d = point1.y() - point1.x() *
k;
301 t1 = (pquad.
first - point1.x()) * idirx;
302 t2 = (pquad.
second - point1.x()) * idirx;
304 return {
pos, 0.,
false};
305 }
else if (direction.y()) {
309 double x = point1.x();
310 double r2mx2 = R * R -
x *
x;
313 return {
pos, 0.,
false};
314 double y = sqrt(r2mx2);
316 double idiry = 1. / direction.y();
317 t1 = (
y - point1.y()) * idiry;
318 t2 = (-
y - point1.y()) * idiry;
320 return {
pos, 0.,
false};
333 if (
t1 *
t2 > 0 || !forceDir) {
355 bchk ? (
isValid && m_bounds->inside3D(solution,
383 double radius = bounds().r();
384 double sp =
pos.dot(
S);
385 double sc =
X.dot(
S);
390 double A =
ax.dot(
ax);
391 double B =
ax.dot(
dx);
392 double C =
dx.dot(
dx);
393 double currDist =
radius - sqrt(C);
396 if (fabs(currDist) < tol) {
397 return {1, 0.,
true, 0.};
400 0, currDist,
true, 0.};
407 [[maybe_unused]]
const double rmin_tmp = B * B /
A;
408 const double rmin2 = C - rmin_tmp;
409 const double rmin = rmin2 < 0 ? 0 : sqrt(rmin2);
427 [[maybe_unused]]
const double b_a = B /
A;
445 const double tolb = .01;
461 double x = dxyz.dot(Ax);
462 double y = dxyz.dot(Ay);
463 double z = dxyz.dot(Az);
464 double ax =
dir.dot(Ax);
465 double ay =
dir.dot(Ay);
467 double r = sqrt(
x *
x +
y *
y);
468 double R = bounds().r();
492 const double inv_at = 1. / at;
493 double A = -(
ax *
x +
ay *
y) * inv_at;
494 double B =
A *
A + (R -
r) * (R -
r) * inv_at;
516 return {
ns, fabs(
sr),
true, s1,
s2};
522 double d = bounds().minDistance(lp);
523 double sz = fabs(
z) - bounds().halflengthZ();
528 dist += ((
d *
d) * (
sr / R + 1.));
530 return {
ns, sqrt(dist),
true, s1,
s2};