13 #include "GaudiKernel/MsgStream.h"
25 , m_referencePoint(nullptr)
26 , m_rotSymmetryAxis(nullptr)
32 , m_bounds(csf.m_bounds)
33 , m_referencePoint(nullptr)
34 , m_rotSymmetryAxis(nullptr)
41 , m_bounds(csf.m_bounds)
42 , m_referencePoint(nullptr)
43 , m_rotSymmetryAxis(nullptr)
52 , m_referencePoint(nullptr)
53 , m_rotSymmetryAxis(nullptr)
63 , m_referencePoint(nullptr)
64 , m_rotSymmetryAxis(nullptr)
72 , m_referencePoint(nullptr)
73 , m_rotSymmetryAxis(nullptr)
75 if (!cbounds)
throw std::runtime_error(
"Cannot pass null CylinderBounds");
82 , m_referencePoint(nullptr)
83 , m_rotSymmetryAxis(nullptr)
90 , m_referencePoint(nullptr)
91 , m_rotSymmetryAxis(nullptr)
100 , m_referencePoint(nullptr)
101 , m_rotSymmetryAxis(nullptr)
108 , m_referencePoint(nullptr)
109 , m_rotSymmetryAxis(nullptr)
120 m_referencePoint.store(
nullptr);
121 m_rotSymmetryAxis.store(
nullptr);
130 double l1,
double l2,
double phi,
double theta,
double qop,
132 return std::make_unique<ParametersT<5, Charged, CylinderSurface>>(
142 return std::make_unique<ParametersT<5, Charged, CylinderSurface>>(
150 double l1,
double l2,
double phi,
double theta,
double qop,
152 return std::make_unique<ParametersT<5, Neutral, CylinderSurface>>(
162 return std::make_unique<ParametersT<5, Neutral, CylinderSurface>>(
169 if (!m_referencePoint) {
170 double rMedium = bounds().r();
171 double phi = bounds().averagePhi();
173 m_referencePoint.set(std::make_unique<Amg::Vector3D>(
transform() * gp));
175 return (*m_referencePoint);
201 measY.cross(measDepth).unit());
203 mFrame.col(0) = measX;
204 mFrame.col(1) = measY;
205 mFrame.col(2) = measDepth;
213 if (!m_rotSymmetryAxis) {
215 m_rotSymmetryAxis.set(std::make_unique<Amg::Vector3D>(
zAxis));
217 return (*m_rotSymmetryAxis);
228 double r = bounds().r();
246 double inttol = bounds().r() * 0.0001;
251 Amg::Vector3D loc3Dframe(inverseTransformMultHelper(glopos));
252 locpos =
Amg::Vector2D(bounds().
r() * loc3Dframe.phi(), loc3Dframe.z());
253 radius = loc3Dframe.perp();
259 return (fabs(
radius - bounds().
r()) <= inttol);
270 return (bchk ? bounds().inside3D(loc3Dframe,
271 tol1 + s_onSurfaceTolerance,
272 tol2 + s_onSurfaceTolerance)
282 bool needsTransform = m_transforms || m_associatedDetElement;
286 if (needsTransform) {
288 point1 = invTrans *
pos;
289 direction = invTrans.linear() *
dir;
292 double R = bounds().r();
297 double idirx = 1. / direction.x();
298 double k = direction.y() * idirx;
299 double d = point1.y() - point1.x() *
k;
304 t1 = (pquad.
first - point1.x()) * idirx;
305 t2 = (pquad.
second - point1.x()) * idirx;
307 return {
pos, 0.,
false};
308 }
else if (direction.y()) {
312 double x = point1.x();
313 double r2mx2 = R * R -
x *
x;
316 return {
pos, 0.,
false};
317 double y = sqrt(r2mx2);
319 double idiry = 1. / direction.y();
320 t1 = (
y - point1.y()) * idiry;
321 t2 = (-
y - point1.y()) * idiry;
323 return {
pos, 0.,
false};
336 if (
t1 *
t2 > 0 || !forceDir) {
358 bchk ? (
isValid && m_bounds->inside3D(solution,
386 double radius = bounds().r();
387 double sp =
pos.dot(
S);
388 double sc =
X.dot(
S);
393 double A =
ax.dot(
ax);
394 double B =
ax.dot(
dx);
395 double C =
dx.dot(
dx);
396 double currDist =
radius - sqrt(C);
399 if (fabs(currDist) < tol) {
400 return {1, 0.,
true, 0.};
403 0, currDist,
true, 0.};
410 [[maybe_unused]]
const double rmin_tmp = B * B /
A;
411 const double rmin2 = C - rmin_tmp;
412 const double rmin = rmin2 < 0 ? 0 : sqrt(rmin2);
430 [[maybe_unused]]
const double b_a = B /
A;
448 const double tolb = .01;
464 double x = dxyz.dot(Ax);
465 double y = dxyz.dot(Ay);
466 double z = dxyz.dot(Az);
467 double ax =
dir.dot(Ax);
468 double ay =
dir.dot(Ay);
470 double r = sqrt(
x *
x +
y *
y);
471 double R = bounds().r();
495 const double inv_at = 1. / at;
496 double A = -(
ax *
x +
ay *
y) * inv_at;
497 double B =
A *
A + (R -
r) * (R -
r) * inv_at;
519 return {
ns, fabs(
sr),
true, s1,
s2};
525 double d = bounds().minDistance(lp);
526 double sz = fabs(
z) - bounds().halflengthZ();
531 dist += ((
d *
d) * (
sr / R + 1.));
533 return {
ns, sqrt(dist),
true, s1,
s2};