ATLAS Offline Software
AnnulusBounds.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // AnnulusBounds.cxx, (c) ATLAS Detector Software
8 
9 // Trk
11 // Gaudi
12 #include "GaudiKernel/MsgStream.h"
13 // STD
14 #include <algorithm> //std::max_element
15 #include <cmath> //sin, cos etc
16 #include <iomanip>
17 #include <ostream>
18 
19 // Class checking the interface of an ellipse with a circle
21 {
22 private:
24  bool iterate(double x, double y, double c0x, double c0y, double c2x, double c2y, double rr) const
25  {
26  std::vector<double> innerPolygonCoef(m_maxIterations + 1);
27  std::vector<double> outerPolygonCoef(m_maxIterations + 1);
28 
29  for (int t = 1; t <= m_maxIterations; t++) {
30  int numNodes = 4 << t;
31  // innerPolygonCoef[t] = 0.5/std::cos(4*std::acos(0.0)/numNodes);
32  innerPolygonCoef[t] = 0.5 / std::cos(2.0*M_PI / numNodes);
33  double c1x = (c0x + c2x) * innerPolygonCoef[t];
34  double c1y = (c0y + c2y) * innerPolygonCoef[t];
35  double tx = x - c1x; // t indicates a translated coordinate
36  double ty = y - c1y;
37  if (tx * tx + ty * ty <= rr) {
38  return true; // collision with t1
39  }
40  double t2x = c2x - c1x;
41  double t2y = c2y - c1y;
42  if (tx * t2x + ty * t2y >= 0 && tx * t2x + ty * t2y <= t2x * t2x + t2y * t2y &&
43  (ty * t2x - tx * t2y >= 0 || rr * (t2x * t2x + t2y * t2y) >= (ty * t2x - tx * t2y) * (ty * t2x - tx * t2y))) {
44  return true; // collision with t1---t2
45  }
46  double t0x = c0x - c1x;
47  double t0y = c0y - c1y;
48  if (tx * t0x + ty * t0y >= 0 && tx * t0x + ty * t0y <= t0x * t0x + t0y * t0y &&
49  (ty * t0x - tx * t0y <= 0 || rr * (t0x * t0x + t0y * t0y) >= (ty * t0x - tx * t0y) * (ty * t0x - tx * t0y))) {
50  return true; // collision with t1---t0
51  }
52  outerPolygonCoef[t] = 0.5 / (std::cos(M_PI / numNodes) * std::cos(M_PI / numNodes));
53  double c3x = (c0x + c1x) * outerPolygonCoef[t];
54  double c3y = (c0y + c1y) * outerPolygonCoef[t];
55  if ((c3x - x) * (c3x - x) + (c3y - y) * (c3y - y) < rr) {
56  c2x = c1x;
57  c2y = c1y;
58  continue; // t3 is inside circle
59  }
60  double c4x = c1x - c3x + c1x;
61  double c4y = c1y - c3y + c1y;
62  if ((c4x - x) * (c4x - x) + (c4y - y) * (c4y - y) < rr) {
63  c0x = c1x;
64  c0y = c1y;
65  continue; // t4 is inside circle
66  }
67  double t3x = c3x - c1x;
68  double t3y = c3y - c1y;
69  if (ty * t3x - tx * t3y <= 0 || rr * (t3x * t3x + t3y * t3y) > (ty * t3x - tx * t3y) * (ty * t3x - tx * t3y)) {
70  if (tx * t3x + ty * t3y > 0) {
71  if (std::abs(tx * t3x + ty * t3y) <= t3x * t3x + t3y * t3y ||
72  (x - c3x) * (c0x - c3x) + (y - c3y) * (c0y - c3y) >= 0) {
73  c2x = c1x;
74  c2y = c1y;
75  continue; // circle center is inside t0---t1---t3
76  }
77  } else if (-(tx * t3x + ty * t3y) <= t3x * t3x + t3y * t3y ||
78  (x - c4x) * (c2x - c4x) + (y - c4y) * (c2y - c4y) >= 0) {
79  c0x = c1x;
80  c0y = c1y;
81  continue; // circle center is inside t1---t2---t4
82  }
83  }
84  return false; // no collision possible
85  }
86  return false; // out of iterations so it is unsure if there was a collision. But have to return something.
87  }
88 
89 public:
90  // test for collision between an ellipse of horizontal radius w and vertical radius h at (x0, y0) and a circle of
91  // radius r at (x1, y1)
92  bool collide(double x0, double y0, double w, double h, double x1, double y1, double r) const
93  {
94  double x = std::abs(x1 - x0);
95  double y = std::abs(y1 - y0);
96 
97  // return iterate(x, y, w, 0, 0, h, r*r);
98 
99  if (r > 0) {
100  if (x * x + (h - y) * (h - y) <= r * r || (w - x) * (w - x) + y * y <= r * r ||
101  x * h + y * w <= w * h // collision with (0, h)
102  || ((x * h + y * w - w * h) * (x * h + y * w - w * h) <= r * r * (w * w + h * h) && x * w - y * h >= -h * h &&
103  x * w - y * h <= w * w)) { // collision with (0, h)---(w, 0)
104  return true;
105  }
106  if ((x - w) * (x - w) + (y - h) * (y - h) <= r * r || (x <= w && y - r <= h) || (y <= h && x - r <= w)) {
107  return iterate(x, y, w, 0, 0, h, r * r); // collision within triangle (0, h) (w, h) (0, 0) is possible
108  }
109  return false;
110 
111  }
112  double R = -r;
113  double localCos = x / R;
114  double deltaR = std::sqrt(h * h + (w * w - h * h) * localCos * localCos);
115  return deltaR >= R - std::sqrt(x * x + y * y);
116 
117  }
118  explicit EllipseCollisionTest(int maxIterations)
119  : m_maxIterations(maxIterations)
120  {
121  }
122 };
123 
125 
126 // default constructor
128  : // Trk::SurfaceBounds()
129  m_boundValues(AnnulusBounds::bv_length, 0.)
130  , m_maxYout{}
131  , m_minYout{}
132  , m_maxXout{}
133  , m_minXout{}
134  , m_maxYin{}
135  , m_minYin{}
136  , m_maxXin{}
137  , m_minXin{}
138  , m_k_L{}
139  , m_k_R{}
140  , m_d_L{}
141  , m_d_R{}
142  , m_solution_L_min{}
143  , m_solution_L_max{}
144  , m_solution_R_min{}
145  , m_solution_R_max{}
146 {
147  // nop
148 }
149 
150 // constructor from arguments I
151 Trk::AnnulusBounds::AnnulusBounds(double minR, double maxR, double R, double phi, double phiS)
152  : m_boundValues(AnnulusBounds::bv_length, 0.)
153 {
156  m_boundValues[AnnulusBounds::bv_R] = std::fabs(R);
161 
162  m_k_L = std::tan((M_PI + phi) / 2. - phiS);
163  m_k_R = std::tan((M_PI - phi) / 2. - phiS);
164 
165  m_d_L = R * std::sin(-phiS) * std::tan((M_PI - phi) / 2. + phiS) + R * (1. - std::cos(-phiS));
166  m_d_R = R * std::sin(-phiS) * std::tan((M_PI + phi) / 2. + phiS) + R * (1. - std::cos(-phiS));
167 
168  // solving quadratic equation to find four corners of the AnnulusBounds
173 
174  std::vector<TDD_real_t> XX; // x co-ordinates of corners
175  XX.push_back(m_solution_L_min[0]);
176  XX.push_back(m_solution_L_max[0]);
177  XX.push_back(m_solution_R_min[0]);
178  XX.push_back(m_solution_R_max[0]);
179 
180  std::vector<TDD_real_t> YY; // y co-ordinates of corners
181  YY.push_back(m_solution_L_min[1]);
182  YY.push_back(m_solution_L_max[1]);
183  YY.push_back(m_solution_R_min[1]);
184  YY.push_back(m_solution_R_max[1]);
185  YY.push_back(maxR);
186 
187  m_maxXout = *std::max_element(XX.begin(), XX.end());
188  m_minXout = *std::min_element(XX.begin(), XX.end());
189  m_maxYout = *std::max_element(YY.begin(), YY.end());
190  m_minYout = *std::min_element(YY.begin(), YY.end());
191 
195  m_minYin = minR;
196 }
197 
198 bool
200 {
201  // check the type first not to compare apples with oranges
202  const Trk::AnnulusBounds* annbo = dynamic_cast<const Trk::AnnulusBounds*>(&sbo);
203  if (!annbo)
204  return false;
205  return (m_boundValues == annbo->m_boundValues);
206 }
207 
208 // checking if inside bounds
209 bool
210 Trk::AnnulusBounds::inside(const Amg::Vector2D& locpo, double tol1, double tol2) const
211 
212 {
213  // a fast FALSE
214  double localY = locpo[Trk::locY];
215  if (localY > (m_maxYout + tol2) || localY < (m_minYout - tol2))
216  return false;
217  // a fast FALSE
218  double localX = locpo[Trk::locX];
219  if (localX > (m_maxXout + tol1) || localX < (m_minXout - tol1))
220  return false;
221  // a fast TRUE
222  if (localX > (m_minXin - tol1) && localX < (m_maxXin + tol1) && localY > (m_minYin - tol2) &&
223  localY < (m_maxYin + tol2))
224  return true;
225 
227  // if (this->minDistance(locpo)>std::max(tol1,tol2)) return false;
228 
229  double localR2 = localX * localX + localY * localY;
230  double localR = std::sqrt(localR2);
231  double localCos = localX / localR;
232  double localSin = localY / localR;
233  double deltaR = std::sqrt(tol2 * tol2 * localSin * localSin + tol1 * tol1 * localCos * localCos);
234 
235  double minR = m_boundValues[AnnulusBounds::bv_minR];
236  double maxR = m_boundValues[AnnulusBounds::bv_maxR];
237 
238  bool condRad = (localR < maxR + deltaR && localR > minR - deltaR);
239  bool condL =
240  (isRight(locpo, tol1, tol2, m_solution_L_max[0], m_solution_L_max[1], m_solution_L_min[0], m_solution_L_min[1]));
241  bool condR =
242  (isLeft(locpo, tol1, tol2, m_solution_R_max[0], m_solution_R_max[1], m_solution_R_min[0], m_solution_R_min[1]));
243 
244  return (condRad && condL && condR);
245 }
246 
247 bool
249 {
250 
251  if (bchk.bcType == 0 || bchk.nSigmas == 0)
252  return AnnulusBounds::inside(locpo, bchk.toleranceLoc1, bchk.toleranceLoc2);
253 
254  sincosCache scResult = bchk.FastSinCos(locpo(1, 0));
255 
257 
258  const Amg::Vector2D& locpoCar = locpo;
259  AmgMatrix(2, 2) lCovarianceCar = bchk.lCovariance;
260 
261  // ellipse is always at (0,0), surface is moved to ellipse position and then rotated
262  double w = bchk.nSigmas * std::sqrt(lCovarianceCar(0, 0));
263  double h = bchk.nSigmas * std::sqrt(lCovarianceCar(1, 1));
264 
265  // a fast FALSE
266  double maxTol = std::max(w, h);
267  double minTol = std::min(w, h);
268  double localY = locpo[Trk::locY];
269  if (localY > (m_maxYout + maxTol) || localY < (m_minYout - maxTol))
270  return false;
271  // a fast FALSE
272  double localX = locpo[Trk::locX];
273  if (localX > (m_maxXout + maxTol) || localX < (m_minXout - maxTol))
274  return false;
275  // a fast TRUE
276  if (localX > (m_minXin - minTol) && localX < (m_maxXin + minTol) && localY > (m_minYin - minTol) &&
277  localY < (m_maxYin + minTol))
278  return true;
279 
280  double x0 = 0;
281  double y0 = 0;
282  float theta = (lCovarianceCar(1, 0) != 0 && (lCovarianceCar(1, 1) - lCovarianceCar(0, 0)) != 0)
283  ? .5 * bchk.FastArcTan(2 * lCovarianceCar(1, 0) / (lCovarianceCar(1, 1) - lCovarianceCar(0, 0)))
284  : 0.;
285  scResult = bchk.FastSinCos(theta);
286  AmgMatrix(2, 2) rotMatrix;
287  rotMatrix << scResult.cosC, scResult.sinC,
288  -scResult.sinC, scResult.cosC;
289  Amg::Vector2D tmp = rotMatrix * (-locpoCar);
290  double x1 = tmp(0, 0);
291  double y1 = tmp(1, 0);
292  double maxR = m_boundValues[AnnulusBounds::bv_maxR];
293  double minR = m_boundValues[AnnulusBounds::bv_minR];
294 
295  bool condR = (test.collide(x0, y0, w, h, x1, y1, -minR) && test.collide(x0, y0, w, h, x1, y1, maxR));
296 
297  // compute KDOP and axes for surface polygon
298  std::vector<KDOP> elementKDOP(4);
299  std::vector<Amg::Vector2D> elementP(4);
300 
301  AmgMatrix(2, 2) normal;
302  // cppcheck-suppress constStatement
303  normal << 0, -1, 1, 0;
304 
305  // ellipse is always at (0,0), surface is moved to ellipse position and then rotated
307  p << m_solution_L_min[0], m_solution_L_min[1];
308  elementP[0] = (rotMatrix * (p - locpo));
309 
310  p << m_solution_L_max[0], m_solution_L_max[1];
311  elementP[1] = (rotMatrix * (p - locpo));
312 
313  p << m_solution_R_max[0], m_solution_R_max[1];
314  elementP[2] = (rotMatrix * (p - locpo));
315 
316  p << m_solution_R_min[0], m_solution_R_min[1];
317  elementP[3] = (rotMatrix * (p - locpo));
318 
319  std::vector<Amg::Vector2D> axis = { normal * (elementP[0] - elementP[1]),
320  normal * (elementP[1] - elementP[2]),
321  normal * (elementP[2] - elementP[3]),
322  normal * (elementP[3] - elementP[0]) };
323  bchk.ComputeKDOP(elementP, axis, elementKDOP);
324  // compute KDOP for error ellipse
325  std::vector<KDOP> errelipseKDOP(4);
326  bchk.ComputeKDOP(bchk.EllipseToPoly(4), axis, errelipseKDOP);
327 
328  bool condSide = bchk.TestKDOPKDOP(elementKDOP, errelipseKDOP);
329 
330  bool condLine =
331  (isAbove(locpo, 0, 0, m_solution_L_max[0], m_solution_L_max[1], m_solution_R_max[0], m_solution_R_max[1]) &&
332  isRight(locpo, 0, 0, m_solution_L_max[0], m_solution_L_max[1], m_solution_L_min[0], m_solution_L_min[1]) &&
333  isLeft(locpo, 0, 0, m_solution_R_max[0], m_solution_R_max[1], m_solution_R_min[0], m_solution_R_min[1]));
334 
335  if (condLine){
336  return condR;
337  }
338 
339  return (condR && condSide);
340 }
341 
342 // checking if local point lies above a line
343 bool
345  double tol1,
346  double tol2,
347  double x1,
348  double y1,
349  double x2,
350  double y2)
351 {
352  if (x2 != x1) {
353  double k = (y2 - y1) / (x2 - x1);
354  double d = y1 - k * x1;
355  // the most tolerant approach for tol1 and tol2
356  double sign = k > 0. ? -1. : +1.;
357  return (locpo[Trk::locY] + tol2 > (k * (locpo[Trk::locX] + sign * tol1) + d));
358  }
359  return false;
360 }
361 
362 // checking if local point right from a line
363 bool
365  double tol1,
366  double tol2,
367  double x1,
368  double y1,
369  double x2,
370  double y2)
371 {
372 
373  if (x1 != x2) {
374  double k = (y2 - y1) / (x2 - x1);
375  double d = y1 - k * x1;
376 
377  if (k > 0){
378  return (locpo[Trk::locY] < (k * locpo[Trk::locX] + d) ||
379  EllipseIntersectLine(locpo, tol1, tol2, x1, y1, x2, y2));
380  }
381  if (k < 0){
382  return (locpo[Trk::locY] > (k * locpo[Trk::locX] + d) ||
383  EllipseIntersectLine(locpo, tol1, tol2, x1, y1, x2, y2));
384  }
385 
386  return false;
387  }
388  return (locpo[Trk::locX] > x1 ||
389  EllipseIntersectLine(locpo, tol1, tol2, x1, y1, x2, y2));
390 }
391 
392 // checking if local point left from a line
393 bool
395  double tol1,
396  double tol2,
397  double x1,
398  double y1,
399  double x2,
400  double y2)
401 {
402 
403  if (x1 != x2) {
404  double k = (y2 - y1) / (x2 - x1);
405  double d = y1 - k * x1;
406 
407  if (k < 0){
408  return (locpo[Trk::locY] < (k * locpo[Trk::locX] + d) ||
409  EllipseIntersectLine(locpo, tol1, tol2, x1, y1, x2, y2));
410  }
411  if (k > 0){
412  return (locpo[Trk::locY] > (k * locpo[Trk::locX] + d) ||
413  EllipseIntersectLine(locpo, tol1, tol2, x1, y1, x2, y2));
414  }
415 
416  return false;
417  }
418  return (locpo[Trk::locX] < x1 ||
419  EllipseIntersectLine(locpo, tol1, tol2, x1, y1, x2, y2));
420 }
421 
422 double
424 {
425 
426  // Calculate four corner points - crossings of an arc with a line
427  double minR = m_boundValues[AnnulusBounds::bv_minR];
428  double maxR = m_boundValues[AnnulusBounds::bv_maxR];
429 
430  // distance to left and right line
431  double distLine_L = distanceToLine(locpo, m_solution_L_min, m_solution_L_max);
432  double distLine_R = distanceToLine(locpo, m_solution_R_min, m_solution_R_max);
433 
434  double dist = std::min(distLine_L, distLine_R);
435 
436  // calculate distance to both arcs
437  double distMin = distanceToArc(locpo, minR, m_solution_L_min, m_solution_R_min);
438  double distMax = distanceToArc(locpo, maxR, m_solution_L_max, m_solution_R_max);
439 
440  double distArc = std::min(distMin, distMax);
441 
442  dist = std::min(dist, distArc);
443 
444  if (inside(locpo, 0., 0.)){
445  dist = -dist;
446  }
447  return dist;
448 }
449 
460 std::vector<double>
462 {
463  // change k, d -> phi, d
464  // think: which of two intersection points to chose
465  std::vector<double> solution;
466  double x1;
467  double y1;
468  double x2;
469  double y2;
470 
471  // Intersection of a line with an arc
472  // equation: (1+k^2)*x^2 + (2kd)x + d^2 - R^2 = 0
473  // a x^2 + b x + c = 0
474  double delta = 4. * k * d * k * d - 4. * (1 + k * k) * (d * d - R * R);
475 
476  if (delta < 0){
477  return solution; // Does not intersect (imaginary solutions)
478  }
479  // at least 1 intersect
480  // sol = (-b \pm sqrt(b^2 -4ac))/2a
481  x1 = (-2. * k * d - std::sqrt(delta)) / (2. * (1 + k * k));
482  x2 = (-2. * k * d + std::sqrt(delta)) / (2. * (1 + k * k));
483  // y = grad*x * intercept
484  y1 = k * x1 + d;
485  y2 = k * x2 + d;
486 
487  // Set solution as the one with the highest y-co-ordinate
488  if (y1 > y2) {
489  solution.push_back(x1);
490  solution.push_back(y1);
491  } else {
492  solution.push_back(x2);
493  solution.push_back(y2);
494  }
495  return solution;
496 }
497 
499 double
501  const std::vector<TDD_real_t>& P1,
502  const std::vector<TDD_real_t>& P2)
503 {
504  double P1x = P1[0];
505  double P1y = P1[1];
506  double P2x = P2[0];
507  double P2y = P2[1];
508 
509  double A = P2x - P1x;
510  double B = P2y - P1y;
511  double P3x;
512  double P3y;
513 
514  double X = locpo[Trk::locX];
515  double Y = locpo[Trk::locY];
516 
517  double u = (A * (X - P1x) + B * (Y - P1y)) / (A * A + B * B);
518  if (u <= 0) {
519  P3x = P1x;
520  P3y = P1y;
521  } else if (u >= 1) {
522  P3x = P2x;
523  P3y = P2y;
524  } else {
525  P3x = P1x + u * A;
526  P3y = P1y + u * B;
527  }
528  return std::sqrt((X - P3x) * (X - P3x) + (Y - P3y) * (Y - P3y));
529 }
530 
532 double
534  double R,
535  const std::vector<TDD_real_t>& sL,
536  const std::vector<TDD_real_t>& sR)
537 {
538 
539  double X = locpo[Trk::locX];
540  double Y = locpo[Trk::locY];
541 
542  double tanlocPhi = X / Y;
543  double tanPhi_L = sL[0] / sL[1];
544  double tanPhi_R = sR[0] / sR[1];
545 
546  if (tanlocPhi > tanPhi_L && tanlocPhi < tanPhi_R){
547  return std::fabs(std::sqrt(X * X + Y * Y) - R);
548  }
549 
550  return 9999999999.;
551 }
552 
553 // ellipse and line intersection
554 bool
556  double h,
557  double k,
558  double x1,
559  double y1,
560  double x2,
561  double y2)
562 {
563  // h, k - ellipse axis (h - horizontal, k - vertical)
564  // x1, y1, x2, y2 - define a line
565 
566  // Solving two equations
567  // x*x/(h*h) + y*y/(k*k) = 1
568  //
569  // y = y1 + (y2-y1) * (x-x1) / (x2-x1)
570  //
571 
572  // fast false - if the tolerance is zero
573  if (h == 0 && k == 0)
574  return false;
575 
576  double r;
577  double s;
578  double t;
579  double m;
580  double c;
581  double d;
582 
583  x1 = x1 - locpo[Trk::locX];
584  y1 = y1 - locpo[Trk::locY];
585  x2 = x2 - locpo[Trk::locX];
586  y2 = y2 - locpo[Trk::locY];
587 
588  //
589  if (x1 != x2) {
590  m = (y2 - y1) / (x2 - x1);
591  c = y1 - m * x1;
592 
593  if (h == 0)
594  return (std::fabs(c) < k);
595  if (k == 0)
596  return (std::fabs(c / m) < h);
597 
598  r = m * m * h * h + k * k;
599  s = 2 * m * c * h * h;
600  t = h * h * c * c - h * h * k * k;
601 
602  d = s * s - 4 * r * t;
603 
604  } else {
605  //
606  // vertical line case
607  //
608 
609  d = std::fabs(x1) - h;
610  }
611 
612  return (d >= 0.0); // intersection if d>=0
613 }
614 
615 std::array<std::pair<double, double>, 4> Trk::AnnulusBounds::corners() const {
616 
617  std::array<std::pair<double, double>, 4> corners;
618 
619  corners[0]=std::make_pair(m_solution_R_max.at(0),m_solution_R_max.at(1));
620  corners[1]=std::make_pair(m_solution_R_min.at(0),m_solution_R_min.at(1));
621  corners[2]=std::make_pair(m_solution_L_min.at(0),m_solution_L_min.at(1));
622  corners[3]=std::make_pair(m_solution_L_max.at(0),m_solution_L_max.at(1));
623 
624  return corners;
625 }
626 
627 MsgStream&
628 Trk::AnnulusBounds::dump(MsgStream& sl) const
629 {
630  sl << std::setiosflags(std::ios::fixed);
631  sl << std::setprecision(7);
632  sl << "Trk::AnnulusBounds: (minR, maxR, phi) = "
633  << "(" << m_boundValues[AnnulusBounds::bv_minR] << ", " << m_boundValues[AnnulusBounds::bv_maxR] << ", "
634  << m_boundValues[AnnulusBounds::bv_phi] << ")";
635  sl << std::setprecision(-1);
636  return sl;
637 }
638 
639 std::ostream&
640 Trk::AnnulusBounds::dump(std::ostream& sl) const
641 {
642  sl << std::setiosflags(std::ios::fixed);
643  sl << std::setprecision(7);
644  sl << "Trk::AnnulusBounds: (minR, maxR, phi) = "
645  << "(" << m_boundValues[AnnulusBounds::bv_minR] << ", " << m_boundValues[AnnulusBounds::bv_maxR] << ", "
646  << m_boundValues[AnnulusBounds::bv_phi] << ")";
647  sl << std::setprecision(-1);
648  return sl;
649 }
650 
659 std::array<TDD_real_t,4> Trk::AnnulusBounds::getEdgeLines() const {
660  std::array<TDD_real_t,4> returnArr{};
661  returnArr[0]=m_k_L;
662  returnArr[1]=m_k_R;
663  returnArr[2]=m_d_L;
664  returnArr[3]=m_d_R;
665  return returnArr;
666 }
beamspotman.r
def r
Definition: beamspotman.py:676
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:216
Trk::AmgMatrix
AmgMatrix(3, 3) NeutralParticleParameterCalculator
Definition: NeutralParticleParameterCalculator.cxx:233
Trk::AnnulusBounds::minDistance
virtual double minDistance(const Amg::Vector2D &pos) const override final
Minimal distance to boundary ( > 0 if outside and <=0 if inside)
Definition: AnnulusBounds.cxx:423
Trk::AnnulusBounds::m_solution_L_max
std::vector< TDD_real_t > m_solution_L_max
Definition: AnnulusBounds.h:242
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
Trk::locX
@ locX
Definition: ParamDefs.h:37
Trk::AnnulusBounds::distanceToArc
static double distanceToArc(const Amg::Vector2D &locpo, double R, const std::vector< TDD_real_t > &sL, const std::vector< TDD_real_t > &sR)
Distance to arc.
Definition: AnnulusBounds.cxx:533
Trk::locY
@ locY
local cartesian
Definition: ParamDefs.h:38
Trk::AnnulusBounds::maxR
double maxR() const
This method returns the bigger radius.
Trk::AnnulusBounds::EllipseIntersectLine
static bool EllipseIntersectLine(const Amg::Vector2D &locpo, double h, double k, double x1, double y1, double x2, double y2)
Definition: AnnulusBounds.cxx:555
Amg::Vector2D
Eigen::Matrix< double, 2, 1 > Vector2D
Definition: GeoPrimitives.h:48
Trk::AnnulusBounds::inside
virtual bool inside(const Amg::Vector2D &locpo, double tol1=0., double tol2=0.) const override final
This method returns the opening angle alpha in point A (negative local phi)
Definition: AnnulusBounds.cxx:210
hist_file_dump.d
d
Definition: hist_file_dump.py:137
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
Trk::SurfaceBounds
Definition: SurfaceBounds.h:47
min
constexpr double min()
Definition: ap_fixedTest.cxx:26
Trk::AnnulusBounds
Definition: AnnulusBounds.h:45
plotBeamSpotCompare.x2
x2
Definition: plotBeamSpotCompare.py:218
Trk::SurfaceBounds::swap
void swap(double &b1, double &b2)
Swap method to be called from DiscBounds or TrapezoidalBounds.
Definition: SurfaceBounds.h:133
Trk::AnnulusBounds::m_minYin
TDD_real_t m_minYin
Definition: AnnulusBounds.h:232
yodamerge_tmp.axis
list axis
Definition: yodamerge_tmp.py:241
M_PI
#define M_PI
Definition: ActiveFraction.h:11
Trk::AnnulusBounds::isRight
static bool isRight(const Amg::Vector2D &locpo, double tol1, double tol2, double x1, double y1, double x2, double y2)
Definition: AnnulusBounds.cxx:364
Trk::AnnulusBounds::dump
virtual MsgStream & dump(MsgStream &sl) const override
Output Method for MsgStream.
Definition: AnnulusBounds.cxx:628
Trk::AnnulusBounds::m_k_R
TDD_real_t m_k_R
Definition: AnnulusBounds.h:237
Trk::AnnulusBounds::phi
double phi() const
This method returns the opening angle.
Trk::AnnulusBounds::bv_phi
@ bv_phi
Definition: AnnulusBounds.h:56
Trk::AnnulusBounds::isLeft
static bool isLeft(const Amg::Vector2D &locpo, double tol1, double tol2, double x1, double y1, double x2, double y2)
Definition: AnnulusBounds.cxx:394
TrigInDetValidation_Base.test
test
Definition: TrigInDetValidation_Base.py:147
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
Trk::AnnulusBounds::m_maxXin
TDD_real_t m_maxXin
Definition: AnnulusBounds.h:233
Trk::AnnulusBounds::m_d_R
TDD_real_t m_d_R
Definition: AnnulusBounds.h:239
Trk::AnnulusBounds::m_maxXout
TDD_real_t m_maxXout
Definition: AnnulusBounds.h:228
x
#define x
Trk::AnnulusBounds::m_solution_R_max
std::vector< TDD_real_t > m_solution_R_max
Definition: AnnulusBounds.h:244
Trk::AnnulusBounds::m_maxYout
TDD_real_t m_maxYout
Definition: AnnulusBounds.h:226
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:77
makeTRTBarrelCans.y1
tuple y1
Definition: makeTRTBarrelCans.py:15
Monitored::X
@ X
Definition: HistogramFillerUtils.h:24
Trk::AnnulusBounds::isAbove
static bool isAbove(const Amg::Vector2D &locpo, double tol1, double tol2, double x1, double y1, double x2, double y2)
isAbove() method for checking whether a point lies above or under a straight line
Definition: AnnulusBounds.cxx:344
EllipseCollisionTest::EllipseCollisionTest
EllipseCollisionTest(int maxIterations)
Definition: AnnulusBounds.cxx:118
Trk::BoundaryCheck::EllipseToPoly
std::vector< Amg::Vector2D > EllipseToPoly(int resolution=3) const
Trk::BoundaryCheck::toleranceLoc1
double toleranceLoc1
absolute tolerance in local 1 coordinate
Definition: BoundaryCheck.h:68
A
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
AnnulusBounds.h
Trk::AnnulusBounds::AnnulusBounds
AnnulusBounds()
Default Constructor, needed for persistency.
Definition: AnnulusBounds.cxx:127
Trk::theta
@ theta
Definition: ParamDefs.h:66
extractSporadic.h
list h
Definition: extractSporadic.py:97
makeTRTBarrelCans.y2
tuple y2
Definition: makeTRTBarrelCans.py:18
Trk::AnnulusBounds::m_solution_L_min
std::vector< TDD_real_t > m_solution_L_min
Definition: AnnulusBounds.h:241
Trk::BoundaryCheck::bcType
BoundaryCheckType bcType
Definition: BoundaryCheck.h:70
sign
int sign(int a)
Definition: TRT_StrawNeighbourSvc.h:107
Trk::AnnulusBounds::bv_phiS
@ bv_phiS
Definition: AnnulusBounds.h:57
Trk::sincosCache
Definition: BoundaryCheck.h:45
EllipseCollisionTest::m_maxIterations
int m_maxIterations
Definition: AnnulusBounds.cxx:23
Trk::BoundaryCheck::TestKDOPKDOP
bool TestKDOPKDOP(const std::vector< KDOP > &a, const std::vector< KDOP > &b) const
Trk::AnnulusBounds::minR
double minR() const
This method returns the smaller radius.
drawFromPickle.tan
tan
Definition: drawFromPickle.py:36
EllipseCollisionTest
Definition: AnnulusBounds.cxx:21
AnalysisUtils::Delta::R
double R(const INavigable4Momentum *p1, const double v_eta, const double v_phi)
Definition: AnalysisMisc.h:49
DeMoUpdate.tmp
string tmp
Definition: DeMoUpdate.py:1167
Trk::AnnulusBounds::m_minXout
TDD_real_t m_minXout
Definition: AnnulusBounds.h:229
Trk::AnnulusBounds::distanceToLine
static double distanceToLine(const Amg::Vector2D &locpo, const std::vector< TDD_real_t > &P1, const std::vector< TDD_real_t > &P2)
Distance to line.
Definition: AnnulusBounds.cxx:500
Monitored::Y
@ Y
Definition: HistogramFillerUtils.h:24
Trk::sincosCache::sinC
double sinC
Definition: BoundaryCheck.h:46
Trk::BoundaryCheck::nSigmas
int nSigmas
allowed sigmas for chi2 boundary check
Definition: BoundaryCheck.h:67
Trk::AnnulusBounds::m_minXin
TDD_real_t m_minXin
Definition: AnnulusBounds.h:234
Trk::BoundaryCheck::ComputeKDOP
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.
Trk::AnnulusBounds::bv_R
@ bv_R
Definition: AnnulusBounds.h:55
Trk::BoundaryCheck::FastArcTan
double FastArcTan(double x) const
Trk::AnnulusBounds::phiS
double phiS() const
This method returns the tilt angle.
Trk::AnnulusBounds::bv_minR
@ bv_minR
Definition: AnnulusBounds.h:53
Trk::inside
@ inside
Definition: PropDirection.h:29
EllipseCollisionTest::collide
bool collide(double x0, double y0, double w, double h, double x1, double y1, double r) const
Definition: AnnulusBounds.cxx:92
Trk::AnnulusBounds::getEdgeLines
std::array< TDD_real_t, 4 > getEdgeLines() const
Returns the gradient and y-intercept of the left and right module edges.
Definition: AnnulusBounds.cxx:659
y
#define y
h
Trk::BoundaryCheck
Definition: BoundaryCheck.h:51
Trk::sincosCache::cosC
double cosC
Definition: BoundaryCheck.h:47
Trk::AnnulusBounds::m_solution_R_min
std::vector< TDD_real_t > m_solution_R_min
Definition: AnnulusBounds.h:243
Trk::AnnulusBounds::m_boundValues
std::vector< TDD_real_t > m_boundValues
Definition: AnnulusBounds.h:224
Trk::AnnulusBounds::corners
std::array< std::pair< double, double >, 4 > corners() const
Returns the four corners of the bounds.
Definition: AnnulusBounds.cxx:615
Trk::AnnulusBounds::circleLineIntersection
static std::vector< double > circleLineIntersection(double R, double k, double d)
Circle and line intersection.
Definition: AnnulusBounds.cxx:461
Trk::BoundaryCheck::FastSinCos
sincosCache FastSinCos(double x) const
Trk::BoundaryCheck::toleranceLoc2
double toleranceLoc2
absolute tolerance in local 2 coordinate
Definition: BoundaryCheck.h:69
Trk::phi
@ phi
Definition: ParamDefs.h:75
rr
const boost::regex rr(r_r)
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
python.IoTestsLib.w
def w
Definition: IoTestsLib.py:200
Trk::AnnulusBounds::m_maxYin
TDD_real_t m_maxYin
Definition: AnnulusBounds.h:231
Trk::AnnulusBounds::m_k_L
TDD_real_t m_k_L
Definition: AnnulusBounds.h:236
makeComparison.deltaR
float deltaR
Definition: makeComparison.py:36
python.compressB64.c
def c
Definition: compressB64.py:93
TileDCSDataPlotter.tx
tx
Definition: TileDCSDataPlotter.py:878
Trk::AnnulusBounds::operator==
bool operator==(const SurfaceBounds &annbo) const override
Equality operator.
Definition: AnnulusBounds.cxx:199
Trk::AnnulusBounds::m_d_L
TDD_real_t m_d_L
Definition: AnnulusBounds.h:238
Trk::AnnulusBounds::bv_maxR
@ bv_maxR
Definition: AnnulusBounds.h:54
fitman.k
k
Definition: fitman.py:528
Trk::AnnulusBounds::m_minYout
TDD_real_t m_minYout
Definition: AnnulusBounds.h:227
EllipseCollisionTest::iterate
bool iterate(double x, double y, double c0x, double c0y, double c2x, double c2y, double rr) const
Definition: AnnulusBounds.cxx:24