13#include "GaudiKernel/MsgStream.h"
68 std::shared_ptr<const Trk::CylinderBounds> cbounds)
127 double l1,
double l2,
double phi,
double theta,
double qop,
129 return std::make_unique<ParametersT<5, Charged, CylinderSurface>>(
130 l1, l2,
phi,
theta, qop, *
this, std::move(cov));
139 return std::make_unique<ParametersT<5, Charged, CylinderSurface>>(
140 position, momentum,
charge, *
this, std::move(cov));
147 double l1,
double l2,
double phi,
double theta,
double qop,
149 return std::make_unique<ParametersT<5, Neutral, CylinderSurface>>(
150 l1, l2,
phi,
theta, qop, *
this, std::move(cov));
159 return std::make_unique<ParametersT<5, Neutral, CylinderSurface>>(
160 position, momentum,
charge, *
this, std::move(cov));
167 double rMedium =
bounds().r();
198 measY.cross(measDepth).unit());
200 mFrame.col(0) = measX;
201 mFrame.col(1) = measY;
202 mFrame.col(2) = measDepth;
243 double inttol =
bounds().r() * 0.0001;
250 radius = loc3Dframe.perp();
253 radius = glopos.perp();
256 return (fabs(radius -
bounds().
r()) <= inttol);
267 return (bchk ?
bounds().inside3D(loc3Dframe,
283 if (needsTransform) {
285 point1 = invTrans * pos;
286 direction = invTrans.linear() * dir;
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) {
335 isValid = forceDir ? (t1 > 0.) :
true;
337 if (t1 * t1 < t2 * t2) {
383 double radius =
bounds().r();
384 double sp = pos.dot(S);
385 double sc = X.dot(S);
386 double dp = dir.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);
412 double first = B /
A;
419 if (fabs(rmin - radius) <
421 double first = B /
A;
422 return {2, currDist,
true, first, first};
427 [[maybe_unused]]
const double b_a = B /
A;
428 const double x = sqrt((radius - rmin) * (radius + rmin) /
A);
429 double first = b_a -
x;
430 double second = b_a +
x;
432 return {2, currDist,
true, first, second};
435 return {2, currDist,
true, second, first};
437 return {2, currDist,
true, second, first};
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);
466 double at = ax * ax + ay * ay;
467 double r = sqrt(
x *
x +
y *
y);
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();
526 double dist = sr * sr +
sz *
sz;
528 dist += ((d * d) * (sr / R + 1.));
530 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 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