13#include "GaudiKernel/MsgStream.h"
68 std::shared_ptr<const Trk::CylinderBounds> cbounds)
130 double l1,
double l2,
double phi,
double theta,
double qop,
132 return std::make_unique<ParametersT<5, Charged, CylinderSurface>>(
133 l1, l2,
phi,
theta, qop, *
this, std::move(cov));
142 return std::make_unique<ParametersT<5, Charged, CylinderSurface>>(
143 position, momentum,
charge, *
this, std::move(cov));
150 double l1,
double l2,
double phi,
double theta,
double qop,
152 return std::make_unique<ParametersT<5, Neutral, CylinderSurface>>(
153 l1, l2,
phi,
theta, qop, *
this, std::move(cov));
162 return std::make_unique<ParametersT<5, Neutral, CylinderSurface>>(
163 position, momentum,
charge, *
this, std::move(cov));
170 double rMedium =
bounds().r();
201 measY.cross(measDepth).unit());
203 mFrame.col(0) = measX;
204 mFrame.col(1) = measY;
205 mFrame.col(2) = measDepth;
246 double inttol =
bounds().r() * 0.0001;
253 radius = loc3Dframe.perp();
256 radius = glopos.perp();
259 return (fabs(radius -
bounds().
r()) <= inttol);
270 return (bchk ?
bounds().inside3D(loc3Dframe,
286 if (needsTransform) {
288 point1 = invTrans * pos;
289 direction = invTrans.linear() * dir;
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) {
338 isValid = forceDir ? (t1 > 0.) :
true;
340 if (t1 * t1 < t2 * t2) {
386 double radius =
bounds().r();
387 double sp = pos.dot(S);
388 double sc = X.dot(S);
389 double dp = dir.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);
415 double first = B /
A;
422 if (fabs(rmin - radius) <
424 double first = B /
A;
425 return {2, currDist,
true, first, first};
430 [[maybe_unused]]
const double b_a = B /
A;
431 const double x = sqrt((radius - rmin) * (radius + rmin) /
A);
432 double first = b_a -
x;
433 double second = b_a +
x;
435 return {2, currDist,
true, first, second};
438 return {2, currDist,
true, second, first};
440 return {2, currDist,
true, second, first};
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);
469 double at = ax * ax + ay * ay;
470 double r = sqrt(
x *
x +
y *
y);
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();
529 double dist = sr * sr +
sz *
sz;
531 dist += ((d * d) * (sr / R + 1.));
533 return {ns, sqrt(dist),
true, s1, s2};
double charge(const T &p)
bool isValid(const T &p)
Av: we implement here an ATLAS-sepcific convention: all particles which are 99xxxxx are fine.
#define AmgSymMatrix(dim)
The BoundaryCheck class allows to steer the way surface boundaries are used for inside/outside checks...
Bounds for a cylindrical Surface.
Class for a CylinderSurface in the ATLAS detector.
virtual NeutralTrackParametersUniquePtr createUniqueNeutralParameters(double l1, double l2, double phi, double theta, double qop, std::optional< AmgSymMatrix(5)> cov=std::nullopt) const override final
Use the Surface as a ParametersBase constructor, from local parameters - neutral.
virtual void localToGlobal(const Amg::Vector2D &locp, const Amg::Vector3D &mom, Amg::Vector3D &glob) const override
Specialized for CylinderSurface : LocalToGlobal method without dynamic memory allocation.
CylinderSurface()
Default Constructor.
virtual ~CylinderSurface()
Destructor.
virtual Amg::Vector3D normal(const Amg::Vector2D &locpo) const override final
Return method for surface normal information at a given local point, overwrites the normal() from bas...
std::shared_ptr< const CylinderBounds > m_bounds
The global reference point (== a point on the surface)
virtual const Amg::Vector3D & rotSymmetryAxis() const
Return method for the rotational symmetry axis - the z-Axis of the HepTransform.
CxxUtils::CachedUniquePtr< Amg::Vector3D > m_rotSymmetryAxis
CylinderSurface & operator=(const CylinderSurface &csf)
Assignment operator.
virtual Intersection straightLineIntersection(const Amg::Vector3D &pos, const Amg::Vector3D &dir, bool forceDir=false, Trk::BoundaryCheck bchk=false) const override final
fast straight line intersection schema - provides closest intersection and (signed) path length
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...
virtual bool isOnSurface(const Amg::Vector3D &glopo, const BoundaryCheck &bchk=true, double tol1=0., double tol2=0.) const override
This method returns true if the GlobalPosition is on the Surface for both, within or without check of...
virtual Amg::RotationMatrix3D measurementFrame(const Amg::Vector3D &glopos, const Amg::Vector3D &glomom) const override final
Return the measurement frame - this is needed for alignment, in particular for StraightLine and Perig...
virtual DistanceSolution straightLineDistanceEstimate(const Amg::Vector3D &pos, const Amg::Vector3D &dir) const override
fast distance to Surface
virtual bool globalToLocal(const Amg::Vector3D &glob, const Amg::Vector3D &mom, Amg::Vector2D &loc) const override
Specialized for CylinderSurface : GlobalToLocal method without dynamic memory allocation - boolean ch...
virtual const CylinderBounds & bounds() const override final
This method returns the CylinderBounds by reference (NoBounds is not possible for cylinder)
CxxUtils::CachedUniquePtr< Amg::Vector3D > m_referencePoint
The rotational symmetry axis.
virtual bool operator==(const Surface &sf) const override
Equality operator.
virtual Surface::ChargedTrackParametersUniquePtr createUniqueTrackParameters(double l1, double l2, double phi, double theta, double qop, std::optional< AmgSymMatrix(5)> cov=std::nullopt) const override final
Use the Surface as a ParametersBase constructor, from local parameters - charged.
Access to distance solutions.
Abstract Base Class for tracking surfaces.
Amg::Transform3D inverseTransformHelper() const
Helper method to factorize in one place common operations calculate inverse transofrm and multiply wi...
std::unique_ptr< ParametersBase< 5, Trk::Charged > > ChargedTrackParametersUniquePtr
Unique ptr types.
Surface & operator=(const Surface &sf)
static constexpr double s_onSurfaceTolerance
Tolerance for being on Surface.
const TrkDetElementBase * m_associatedDetElement
Not owning Pointer to the Detector Element.
Amg::Vector3D inverseTransformMultHelper(const Amg::Vector3D &glopos) const
Surface()
Default Constructor for inheriting classes.
const Amg::Transform3D & transform() const
Returns HepGeom::Transform3D by reference.
std::unique_ptr< Transforms > m_transforms
Unique Pointer to the Transforms struct.
const Amg::Vector3D & center() const
Returns the center position of the Surface.
std::unique_ptr< ParametersBase< 5, Trk::Neutral > > NeutralTrackParametersUniquePtr
Eigen::Matrix< double, 3, 3 > RotationMatrix3D
Eigen::Affine3d Transform3D
Eigen::Matrix< double, 2, 1 > Vector2D
Eigen::Matrix< double, 3, 1 > Vector3D
Ensure that the ATLAS eigen extensions are properly loaded.
@ z
global position (cartesian)
hold the test vectors and ease the comparison
RQESolutionType solutions