ATLAS Offline Software
Public Types | Public Member Functions | Protected Member Functions | Static Private Member Functions | Private Attributes | List of all members
Trk::AnnulusBounds Class Referencefinal

#include <AnnulusBounds.h>

Inheritance diagram for Trk::AnnulusBounds:
Collaboration diagram for Trk::AnnulusBounds:

Public Types

enum  BoundValues {
  bv_minR = 0, bv_maxR = 1, bv_R = 2, bv_phi = 3,
  bv_phiS = 4, bv_length = 5
}
 NB bv_R is the radius of the wafer centre which may different from the assumed surface centre. More...
 
enum  BoundsType {
  Cone = 0, Cylinder = 1, Diamond = 2, Disc = 3,
  Ellipse = 5, Rectangle = 6, RotatedTrapezoid = 7, Trapezoid = 8,
  Triangle = 9, DiscTrapezoidal = 10, Annulus = 11, Other = 12
}
 

Public Member Functions

 AnnulusBounds ()
 Default Constructor, needed for persistency. More...
 
 AnnulusBounds (double minR, double maxR, double R, double phi, double phiS)
 Constructor for AnnulusBounds. More...
 
 AnnulusBounds (const AnnulusBounds &annbo)=default
 Copy constructor. More...
 
AnnulusBoundsoperator= (const AnnulusBounds &sbo)=default
 Assignment operator. More...
 
 AnnulusBounds (AnnulusBounds &&annbo)=default
 Move constructor. More...
 
AnnulusBoundsoperator= (AnnulusBounds &&sbo)=default
 Move assignment. More...
 
virtual ~AnnulusBounds ()=default
 Destructor. More...
 
virtual AnnulusBoundsclone () const override
 Virtual constructor. More...
 
virtual BoundsType type () const override
 Return the type of the bounds for persistency. More...
 
bool operator== (const SurfaceBounds &annbo) const override
 Equality operator. More...
 
double minR () const
 This method returns the smaller radius. More...
 
double maxR () const
 This method returns the bigger radius. More...
 
double waferCentreR () const
 This method returns the R-parameter from design of sensors, which is the radius that the original centre of a silicon wafer ends up at. More...
 
double phi () const
 This method returns the opening angle. More...
 
double phiS () const
 This method returns the tilt angle. More...
 
std::array< std::pair< double, double >, 4 > corners () const
 Returns the four corners of the bounds. More...
 
virtual double r () const override
 This method returns the maximal extension on the local plane. More...
 
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) More...
 
virtual bool inside (const Amg::Vector2D &locpo, const BoundaryCheck &bchk) const override final
 
virtual bool insideLoc1 (const Amg::Vector2D &locpo, double tol1=0.) const override final
 This method checks inside bounds in loc1. More...
 
virtual bool insideLoc2 (const Amg::Vector2D &locpo, double tol2=0.) const override final
 This method checks inside bounds in loc2. More...
 
virtual double minDistance (const Amg::Vector2D &pos) const override final
 Minimal distance to boundary ( > 0 if outside and <=0 if inside) More...
 
virtual MsgStream & dump (MsgStream &sl) const override
 Output Method for MsgStream. More...
 
virtual std::ostream & dump (std::ostream &sl) const override
 Output Method for std::ostream. More...
 
std::array< TDD_real_t, 4 > getEdgeLines () const
 Returns the gradient and y-intercept of the left and right module edges. More...
 
const std::vector< TDD_real_t > & getBoundsValues ()
 
virtual bool operator!= (const SurfaceBounds &sb) const
 Non-Equality operator. More...
 

Protected Member Functions

void swap (double &b1, double &b2)
 Swap method to be called from DiscBounds or TrapezoidalBounds. More...
 
virtual void initCache ()
 virtual initCache method for object persistency More...
 

Static Private Member Functions

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 More...
 
static bool isRight (const Amg::Vector2D &locpo, double tol1, double tol2, double x1, double y1, double x2, double y2)
 
static bool isLeft (const Amg::Vector2D &locpo, double tol1, double tol2, double x1, double y1, double x2, double y2)
 
static bool EllipseIntersectLine (const Amg::Vector2D &locpo, double h, double k, double x1, double y1, double x2, double y2)
 
static double distanceToLine (const Amg::Vector2D &locpo, const std::vector< TDD_real_t > &P1, const std::vector< TDD_real_t > &P2)
 Distance to line. More...
 
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. More...
 
static std::vector< double > circleLineIntersection (double R, double k, double d)
 Circle and line intersection. More...
 

Private Attributes

std::vector< TDD_real_tm_boundValues
 
TDD_real_t m_maxYout
 
TDD_real_t m_minYout
 
TDD_real_t m_maxXout
 
TDD_real_t m_minXout
 
TDD_real_t m_maxYin
 
TDD_real_t m_minYin
 
TDD_real_t m_maxXin
 
TDD_real_t m_minXin
 
TDD_real_t m_k_L
 
TDD_real_t m_k_R
 
TDD_real_t m_d_L
 
TDD_real_t m_d_R
 
std::vector< TDD_real_tm_solution_L_min
 
std::vector< TDD_real_tm_solution_L_max
 
std::vector< TDD_real_tm_solution_R_min
 
std::vector< TDD_real_tm_solution_R_max
 

Detailed Description

Bounds for a annulus-like, planar Surface.


Todo:
can be speed optimized, inner radius check in inside() can be optimized
Author
Marci.nosp@m.n.Wo.nosp@m.lter@.nosp@m.cern.nosp@m..ch

Definition at line 44 of file AnnulusBounds.h.

Member Enumeration Documentation

◆ BoundsType

This enumerator simplifies the persistency, by saving a dynamic_cast to happen.

Other is reserved for the GeometrySurfaces implementation.

Enumerator
Cone 
Cylinder 
Diamond 
Disc 
Ellipse 
Rectangle 
RotatedTrapezoid 
Trapezoid 
Triangle 
DiscTrapezoidal 
Annulus 
Other 

Definition at line 58 of file SurfaceBounds.h.

59  {
60  Cone = 0,
61  Cylinder = 1,
62  Diamond = 2,
63  Disc = 3,
64  Ellipse = 5,
65  Rectangle = 6,
66  RotatedTrapezoid = 7,
67  Trapezoid = 8,
68  Triangle = 9,
69  DiscTrapezoidal = 10,
70  Annulus = 11,
71  Other = 12
72 
73  };

◆ BoundValues

NB bv_R is the radius of the wafer centre which may different from the assumed surface centre.

e.g. if a single wafer/sensor/mdodule has been split into multiple surfaces

  • for readability
Enumerator
bv_minR 
bv_maxR 
bv_R 
bv_phi 
bv_phiS 
bv_length 

Definition at line 51 of file AnnulusBounds.h.

52  {
53  bv_minR = 0,
54  bv_maxR = 1,
55  bv_R = 2,
56  bv_phi = 3,
57  bv_phiS = 4,
58  bv_length = 5
59  };

Constructor & Destructor Documentation

◆ AnnulusBounds() [1/4]

Trk::AnnulusBounds::AnnulusBounds ( )

Default Constructor, needed for persistency.

Definition at line 127 of file AnnulusBounds.cxx.

128  : // Trk::SurfaceBounds()
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 }

◆ AnnulusBounds() [2/4]

Trk::AnnulusBounds::AnnulusBounds ( double  minR,
double  maxR,
double  R,
double  phi,
double  phiS 
)

Constructor for AnnulusBounds.

Definition at line 151 of file AnnulusBounds.cxx.

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 }

◆ AnnulusBounds() [3/4]

Trk::AnnulusBounds::AnnulusBounds ( const AnnulusBounds annbo)
default

Copy constructor.

◆ AnnulusBounds() [4/4]

Trk::AnnulusBounds::AnnulusBounds ( AnnulusBounds &&  annbo)
default

Move constructor.

◆ ~AnnulusBounds()

virtual Trk::AnnulusBounds::~AnnulusBounds ( )
virtualdefault

Destructor.

Member Function Documentation

◆ circleLineIntersection()

std::vector< double > Trk::AnnulusBounds::circleLineIntersection ( double  R,
double  k,
double  d 
)
staticprivate

Circle and line intersection.


Circle is of radius R and centred at the origin. Line takes the form y = kx + d

Parameters
RRadius of the circle
kGradient of the line
dIntercept of the line
Returns
Co-ordinates of the intercept with highest y

Definition at line 461 of file AnnulusBounds.cxx.

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 }

◆ clone()

virtual AnnulusBounds* Trk::AnnulusBounds::clone ( ) const
overridevirtual

Virtual constructor.

Implements Trk::SurfaceBounds.

◆ corners()

std::array< std::pair< double, double >, 4 > Trk::AnnulusBounds::corners ( ) const

Returns the four corners of the bounds.

Returns the module corners starting from the upper right (max R, pos locX) and proceding clock-wise, i.e. (max R; pos locX), (min R; pos locX), (min R; neg loc X), (max R; neg locX).

This method is only intended for debug purposes. If used for production code, this should be changed to a return-by-reference. This will necessitate the vector being stored in the class.

Returns
array of pairs of doubles giving the (R, x) of each corner clockwise from upper-right

Definition at line 615 of file AnnulusBounds.cxx.

615  {
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 }

◆ distanceToArc()

double Trk::AnnulusBounds::distanceToArc ( const Amg::Vector2D locpo,
double  R,
const std::vector< TDD_real_t > &  sL,
const std::vector< TDD_real_t > &  sR 
)
staticprivate

Distance to arc.

Definition at line 533 of file AnnulusBounds.cxx.

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 }

◆ distanceToLine()

double Trk::AnnulusBounds::distanceToLine ( const Amg::Vector2D locpo,
const std::vector< TDD_real_t > &  P1,
const std::vector< TDD_real_t > &  P2 
)
staticprivate

Distance to line.

Definition at line 500 of file AnnulusBounds.cxx.

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 }

◆ dump() [1/2]

MsgStream & Trk::AnnulusBounds::dump ( MsgStream &  sl) const
overridevirtual

Output Method for MsgStream.

Implements Trk::SurfaceBounds.

Definition at line 628 of file AnnulusBounds.cxx.

629 {
630  sl << std::setiosflags(std::ios::fixed);
631  sl << std::setprecision(7);
632  sl << "Trk::AnnulusBounds: (minR, maxR, phi) = "
635  sl << std::setprecision(-1);
636  return sl;
637 }

◆ dump() [2/2]

std::ostream & Trk::AnnulusBounds::dump ( std::ostream &  sl) const
overridevirtual

Output Method for std::ostream.

Implements Trk::SurfaceBounds.

Definition at line 640 of file AnnulusBounds.cxx.

641 {
642  sl << std::setiosflags(std::ios::fixed);
643  sl << std::setprecision(7);
644  sl << "Trk::AnnulusBounds: (minR, maxR, phi) = "
647  sl << std::setprecision(-1);
648  return sl;
649 }

◆ EllipseIntersectLine()

bool Trk::AnnulusBounds::EllipseIntersectLine ( const Amg::Vector2D locpo,
double  h,
double  k,
double  x1,
double  y1,
double  x2,
double  y2 
)
staticprivate

Definition at line 555 of file AnnulusBounds.cxx.

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 }

◆ getBoundsValues()

const std::vector<TDD_real_t>& Trk::AnnulusBounds::getBoundsValues ( )

◆ getEdgeLines()

std::array< TDD_real_t, 4 > Trk::AnnulusBounds::getEdgeLines ( ) const

Returns the gradient and y-intercept of the left and right module edges.

This method is only intended for debug purposes. If used for production code, this should be changed to a return-by-reference. This will necessitate the vector being stored in the class.

Returns
Vector with the gradients (m) and intercepts (c) of the left (_L) and right (_R) edges. [m_L, m_R, c_L, c_R]

This method is only intended for debug purposes. If used for production code, this should be changed to a return-by-reference. This will necessitate the vector being stored in the class.

Returns
Array with the gradients (m) and intercepts (c) of the left (_L) and right (_R) edges. [m_L, m_R, c_L, c_R]. Use as auto [m_L, m_R, c_L, c_R] = bounds.getEdgeLines();.

Definition at line 659 of file AnnulusBounds.cxx.

659  {
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 }

◆ initCache()

virtual void Trk::SurfaceBounds::initCache ( )
inlineprotectedvirtualinherited

virtual initCache method for object persistency

Reimplemented in Trk::RotatedTrapezoidBounds, Trk::ConeBounds, Trk::RotatedDiamondBounds, and Trk::DiamondBounds.

Definition at line 129 of file SurfaceBounds.h.

129 {}

◆ inside() [1/2]

bool Trk::AnnulusBounds::inside ( const Amg::Vector2D locpo,
const BoundaryCheck bchk 
) const
finaloverridevirtual

Implements Trk::SurfaceBounds.

Definition at line 248 of file AnnulusBounds.cxx.

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);
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
306  Amg::Vector2D p;
308  elementP[0] = (rotMatrix * (p - locpo));
309 
311  elementP[1] = (rotMatrix * (p - locpo));
312 
314  elementP[2] = (rotMatrix * (p - locpo));
315 
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 =
334 
335  if (condLine){
336  return condR;
337  }
338 
339  return (condR && condSide);
340 }

◆ inside() [2/2]

bool Trk::AnnulusBounds::inside ( const Amg::Vector2D locpo,
double  tol1 = 0.,
double  tol2 = 0. 
) const
finaloverridevirtual

This method returns the opening angle alpha in point A (negative local phi)

This method returns the opening angle beta in point B (positive local phi) The orientation of the Trapezoid is according to the figure above, in words: the shorter of the two parallel sides of the trapezoid intersects with the negative \( y \) - axis of the local frame.


The cases are:
(0) \( y \) or \( x \) bounds are 0 || 0
(1) LocalPosition is outside \( y \) bounds
(2) LocalPosition is inside \( y \) bounds, but outside maximum \( x \) bounds
(3) LocalPosition is inside \( y \) bounds AND inside minimum \( x \) bounds
(4) LocalPosition is inside \( y \) bounds AND inside maximum \( x \) bounds, so that it depends on the \( eta \) coordinate (5) LocalPosition fails test of (4)

The inside check is done using single equations of straight lines and one has to take care if a point lies on the positive \( x \) half area(I) or the negative one(II). Denoting \( |x_{min}| \) and \( | x_{max} | \) as minHalfX respectively maxHalfX, such as \( | y_{H} | \) as halfY, the equations for the straing lines in (I) and (II) can be written as:

  • (I): \( y = \kappa_{I} x + \delta_{I} \)
  • (II): \( y = \kappa_{II} x + \delta_{II} \) ,

    where \( \kappa_{I} = - \kappa_{II} = 2 \frac{y_{H}}{x_{max} - x_{min}} \)
    and \( \delta_{I} = \delta_{II} = - \frac{1}{2}\kappa_{I}(x_{max} + x_{min}) \)

Implements Trk::SurfaceBounds.

Definition at line 210 of file AnnulusBounds.cxx.

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 
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 }

◆ insideLoc1()

virtual bool Trk::AnnulusBounds::insideLoc1 ( const Amg::Vector2D locpo,
double  tol1 = 0. 
) const
finaloverridevirtual

This method checks inside bounds in loc1.

  • loc1/loc2 correspond to the natural coordinates of the surface
  • As loc1/loc2 are correlated the single check doesn't make sense : -> check is done on enclosing Rectangle !

Implements Trk::SurfaceBounds.

◆ insideLoc2()

virtual bool Trk::AnnulusBounds::insideLoc2 ( const Amg::Vector2D locpo,
double  tol2 = 0. 
) const
finaloverridevirtual

This method checks inside bounds in loc2.

  • loc1/loc2 correspond to the natural coordinates of the surface
  • As loc1/loc2 are correlated the single check doesn't make sense : -> check is done on enclosing Rectangle !

Implements Trk::SurfaceBounds.

◆ isAbove()

bool Trk::AnnulusBounds::isAbove ( const Amg::Vector2D locpo,
double  tol1,
double  tol2,
double  x1,
double  y1,
double  x2,
double  y2 
)
staticprivate

isAbove() method for checking whether a point lies above or under a straight line

Definition at line 344 of file AnnulusBounds.cxx.

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 }

◆ isLeft()

bool Trk::AnnulusBounds::isLeft ( const Amg::Vector2D locpo,
double  tol1,
double  tol2,
double  x1,
double  y1,
double  x2,
double  y2 
)
staticprivate

Definition at line 394 of file AnnulusBounds.cxx.

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 }

◆ isRight()

bool Trk::AnnulusBounds::isRight ( const Amg::Vector2D locpo,
double  tol1,
double  tol2,
double  x1,
double  y1,
double  x2,
double  y2 
)
staticprivate

Definition at line 364 of file AnnulusBounds.cxx.

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 }

◆ maxR()

double Trk::AnnulusBounds::maxR ( ) const

This method returns the bigger radius.

◆ minDistance()

double Trk::AnnulusBounds::minDistance ( const Amg::Vector2D pos) const
finaloverridevirtual

Minimal distance to boundary ( > 0 if outside and <=0 if inside)

Implements Trk::SurfaceBounds.

Definition at line 423 of file AnnulusBounds.cxx.

424 {
425 
426  // Calculate four corner points - crossings of an arc with a line
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 }

◆ minR()

double Trk::AnnulusBounds::minR ( ) const

This method returns the smaller radius.

◆ operator!=()

bool Trk::SurfaceBounds::operator!= ( const SurfaceBounds sb) const
inlinevirtualinherited

Non-Equality operator.

Reimplemented in Trk::InvalidBounds.

Definition at line 141 of file SurfaceBounds.h.

142 {
143  return !((*this) == sb);
144 }

◆ operator=() [1/2]

AnnulusBounds& Trk::AnnulusBounds::operator= ( AnnulusBounds &&  sbo)
default

Move assignment.

◆ operator=() [2/2]

AnnulusBounds& Trk::AnnulusBounds::operator= ( const AnnulusBounds sbo)
default

Assignment operator.

◆ operator==()

bool Trk::AnnulusBounds::operator== ( const SurfaceBounds annbo) const
overridevirtual

Equality operator.

Implements Trk::SurfaceBounds.

Definition at line 199 of file AnnulusBounds.cxx.

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 }

◆ phi()

double Trk::AnnulusBounds::phi ( ) const

This method returns the opening angle.

◆ phiS()

double Trk::AnnulusBounds::phiS ( ) const

This method returns the tilt angle.

◆ r()

virtual double Trk::AnnulusBounds::r ( ) const
overridevirtual

This method returns the maximal extension on the local plane.

Implements Trk::SurfaceBounds.

◆ swap()

void Trk::SurfaceBounds::swap ( double &  b1,
double &  b2 
)
inlineprotectedinherited

Swap method to be called from DiscBounds or TrapezoidalBounds.

Definition at line 133 of file SurfaceBounds.h.

134 {
135  double tmp = b1;
136  b1 = b2;
137  b2 = tmp;
138 }

◆ type()

virtual BoundsType Trk::AnnulusBounds::type ( ) const
inlineoverridevirtual

Return the type of the bounds for persistency.

Implements Trk::SurfaceBounds.

Definition at line 82 of file AnnulusBounds.h.

82 { return SurfaceBounds::Annulus; }

◆ waferCentreR()

double Trk::AnnulusBounds::waferCentreR ( ) const

This method returns the R-parameter from design of sensors, which is the radius that the original centre of a silicon wafer ends up at.

It is therefore common to all surfaces on the same wafer and can be different from the assume surface centre

Member Data Documentation

◆ m_boundValues

std::vector<TDD_real_t> Trk::AnnulusBounds::m_boundValues
private

Definition at line 224 of file AnnulusBounds.h.

◆ m_d_L

TDD_real_t Trk::AnnulusBounds::m_d_L
private

Definition at line 238 of file AnnulusBounds.h.

◆ m_d_R

TDD_real_t Trk::AnnulusBounds::m_d_R
private

Definition at line 239 of file AnnulusBounds.h.

◆ m_k_L

TDD_real_t Trk::AnnulusBounds::m_k_L
private

Definition at line 236 of file AnnulusBounds.h.

◆ m_k_R

TDD_real_t Trk::AnnulusBounds::m_k_R
private

Definition at line 237 of file AnnulusBounds.h.

◆ m_maxXin

TDD_real_t Trk::AnnulusBounds::m_maxXin
private

Definition at line 233 of file AnnulusBounds.h.

◆ m_maxXout

TDD_real_t Trk::AnnulusBounds::m_maxXout
private

Definition at line 228 of file AnnulusBounds.h.

◆ m_maxYin

TDD_real_t Trk::AnnulusBounds::m_maxYin
private

Definition at line 231 of file AnnulusBounds.h.

◆ m_maxYout

TDD_real_t Trk::AnnulusBounds::m_maxYout
private

Definition at line 226 of file AnnulusBounds.h.

◆ m_minXin

TDD_real_t Trk::AnnulusBounds::m_minXin
private

Definition at line 234 of file AnnulusBounds.h.

◆ m_minXout

TDD_real_t Trk::AnnulusBounds::m_minXout
private

Definition at line 229 of file AnnulusBounds.h.

◆ m_minYin

TDD_real_t Trk::AnnulusBounds::m_minYin
private

Definition at line 232 of file AnnulusBounds.h.

◆ m_minYout

TDD_real_t Trk::AnnulusBounds::m_minYout
private

Definition at line 227 of file AnnulusBounds.h.

◆ m_solution_L_max

std::vector<TDD_real_t> Trk::AnnulusBounds::m_solution_L_max
private

Definition at line 242 of file AnnulusBounds.h.

◆ m_solution_L_min

std::vector<TDD_real_t> Trk::AnnulusBounds::m_solution_L_min
private

Definition at line 241 of file AnnulusBounds.h.

◆ m_solution_R_max

std::vector<TDD_real_t> Trk::AnnulusBounds::m_solution_R_max
private

Definition at line 244 of file AnnulusBounds.h.

◆ m_solution_R_min

std::vector<TDD_real_t> Trk::AnnulusBounds::m_solution_R_min
private

Definition at line 243 of file AnnulusBounds.h.


The documentation for this class was generated from the following files:
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:216
Trk::AmgMatrix
AmgMatrix(3, 3) NeutralParticleParameterCalculator
Definition: NeutralParticleParameterCalculator.cxx:233
Trk::SurfaceBounds::DiscTrapezoidal
@ DiscTrapezoidal
Definition: SurfaceBounds.h:69
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
max
#define max(a, b)
Definition: cfImp.cxx:41
Trk::SurfaceBounds::Cone
@ Cone
Definition: SurfaceBounds.h:60
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
Trk::SurfaceBounds::Rectangle
@ Rectangle
Definition: SurfaceBounds.h:65
hist_file_dump.d
d
Definition: hist_file_dump.py:137
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::SurfaceBounds::Annulus
@ Annulus
Definition: SurfaceBounds.h:70
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
Trk::SurfaceBounds::Diamond
@ Diamond
Definition: SurfaceBounds.h:62
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
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
dqt_zlumi_alleff_HIST.A
A
Definition: dqt_zlumi_alleff_HIST.py:110
A
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
Trk::AnnulusBounds::AnnulusBounds
AnnulusBounds()
Default Constructor, needed for persistency.
Definition: AnnulusBounds.cxx:127
Trk::theta
@ theta
Definition: ParamDefs.h:66
vector
Definition: MultiHisto.h:13
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
sign
int sign(int a)
Definition: TRT_StrawNeighbourSvc.h:107
Trk::AnnulusBounds::bv_phiS
@ bv_phiS
Definition: AnnulusBounds.h:57
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
min
#define min(a, b)
Definition: cfImp.cxx:40
Monitored::Y
@ Y
Definition: HistogramFillerUtils.h:24
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
keylayer_zslicemap.sb
sb
Definition: keylayer_zslicemap.py:192
Amg
Definition of ATLAS Math & Geometry primitives (Amg)
Definition: AmgStringHelpers.h:19
Trk::AnnulusBounds::m_minXin
TDD_real_t m_minXin
Definition: AnnulusBounds.h:234
dqt_zlumi_alleff_HIST.B
B
Definition: dqt_zlumi_alleff_HIST.py:110
Trk::SurfaceBounds::Trapezoid
@ Trapezoid
Definition: SurfaceBounds.h:67
Trk::AnnulusBounds::bv_R
@ bv_R
Definition: AnnulusBounds.h:55
Trk::AnnulusBounds::phiS
double phiS() const
This method returns the tilt angle.
Trk::AnnulusBounds::bv_minR
@ bv_minR
Definition: AnnulusBounds.h:53
Trk::AnnulusBounds::bv_length
@ bv_length
Definition: AnnulusBounds.h:58
h
Trk::SurfaceBounds::Disc
@ Disc
Definition: SurfaceBounds.h:63
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
if
if(febId1==febId2)
Definition: LArRodBlockPhysicsV0.cxx:567
Trk::AnnulusBounds::circleLineIntersection
static std::vector< double > circleLineIntersection(double R, double k, double d)
Circle and line intersection.
Definition: AnnulusBounds.cxx:461
Trk::AnnulusBounds::r
virtual double r() const override
This method returns the maximal extension on the local plane.
Trk::SurfaceBounds::RotatedTrapezoid
@ RotatedTrapezoid
Definition: SurfaceBounds.h:66
Trk::SurfaceBounds::Other
@ Other
Definition: SurfaceBounds.h:71
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::SurfaceBounds::Triangle
@ Triangle
Definition: SurfaceBounds.h:68
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
Trk::SurfaceBounds::Ellipse
@ Ellipse
Definition: SurfaceBounds.h:64
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::SurfaceBounds::Cylinder
@ Cylinder
Definition: SurfaceBounds.h:61
Trk::AnnulusBounds::m_minYout
TDD_real_t m_minYout
Definition: AnnulusBounds.h:227