|
ATLAS Offline Software
|
#include <AnnulusBounds.h>
|
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
} |
|
|
| 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...
|
|
AnnulusBounds & | operator= (const AnnulusBounds &sbo)=default |
| Assignment operator. More...
|
|
| AnnulusBounds (AnnulusBounds &&annbo)=default |
| Move constructor. More...
|
|
AnnulusBounds & | operator= (AnnulusBounds &&sbo)=default |
| Move assignment. More...
|
|
virtual | ~AnnulusBounds ()=default |
| Destructor. More...
|
|
virtual AnnulusBounds * | clone () 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...
|
|
|
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 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...
|
|
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.
◆ 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.
◆ 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
Enumerator |
---|
bv_minR | |
bv_maxR | |
bv_R | |
bv_phi | |
bv_phiS | |
bv_length | |
Definition at line 51 of file AnnulusBounds.h.
◆ AnnulusBounds() [1/4]
Trk::AnnulusBounds::AnnulusBounds |
( |
| ) |
|
◆ 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.
174 std::vector<TDD_real_t> XX;
180 std::vector<TDD_real_t> YY;
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());
◆ AnnulusBounds() [3/4]
◆ AnnulusBounds() [4/4]
◆ ~AnnulusBounds()
virtual Trk::AnnulusBounds::~AnnulusBounds |
( |
| ) |
|
|
virtualdefault |
◆ 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
-
R | Radius of the circle |
k | Gradient of the line |
d | Intercept of the line |
- Returns
- Co-ordinates of the intercept with highest y
Definition at line 461 of file AnnulusBounds.cxx.
465 std::vector<double> solution;
474 double delta = 4. *
k *
d *
k *
d - 4. * (1 +
k *
k) * (
d *
d -
R *
R);
481 x1 = (-2. *
k *
d - std::sqrt(delta)) / (2. * (1 +
k *
k));
482 x2 = (-2. *
k *
d + std::sqrt(delta)) / (2. * (1 +
k *
k));
489 solution.push_back(
x1);
490 solution.push_back(
y1);
492 solution.push_back(
x2);
493 solution.push_back(
y2);
◆ clone()
◆ 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.
617 std::array<std::pair<double, double>, 4>
corners;
◆ distanceToArc()
Distance to arc.
Definition at line 533 of file AnnulusBounds.cxx.
542 double tanlocPhi =
X /
Y;
543 double tanPhi_L = sL[0] / sL[1];
544 double tanPhi_R = sR[0] / sR[1];
546 if (tanlocPhi > tanPhi_L && tanlocPhi < tanPhi_R){
547 return std::fabs(std::sqrt(
X *
X +
Y *
Y) -
R);
◆ distanceToLine()
Distance to line.
Definition at line 500 of file AnnulusBounds.cxx.
509 double A = P2x - P1x;
510 double B = P2y - P1y;
517 double u = (
A * (
X - P1x) +
B * (
Y - P1y)) / (
A *
A +
B *
B);
528 return std::sqrt((
X - P3x) * (
X - P3x) + (
Y - P3y) * (
Y - P3y));
◆ 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.
630 sl << std::setiosflags(std::ios::fixed);
631 sl << std::setprecision(7);
632 sl <<
"Trk::AnnulusBounds: (minR, maxR, phi) = "
635 sl << std::setprecision(-1);
◆ 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.
642 sl << std::setiosflags(std::ios::fixed);
643 sl << std::setprecision(7);
644 sl <<
"Trk::AnnulusBounds: (minR, maxR, phi) = "
647 sl << std::setprecision(-1);
◆ 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.
573 if (
h == 0 &&
k == 0)
594 return (std::fabs(
c) <
k);
596 return (std::fabs(
c /
m) <
h);
599 s = 2 *
m *
c *
h *
h;
602 d =
s *
s - 4 *
r *
t;
609 d = std::fabs(
x1) -
h;
◆ 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.
660 std::array<TDD_real_t,4> returnArr{};
◆ initCache()
virtual void Trk::SurfaceBounds::initCache |
( |
| ) |
|
|
inlineprotectedvirtualinherited |
◆ inside() [1/2]
Implements Trk::SurfaceBounds.
Definition at line 248 of file AnnulusBounds.cxx.
251 if (bchk.bcType == 0 || bchk.nSigmas == 0)
254 sincosCache scResult = bchk.FastSinCos(locpo(1, 0));
259 AmgMatrix(2, 2) lCovarianceCar = bchk.lCovariance;
262 double w = bchk.nSigmas * std::sqrt(lCovarianceCar(0, 0));
263 double h = bchk.nSigmas * std::sqrt(lCovarianceCar(1, 1));
266 double maxTol = std::
max(
w,
h);
267 double minTol = std::
min(
w,
h);
268 double localY = locpo[
Trk::
locY];
272 double localX = locpo[
Trk::
locX];
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)))
285 scResult = bchk.FastSinCos(
theta);
287 rotMatrix << scResult.cosC, scResult.sinC,
288 -scResult.sinC, scResult.cosC;
290 double x1 =
tmp(0, 0);
291 double y1 =
tmp(1, 0);
295 bool condR = (
test.collide(x0, y0,
w,
h,
x1,
y1, -
minR) &&
test.collide(x0, y0,
w,
h,
x1,
y1,
maxR));
298 std::
vector<KDOP> elementKDOP(4);
303 normal << 0, -1, 1, 0;
308 elementP[0] = (rotMatrix * (
p - locpo));
311 elementP[1] = (rotMatrix * (
p - locpo));
314 elementP[2] = (rotMatrix * (
p - locpo));
317 elementP[3] = (rotMatrix * (
p - locpo));
320 normal * (elementP[1] - elementP[2]),
321 normal * (elementP[2] - elementP[3]),
322 normal * (elementP[3] - elementP[0]) };
323 bchk.ComputeKDOP(elementP,
axis, elementKDOP);
325 std::vector<KDOP> errelipseKDOP(4);
326 bchk.ComputeKDOP(bchk.EllipseToPoly(4),
axis, errelipseKDOP);
328 bool condSide = bchk.TestKDOPKDOP(elementKDOP, errelipseKDOP);
339 return (condR && condSide);
◆ 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.
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);
238 bool condRad = (localR < maxR + deltaR && localR >
minR -
deltaR);
244 return (condRad && condL && condR);
◆ 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 |
◆ isLeft()
bool Trk::AnnulusBounds::isLeft |
( |
const Amg::Vector2D & |
locpo, |
|
|
double |
tol1, |
|
|
double |
tol2, |
|
|
double |
x1, |
|
|
double |
y1, |
|
|
double |
x2, |
|
|
double |
y2 |
|
) |
| |
|
staticprivate |
◆ isRight()
bool Trk::AnnulusBounds::isRight |
( |
const Amg::Vector2D & |
locpo, |
|
|
double |
tol1, |
|
|
double |
tol2, |
|
|
double |
x1, |
|
|
double |
y1, |
|
|
double |
x2, |
|
|
double |
y2 |
|
) |
| |
|
staticprivate |
◆ maxR()
double Trk::AnnulusBounds::maxR |
( |
| ) |
const |
This method returns the bigger radius.
◆ minDistance()
◆ minR()
double Trk::AnnulusBounds::minR |
( |
| ) |
const |
This method returns the smaller radius.
◆ operator!=()
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ operator==()
◆ 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 |
◆ type()
virtual BoundsType Trk::AnnulusBounds::type |
( |
| ) |
const |
|
inlineoverridevirtual |
◆ 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
◆ m_boundValues
std::vector<TDD_real_t> Trk::AnnulusBounds::m_boundValues |
|
private |
◆ m_d_L
◆ m_d_R
◆ m_k_L
◆ m_k_R
◆ m_maxXin
◆ m_maxXout
◆ m_maxYin
◆ m_maxYout
◆ m_minXin
◆ m_minXout
◆ m_minYin
◆ m_minYout
◆ m_solution_L_max
std::vector<TDD_real_t> Trk::AnnulusBounds::m_solution_L_max |
|
private |
◆ m_solution_L_min
std::vector<TDD_real_t> Trk::AnnulusBounds::m_solution_L_min |
|
private |
◆ m_solution_R_max
std::vector<TDD_real_t> Trk::AnnulusBounds::m_solution_R_max |
|
private |
◆ m_solution_R_min
std::vector<TDD_real_t> Trk::AnnulusBounds::m_solution_R_min |
|
private |
The documentation for this class was generated from the following files:
AmgMatrix(3, 3) NeutralParticleParameterCalculator
std::vector< TDD_real_t > m_solution_L_max
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.
double maxR() const
This method returns the bigger radius.
static bool EllipseIntersectLine(const Amg::Vector2D &locpo, double h, double k, double x1, double y1, double x2, double y2)
Eigen::Matrix< double, 2, 1 > Vector2D
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)
void swap(double &b1, double &b2)
Swap method to be called from DiscBounds or TrapezoidalBounds.
static bool isRight(const Amg::Vector2D &locpo, double tol1, double tol2, double x1, double y1, double x2, double y2)
double phi() const
This method returns the opening angle.
static bool isLeft(const Amg::Vector2D &locpo, double tol1, double tol2, double x1, double y1, double x2, double y2)
std::vector< TDD_real_t > m_solution_R_max
@ u
Enums for curvilinear frames.
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
AnnulusBounds()
Default Constructor, needed for persistency.
std::vector< TDD_real_t > m_solution_L_min
double minR() const
This method returns the smaller radius.
double R(const INavigable4Momentum *p1, const double v_eta, const double v_phi)
static double distanceToLine(const Amg::Vector2D &locpo, const std::vector< TDD_real_t > &P1, const std::vector< TDD_real_t > &P2)
Distance to line.
Ensure that the ATLAS eigen extensions are properly loaded.
Definition of ATLAS Math & Geometry primitives (Amg)
double phiS() const
This method returns the tilt angle.
std::vector< TDD_real_t > m_solution_R_min
std::vector< TDD_real_t > m_boundValues
std::array< std::pair< double, double >, 4 > corners() const
Returns the four corners of the bounds.
static std::vector< double > circleLineIntersection(double R, double k, double d)
Circle and line intersection.
virtual double r() const override
This method returns the maximal extension on the local plane.