ATLAS Offline Software
Loading...
Searching...
No Matches
Trk::RectangleBounds Class Referencefinal

Bounds for a rectangular, planar surface. More...

#include <RectangleBounds.h>

Inheritance diagram for Trk::RectangleBounds:
Collaboration diagram for Trk::RectangleBounds:

Public Types

enum  BoundValues { bv_halfX = 0 , bv_halfY = 1 , bv_length = 2 }
 for readability 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
}
 This enumerator simplifies the persistency, by saving a dynamic_cast to happen. More...

Public Member Functions

 RectangleBounds ()
 Default Constructor - needed for persistency.
 RectangleBounds (const RectangleBounds &recbo)
 Copy constructor.
RectangleBoundsoperator= (const RectangleBounds &recbo)
 Assignment Operator.
 RectangleBounds (RectangleBounds &&recbo) noexcept=default
 Move constructor.
RectangleBoundsoperator= (RectangleBounds &&recbo) noexcept=default
 Move Assignment Operator.
virtual ~RectangleBounds ()=default
 Destructor.
 RectangleBounds (double halex, double haley)
 Constructor with halflength in x (phi) and halflength in y (eta)
virtual bool operator== (const SurfaceBounds &sbo) const override final
 Equality operator.
virtual RectangleBoundsclone () const override
 Virtual constructor.
virtual BoundsType type () const override final
 Return the type of the bounds for persistency.
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 bool inside (const Amg::Vector2D &locpo, const BoundaryCheck &bchk) const override final
 This method checks if the provided local coordinates are inside the surface bounds.
virtual bool insideLoc1 (const Amg::Vector2D &locpo, double tol1=0.) const override final
 This method checks inside bounds in loc1.
virtual bool insideLoc2 (const Amg::Vector2D &locpo, double tol2=0.) const override final
 This method checks inside bounds in loc2.
virtual double minDistance (const Amg::Vector2D &pos) const override final
 Minimal distance to boundary ( > 0 if outside and <=0 if inside)
double halflengthPhi () const
 This method returns the halflength in phi (first coordinate of local surface frame)
double halflengthEta () const
 This method returns the halflength in Eta (second coordinate of local surface frame)
double halflengthX () const
 for consistant naming
double halflengthY () const
 for consitant naming
virtual double r () const override
 This method returns the maximal extension on the local plane, i.e.
virtual MsgStream & dump (MsgStream &sl) const override
 Output Method for MsgStream.
virtual std::ostream & dump (std::ostream &sl) const override
 Output Method for std::ostream.
virtual bool operator!= (const SurfaceBounds &sb) const
 Non-Equality operator.

Protected Member Functions

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

Private Attributes

std::vector< TDD_real_tm_boundValues
 The internal version of the bounds can be float/double.

Detailed Description

Bounds for a rectangular, planar surface.

The two local coordinates locX, locY are for legacy reasons also called \( phi \) respectively \( eta \). The orientation with respect to the local surface framce can be seen in the attached illustration.

Author
Andre.nosp@m.as.S.nosp@m.alzbu.nosp@m.rger.nosp@m.@cern.nosp@m..ch

Definition at line 37 of file RectangleBounds.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.

◆ BoundValues

for readability

Enumerator
bv_halfX 
bv_halfY 
bv_length 

Definition at line 42 of file RectangleBounds.h.

Constructor & Destructor Documentation

◆ RectangleBounds() [1/4]

Trk::RectangleBounds::RectangleBounds ( )

Default Constructor - needed for persistency.

Definition at line 18 of file RectangleBounds.cxx.

20{}
std::vector< TDD_real_t > m_boundValues
The internal version of the bounds can be float/double.

◆ RectangleBounds() [2/4]

Trk::RectangleBounds::RectangleBounds ( const RectangleBounds & recbo)

Copy constructor.

Definition at line 31 of file RectangleBounds.cxx.

32 : Trk::SurfaceBounds()
33 , m_boundValues(recbo.m_boundValues)
34{}

◆ RectangleBounds() [3/4]

Trk::RectangleBounds::RectangleBounds ( RectangleBounds && recbo)
defaultnoexcept

Move constructor.

◆ ~RectangleBounds()

virtual Trk::RectangleBounds::~RectangleBounds ( )
virtualdefault

Destructor.

◆ RectangleBounds() [4/4]

Trk::RectangleBounds::RectangleBounds ( double halex,
double haley )

Constructor with halflength in x (phi) and halflength in y (eta)

Definition at line 23 of file RectangleBounds.cxx.

Member Function Documentation

◆ clone()

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

Virtual constructor.

Implements Trk::SurfaceBounds.

◆ dump() [1/2]

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

Output Method for MsgStream.

Implements Trk::SurfaceBounds.

Definition at line 134 of file RectangleBounds.cxx.

135{
136 sl << std::setiosflags(std::ios::fixed);
137 sl << std::setprecision(7);
138 sl << "Trk::RectangleBounds: (halflenghtX, halflengthY) = "
140 sl << std::setprecision(-1);
141 return sl;
142}

◆ dump() [2/2]

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

Output Method for std::ostream.

Implements Trk::SurfaceBounds.

Definition at line 145 of file RectangleBounds.cxx.

146{
147 sl << std::setiosflags(std::ios::fixed);
148 sl << std::setprecision(7);
149 sl << "Trk::RectangleBounds: (halflenghtX, halflengthY) = "
151 sl << std::setprecision(-1);
152 return sl;
153}

◆ halflengthEta()

double Trk::RectangleBounds::halflengthEta ( ) const

This method returns the halflength in Eta (second coordinate of local surface frame)

◆ halflengthPhi()

double Trk::RectangleBounds::halflengthPhi ( ) const

This method returns the halflength in phi (first coordinate of local surface frame)

◆ halflengthX()

double Trk::RectangleBounds::halflengthX ( ) const

for consistant naming

◆ halflengthY()

double Trk::RectangleBounds::halflengthY ( ) const

for consitant naming

◆ initCache()

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

virtual initCache method for object persistency

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

Definition at line 129 of file SurfaceBounds.h.

129{}

◆ inside() [1/2]

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

This method checks if the provided local coordinates are inside the surface bounds.

Implements Trk::SurfaceBounds.

Definition at line 56 of file RectangleBounds.cxx.

58{
59 if (bchk.bcType == 0)
61 locpo, bchk.toleranceLoc1, bchk.toleranceLoc2);
62
63 // a fast FALSE
64 double max_ell = bchk.lCovariance(0, 0) > bchk.lCovariance(1, 1)
65 ? bchk.lCovariance(0, 0)
66 : bchk.lCovariance(1, 1);
67 double limit = bchk.nSigmas * sqrt(max_ell);
68 if (!RectangleBounds::inside(locpo, limit, limit))
69 return false;
70 // a fast TRUE
71 double min_ell = bchk.lCovariance(0, 0) < bchk.lCovariance(1, 1)
72 ? bchk.lCovariance(0, 0)
73 : bchk.lCovariance(1, 1);
74 limit = bchk.nSigmas * sqrt(min_ell);
75 if (RectangleBounds::inside(locpo, limit, limit))
76 return true;
77
78 // compute KDOP and axes for surface polygon
79 std::vector<KDOP> elementKDOP(4);
80 std::vector<Amg::Vector2D> elementP(4);
81 float theta =
82 (bchk.lCovariance(1, 0) != 0 &&
83 (bchk.lCovariance(1, 1) - bchk.lCovariance(0, 0)) != 0)
84 ? .5 * bchk.FastArcTan(2 * bchk.lCovariance(1, 0) /
85 (bchk.lCovariance(1, 1) - bchk.lCovariance(0, 0)))
86 : 0.;
87 sincosCache scResult = bchk.FastSinCos(theta);
88 AmgMatrix(2, 2) rotMatrix;
89 rotMatrix << scResult.cosC, scResult.sinC, -scResult.sinC, scResult.cosC;
90 // ellipse is always at (0,0), surface is moved to ellipse position and then
91 // rotated
92 Amg::Vector2D p;
93 p = Amg::Vector2D (m_boundValues[RectangleBounds::bv_halfX],
95 elementP[0] = (rotMatrix * (p - locpo));
96 p = Amg::Vector2D (m_boundValues[RectangleBounds::bv_halfX],
98 elementP[1] = (rotMatrix * (p - locpo));
99 p = Amg::Vector2D (-m_boundValues[RectangleBounds::bv_halfX],
101 elementP[2] = (rotMatrix * (p - locpo));
102 p = Amg::Vector2D (-m_boundValues[RectangleBounds::bv_halfX],
104 elementP[3] = (rotMatrix * (p - locpo));
105 std::vector<Amg::Vector2D> axis = { elementP[0] - elementP[1],
106 elementP[0] - elementP[2],
107 elementP[0] - elementP[3],
108 elementP[1] - elementP[2] };
109 bchk.ComputeKDOP(elementP, axis, elementKDOP);
110 // compute KDOP for error ellipse
111 std::vector<KDOP> errelipseKDOP(4);
112 bchk.ComputeKDOP(bchk.EllipseToPoly(3), axis, errelipseKDOP);
113 // check if KDOPs overlap and return result
114 return bchk.TestKDOPKDOP(elementKDOP, errelipseKDOP);
115}
#define AmgMatrix(rows, cols)
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.
RectangleBounds()
Default Constructor - needed for persistency.
@ theta
Definition ParamDefs.h:66

◆ inside() [2/2]

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

This method checks if the provided local coordinates are inside the surface bounds.

Implements Trk::SurfaceBounds.

◆ insideLoc1()

virtual bool Trk::RectangleBounds::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

Implements Trk::SurfaceBounds.

◆ insideLoc2()

virtual bool Trk::RectangleBounds::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

Implements Trk::SurfaceBounds.

◆ minDistance()

double Trk::RectangleBounds::minDistance ( const Amg::Vector2D & pos) const
finaloverridevirtual

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

Implements Trk::SurfaceBounds.

Definition at line 118 of file RectangleBounds.cxx.

119{
120 double dx = std::abs(pos[0]) - m_boundValues[RectangleBounds::bv_halfX];
121 double dy = std::abs(pos[1]) - m_boundValues[RectangleBounds::bv_halfY];
122
123 if (dx <= 0. || dy <= 0.) {
124 if (dx > dy){
125 return dx;
126 }
127 return dy;
128 }
129 return sqrt(dx * dx + dy * dy);
130}

◆ 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]

Trk::RectangleBounds & Trk::RectangleBounds::operator= ( const RectangleBounds & recbo)

Assignment Operator.

Definition at line 38 of file RectangleBounds.cxx.

39{
40 if (this != &recbo)
41 m_boundValues = recbo.m_boundValues;
42 return *this;
43}

◆ operator=() [2/2]

RectangleBounds & Trk::RectangleBounds::operator= ( RectangleBounds && recbo)
defaultnoexcept

Move Assignment Operator.

◆ operator==()

bool Trk::RectangleBounds::operator== ( const SurfaceBounds & sbo) const
finaloverridevirtual

Equality operator.

Implements Trk::SurfaceBounds.

Definition at line 46 of file RectangleBounds.cxx.

47{
48 // check the type first not to compare apples with oranges
49 const Trk::RectangleBounds* recbo = dynamic_cast<const Trk::RectangleBounds*>(&sbo);
50 if (!recbo)
51 return false;
52 return (m_boundValues == recbo->m_boundValues);
53}

◆ r()

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

This method returns the maximal extension on the local plane, i.e.

\(s\sqrt{h_{\phi}^2 + h_{\eta}^2}\)

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::RectangleBounds::type ( ) const
inlinefinaloverridevirtual

Return the type of the bounds for persistency.

Implements Trk::SurfaceBounds.

Definition at line 77 of file RectangleBounds.h.

Member Data Documentation

◆ m_boundValues

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

The internal version of the bounds can be float/double.

Definition at line 119 of file RectangleBounds.h.


The documentation for this class was generated from the following files: