12#include "GaudiKernel/MsgStream.h"
28 for (
const std::pair<float, float>& p :
vertices) {
44 for (
const std::pair<double, double>& p :
vertices) {
84 std::pair<double, double> locT(
87 std::pair<double, double> locV(
92 if (locT.first * locT.first + locT.second * locT.second < tol1 * tol1)
96 double db = locB.first * locV.second - locB.second * locV.first;
97 if (std::abs(db) < tol1) {
99 (locB.first != 0) ? -locV.first / locB.first : -locV.second / locB.second;
100 return a > -tol2 &&
a - 1. < tol2;
103 double dn = locB.first * locT.second - locB.second * locT.first;
105 if (std::abs(dn) > std::abs(tol1)) {
106 double t = (locB.first * locV.second - locB.second * locV.first) / dn;
110 double a = (locB.first != 0.)
111 ? (t * locT.first - locV.first) / locB.first
112 : (t * locT.second - locV.second) / locB.second;
132 double max_ell = bchk.lCovariance(0, 0) > bchk.lCovariance(1, 1)
133 ? bchk.lCovariance(0, 0)
134 : bchk.lCovariance(1, 1);
135 double limit = bchk.
nSigmas * std::sqrt(max_ell);
137 if (fabsR > (r_max + limit))
141 std::vector<KDOP> elementKDOP(3);
142 std::vector<Amg::Vector2D> elementP(3);
144 (bchk.lCovariance(1, 0) != 0 &&
145 (bchk.lCovariance(1, 1) - bchk.lCovariance(0, 0)) != 0)
146 ? .5 * bchk.
FastArcTan(2 * bchk.lCovariance(1, 0) /
147 (bchk.lCovariance(1, 1) - bchk.lCovariance(0, 0)))
154 normal << 0, -1, 1, 0;
160 elementP[0] = (rotMatrix * (p - locpo));
163 elementP[1] = (rotMatrix * (p - locpo));
166 elementP[2] = (rotMatrix * (p - locpo));
167 std::vector<Amg::Vector2D> axis = { normal * (elementP[1] - elementP[0]),
168 normal * (elementP[2] - elementP[1]),
169 normal * (elementP[2] - elementP[0]) };
172 std::vector<KDOP> errelipseKDOP(3);
194 for (
int i = 0; i != Np; ++i) {
196 int j = (i == Np-1 ? 0 : i+1);
198 double x = X[i] - pos[0];
199 double y = Y[i] - pos[1];
200 double dx = X[j] - X[i];
201 double dy = Y[j] - Y[i];
202 double A =
x * dy -
y * dx;
203 double S = -(
x * dx +
y * dy);
206 double d =
x *
x +
y *
y;
210 double a = dx * dx + dy * dy;
212 double d = (
A *
A) /
a;
217 if (i && in && Ao *
A < 0.)
231 sl << std::setiosflags(std::ios::fixed);
232 sl << std::setprecision(7);
233 sl <<
"Trk::TriangleBounds: generating vertices (X, Y) " <<
'\n';
237 sl << std::setprecision(-1);
244 sl << std::setiosflags(std::ios::fixed);
245 sl << std::setprecision(7);
246 sl <<
"Trk::TriangleBounds: generating vertices (X, Y)";
250 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
Abstract base class for surface bounds to be specified.
Bounds for a triangular, planar surface.
TriangleBounds()
Default Constructor - needed for persistency.
virtual double r() const override final
This method returns the maximal extension on the local plane, i.e.
virtual bool operator==(const SurfaceBounds &sbo) const override
Equality operator.
virtual bool inside(const Amg::Vector2D &locpo, double tol1=0., double tol2=0.) const override final
This method checks if the provided local coordinates are inside the surface bounds.
virtual MsgStream & dump(MsgStream &sl) const override
Output Method for MsgStream.
std::vector< TDD_real_t > m_boundValues
std::vector< std::pair< TDD_real_t, TDD_real_t > > vertices() const
This method returns the coordinates of vertices.
virtual double minDistance(const Amg::Vector2D &pos) const override final
Minimal distance to boundary ( > 0 if outside and <=0 if inside)
Eigen::Matrix< double, 2, 1 > Vector2D
hold the test vectors and ease the comparison