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

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

 RectangleBounds ()
 Default Constructor - needed for persistency. More...
 
 RectangleBounds (const RectangleBounds &recbo)
 Copy constructor. More...
 
RectangleBoundsoperator= (const RectangleBounds &recbo)
 Assignment Operator. More...
 
 RectangleBounds (RectangleBounds &&recbo) noexcept=default
 Move constructor. More...
 
RectangleBoundsoperator= (RectangleBounds &&recbo) noexcept=default
 Move Assignment Operator. More...
 
virtual ~RectangleBounds ()=default
 Destructor. More...
 
 RectangleBounds (double halex, double haley)
 Constructor with halflength in x (phi) and halflength in y (eta) More...
 
virtual bool operator== (const SurfaceBounds &sbo) const override final
 Equality operator. More...
 
virtual RectangleBoundsclone () const override
 Virtual constructor. More...
 
virtual BoundsType type () const override final
 Return the type of the bounds for persistency. More...
 
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. More...
 
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. More...
 
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...
 
double halflengthPhi () const
 This method returns the halflength in phi (first coordinate of local surface frame) More...
 
double halflengthEta () const
 This method returns the halflength in Eta (second coordinate of local surface frame) More...
 
double halflengthX () const
 for consistant naming More...
 
double halflengthY () const
 for consitant naming More...
 
virtual double r () const override
 This method returns the maximal extension on the local plane, i.e. 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...
 
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...
 

Private Attributes

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

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.

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

for readability

Enumerator
bv_halfX 
bv_halfY 
bv_length 

Definition at line 42 of file RectangleBounds.h.

43  {
44  bv_halfX = 0,
45  bv_halfY = 1,
46  bv_length = 2
47  };

Constructor & Destructor Documentation

◆ RectangleBounds() [1/4]

Trk::RectangleBounds::RectangleBounds ( )

Default Constructor - needed for persistency.

Definition at line 18 of file RectangleBounds.cxx.

◆ RectangleBounds() [2/4]

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

Copy constructor.

Definition at line 31 of file RectangleBounds.cxx.

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::RotatedTrapezoidBounds, Trk::ConeBounds, Trk::RotatedDiamondBounds, and Trk::DiamondBounds.

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;
95  elementP[0] = (rotMatrix * (p - locpo));
98  elementP[1] = (rotMatrix * (p - locpo));
101  elementP[2] = (rotMatrix * (p - locpo));
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 }

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

77 { return SurfaceBounds::Rectangle; }

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:
Trk::RectangleBounds::bv_length
@ bv_length
Definition: RectangleBounds.h:46
Trk::RectangleBounds
Definition: RectangleBounds.h:38
Trk::AmgMatrix
AmgMatrix(3, 3) NeutralParticleParameterCalculator
Definition: NeutralParticleParameterCalculator.cxx:233
Trk::SurfaceBounds::DiscTrapezoidal
@ DiscTrapezoidal
Definition: SurfaceBounds.h:69
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
Trk::SurfaceBounds::Cone
@ Cone
Definition: SurfaceBounds.h:60
Amg::Vector2D
Eigen::Matrix< double, 2, 1 > Vector2D
Definition: GeoPrimitives.h:48
Trk::SurfaceBounds::Rectangle
@ Rectangle
Definition: SurfaceBounds.h:65
Trk::SurfaceBounds
Definition: SurfaceBounds.h:47
Trk::RectangleBounds::bv_halfX
@ bv_halfX
Definition: RectangleBounds.h:44
yodamerge_tmp.axis
list axis
Definition: yodamerge_tmp.py:241
Trk::SurfaceBounds::Annulus
@ Annulus
Definition: SurfaceBounds.h:70
Trk::SurfaceBounds::Diamond
@ Diamond
Definition: SurfaceBounds.h:62
Trk::RectangleBounds::bv_halfY
@ bv_halfY
Definition: RectangleBounds.h:45
Trk::RectangleBounds::inside
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.
Trk::theta
@ theta
Definition: ParamDefs.h:72
vector
Definition: MultiHisto.h:13
DeMoUpdate.tmp
string tmp
Definition: DeMoUpdate.py:1167
keylayer_zslicemap.sb
sb
Definition: keylayer_zslicemap.py:192
Amg
Definition of ATLAS Math & Geometry primitives (Amg)
Definition: AmgStringHelpers.h:19
Trk::SurfaceBounds::Trapezoid
@ Trapezoid
Definition: SurfaceBounds.h:67
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
makeTRTBarrelCans.dy
tuple dy
Definition: makeTRTBarrelCans.py:21
Trk::RectangleBounds::m_boundValues
std::vector< TDD_real_t > m_boundValues
The internal version of the bounds can be float/double.
Definition: RectangleBounds.h:119
Trk::SurfaceBounds::Disc
@ Disc
Definition: SurfaceBounds.h:63
makeTRTBarrelCans.dx
tuple dx
Definition: makeTRTBarrelCans.py:20
Trk::SurfaceBounds::RotatedTrapezoid
@ RotatedTrapezoid
Definition: SurfaceBounds.h:66
Trk::SurfaceBounds::Other
@ Other
Definition: SurfaceBounds.h:71
Trk::SurfaceBounds::Triangle
@ Triangle
Definition: SurfaceBounds.h:68
updateCoolNtuple.limit
int limit
Definition: updateCoolNtuple.py:45
Trk::SurfaceBounds::Ellipse
@ Ellipse
Definition: SurfaceBounds.h:64
Trk::RectangleBounds::RectangleBounds
RectangleBounds()
Default Constructor - needed for persistency.
Definition: RectangleBounds.cxx:18
Trk::SurfaceBounds::Cylinder
@ Cylinder
Definition: SurfaceBounds.h:61