12#include "GaudiKernel/MsgStream.h"
26 m_rotMat = Eigen::Rotation2D{alpha};
71 const double fabsX = std::abs(locpo[
Trk::locX]);
72 double max_ell = bchk.lCovariance(0, 0) > bchk.lCovariance(1, 1)
73 ? bchk.lCovariance(0, 0)
74 : bchk.lCovariance(1, 1);
75 double limit = bchk.
nSigmas * sqrt(max_ell);
79 const double fabsY = std::abs(locpo[
Trk::locY]);
83 double min_ell = bchk.lCovariance(0, 0) < bchk.lCovariance(1, 1)
84 ? bchk.lCovariance(0, 0)
85 : bchk.lCovariance(1, 1);
86 limit = bchk.
nSigmas * sqrt(min_ell);
92 std::vector<KDOP> elementKDOP(3);
93 std::vector<Amg::Vector2D> elementP(4);
95 (bchk.lCovariance(1, 0) != 0 &&
96 (bchk.lCovariance(1, 1) - bchk.lCovariance(0, 0)) != 0)
97 ? .5 * bchk.
FastArcTan(2 * bchk.lCovariance(1, 0) /
98 (bchk.lCovariance(1, 1) - bchk.lCovariance(0, 0)))
105 normal << 0, -1, 1, 0;
111 elementP[0] = (rotMatrix * (p - locpo));
114 elementP[1] = (rotMatrix * (p - locpo));
117 elementP[2] = (rotMatrix * (p - locpo));
120 elementP[3] = (rotMatrix * (p - locpo));
121 std::vector<Amg::Vector2D> axis = { normal * (elementP[1] - elementP[0]),
122 normal * (elementP[3] - elementP[1]),
123 normal * (elementP[2] - elementP[0]) };
126 std::vector<KDOP> errelipseKDOP(3);
139 double fabsX = std::abs(locpo[
Trk::locX]);
140 double fabsY = std::abs(locpo[
Trk::locY]);
166 constexpr int Np = 4;
181 for (
int i = 0; i != Np; ++i) {
183 int j = (i == Np-1 ? 0 : i+1);
185 double x = X[i] - pos[0];
186 double y = Y[i] - pos[1];
187 double dx = X[j] - X[i];
188 double dy = Y[j] - Y[i];
189 double A =
x * dy -
y * dx;
190 double S = -(
x * dx +
y * dy);
193 double d =
x *
x +
y *
y;
197 double a = dx * dx + dy * dy;
199 double d = (
A *
A) /
a;
204 if (i && in && Ao *
A < 0.)
209 return -std::sqrt(dm);
211 return std::sqrt(dm);
219 sl << std::setiosflags(std::ios::fixed);
220 sl << std::setprecision(7);
221 sl <<
"Trk::RotatedTrapezoidBounds: (halfX, minHalfX, maxHalfY) = "
225 sl << std::setprecision(-1);
232 sl << std::setiosflags(std::ios::fixed);
233 sl << std::setprecision(7);
234 sl <<
"Trk::RotatedTrapezoidBounds: (halfX, minHalfX, maxHalfY) = "
238 sl << std::setprecision(-1);
#define AmgMatrix(rows, cols)
The BoundaryCheck class allows to steer the way surface boundaries are used for inside/outside checks...
int nSigmas
allowed sigmas for chi2 boundary check
std::vector< Amg::Vector2D > EllipseToPoly(int resolution=3) const
bool TestKDOPKDOP(const std::vector< KDOP > &a, const std::vector< KDOP > &b) const
void ComputeKDOP(const std::vector< Amg::Vector2D > &v, const std::vector< Amg::Vector2D > &KDOPAxes, std::vector< KDOP > &kdop) const
Each Bounds has a method inside, which checks if a LocalPosition is inside the bounds.
double toleranceLoc2
absolute tolerance in local 2 coordinate
double FastArcTan(double x) const
sincosCache FastSinCos(double x) const
double toleranceLoc1
absolute tolerance in local 1 coordinate
Bounds for a rotated trapezoidal, planar Surface.
std::vector< TDD_real_t > m_boundValues
The internal storage of the bounds can be float/double.
virtual void initCache() override final
Helper function for angle parameter initialization.
virtual bool inside(const Amg::Vector2D &locpo, double tol1=0., double tol2=0.) const override final
The orientation of the Trapezoid is according to the figure above, in words: the shorter of the two p...
bool isBelow(double locX, double fabsLocY, double tol1, double tol2) const
isBelow() method for checking whether a point lies above or under a straight line
virtual double minDistance(const Amg::Vector2D &pos) const override final
Minimal distance to boundary ( > 0 if outside and <=0 if inside)
RotatedTrapezoidBounds()
Default Constructor, needed for persistency.
virtual MsgStream & dump(MsgStream &sl) const override final
Output Method for MsgStream.
virtual bool operator==(const SurfaceBounds &trabo) const override final
Equality operator.
Abstract base class for surface bounds to be specified.
void swap(double &b1, double &b2)
Swap method to be called from DiscBounds or TrapezoidalBounds.
Eigen::Matrix< double, 2, 1 > Vector2D
hold the test vectors and ease the comparison