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

Class to describe the bounds for a planar EllipseSurface, i.e. More...

#include <EllipseBounds.h>

Inheritance diagram for Trk::EllipseBounds:
Collaboration diagram for Trk::EllipseBounds:

Public Types

enum  BoundValues {
  bv_rMinX = 0 , bv_rMinY = 1 , bv_rMaxX = 2 , bv_rMaxY = 3 ,
  bv_averagePhi = 4 , bv_halfPhiSector = 5 , bv_length = 6
}
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

 EllipseBounds ()
 Default Constructor.
 EllipseBounds (const EllipseBounds &discbo)=default
 Copy constructor.
EllipseBoundsoperator= (const EllipseBounds &discbo)=default
 Assignment operator.
 EllipseBounds (EllipseBounds &&discbo) noexcept=default
 Move constructor.
EllipseBoundsoperator= (EllipseBounds &&discbo) noexcept=default
 Move assignment operator.
virtual ~EllipseBounds ()=default
 Destructor.
 EllipseBounds (double minrad1, double minrad2, double maxrad1, double maxrad2, double hphisec=M_PI)
 Constructor for full of an ellipsoid disc around phi=0.
 EllipseBounds (double minrad1, double minrad2, double maxrad1, double maxrad2, double avephi, double hphisec)
 Constructor for an ellipsoid disc around phi != 0.
virtual bool operator== (const SurfaceBounds &sbo) const override
 Equality operator.
virtual EllipseBoundsclone () const override final
 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 point given in the local coordinates is between two ellipsoids if only tol1 is given and additional in the phi sector is tol2 is given.
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
 Check for inside first local coordinate.
virtual bool insideLoc2 (const Amg::Vector2D &locpo, double tol2=0.) const override final
 Check for inside second local coordinate.
virtual double minDistance (const Amg::Vector2D &pos) const override final
 Minimal distance to boundary ( > 0 if outside and <=0 if inside)
double rMinX () const
 This method returns first inner radius.
double rMinY () const
 This method returns second inner radius.
double rMaxX () const
 This method returns first outer radius.
double rMaxY () const
 This method returns second outer radius.
virtual double r () const override final
 This method returns the maximum expansion on the plane (=max(rMaxX,rMaxY))
double averagePhi () const
 This method returns the average phi.
double halfPhiSector () const
 This method returns the halfPhiSector which is covered by the disc.
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 Member Functions

double square (double x) const
 helper function for squaring

Private Attributes

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

Detailed Description

Class to describe the bounds for a planar EllipseSurface, i.e.

the surface between two ellipses. By providing an argument for hphisec, the bounds can be restricted to a phirange around the center position.

Author
Marci.nosp@m.n.Wo.nosp@m.lter@.nosp@m.cern.nosp@m..ch

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

Enumerator
bv_rMinX 
bv_rMinY 
bv_rMaxX 
bv_rMaxY 
bv_averagePhi 
bv_halfPhiSector 
bv_length 

Definition at line 41 of file EllipseBounds.h.

Constructor & Destructor Documentation

◆ EllipseBounds() [1/5]

Trk::EllipseBounds::EllipseBounds ( )

Default Constructor.

Definition at line 20 of file EllipseBounds.cxx.

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

◆ EllipseBounds() [2/5]

Trk::EllipseBounds::EllipseBounds ( const EllipseBounds & discbo)
default

Copy constructor.

◆ EllipseBounds() [3/5]

Trk::EllipseBounds::EllipseBounds ( EllipseBounds && discbo)
defaultnoexcept

Move constructor.

◆ ~EllipseBounds()

virtual Trk::EllipseBounds::~EllipseBounds ( )
virtualdefault

Destructor.

◆ EllipseBounds() [4/5]

Trk::EllipseBounds::EllipseBounds ( double minrad1,
double minrad2,
double maxrad1,
double maxrad2,
double hphisec = M_PI )

Constructor for full of an ellipsoid disc around phi=0.

Definition at line 24 of file EllipseBounds.cxx.

◆ EllipseBounds() [5/5]

Trk::EllipseBounds::EllipseBounds ( double minrad1,
double minrad2,
double maxrad1,
double maxrad2,
double avephi,
double hphisec )

Member Function Documentation

◆ averagePhi()

double Trk::EllipseBounds::averagePhi ( ) const
inline

This method returns the average phi.

Definition at line 213 of file EllipseBounds.h.

◆ clone()

EllipseBounds * Trk::EllipseBounds::clone ( ) const
inlinefinaloverridevirtual

Virtual constructor.

Implements Trk::SurfaceBounds.

Definition at line 134 of file EllipseBounds.h.

135{
136 return new EllipseBounds(*this);
137}
EllipseBounds()
Default Constructor.

◆ dump() [1/2]

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

Output Method for MsgStream.

Implements Trk::SurfaceBounds.

Definition at line 172 of file EllipseBounds.cxx.

173{
174 sl << std::setiosflags(std::ios::fixed);
175 sl << std::setprecision(7);
176 sl << "Trk::EllipseBounds: (innerRadiusX, innerRadiusY, outerRadiusX, outerRadiusY, averagePhi, hPhiSector) = ";
177 sl << "(" << this->rMinX() << ", " << this->rMinY() << ", " << this->rMaxX() << ", " << this->rMaxY() << ", "
178 << this->averagePhi() << ", " << this->halfPhiSector() << ")";
179 sl << std::setprecision(-1);
180 return sl;
181}
double rMinX() const
This method returns first inner radius.
double rMinY() const
This method returns second inner radius.
double averagePhi() const
This method returns the average phi.
double rMaxY() const
This method returns second outer radius.
double halfPhiSector() const
This method returns the halfPhiSector which is covered by the disc.
double rMaxX() const
This method returns first outer radius.

◆ dump() [2/2]

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

Output Method for std::ostream.

Implements Trk::SurfaceBounds.

Definition at line 184 of file EllipseBounds.cxx.

185{
186 sl << std::setiosflags(std::ios::fixed);
187 sl << std::setprecision(7);
188 sl << "Trk::EllipseBounds: (innerRadiusX, innerRadiusY, outerRadiusX, outerRadiusY, hPhiSector) = ";
189 sl << "(" << this->rMinX() << ", " << this->rMinY() << ", " << this->rMaxX() << ", " << this->rMaxY() << ", "
190 << this->averagePhi() << ", " << this->halfPhiSector() << ")";
191 sl << std::setprecision(-1);
192 return sl;
193}

◆ halfPhiSector()

double Trk::EllipseBounds::halfPhiSector ( ) const
inline

This method returns the halfPhiSector which is covered by the disc.

Definition at line 218 of file EllipseBounds.h.

◆ 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::EllipseBounds::inside ( const Amg::Vector2D & locpo,
const BoundaryCheck & bchk ) const
inlinefinaloverridevirtual

Implements Trk::SurfaceBounds.

Definition at line 158 of file EllipseBounds.h.

159{
160 return EllipseBounds::inside(locpo, bchk.toleranceLoc1, bchk.toleranceLoc2);
161}
virtual bool inside(const Amg::Vector2D &locpo, double tol1=0., double tol2=0.) const override final
This method checks if the point given in the local coordinates is between two ellipsoids if only tol1...

◆ inside() [2/2]

bool Trk::EllipseBounds::inside ( const Amg::Vector2D & locpo,
double tol1 = 0.,
double tol2 = 0. ) const
inlinefinaloverridevirtual

This method checks if the point given in the local coordinates is between two ellipsoids if only tol1 is given and additional in the phi sector is tol2 is given.

Implements Trk::SurfaceBounds.

Definition at line 140 of file EllipseBounds.h.

141{
143 bool insidePhi = (m_boundValues[EllipseBounds::bv_halfPhiSector] + tol2 < M_PI)
145 : 1;
146 bool insideInner = (m_boundValues[EllipseBounds::bv_rMinX] <= tol1) ||
148 (square(locpo[locX] / (m_boundValues[EllipseBounds::bv_rMinX] - tol1)) +
150 1);
151 bool insideOuter = (square(locpo[locX] / (m_boundValues[EllipseBounds::bv_rMaxX] + tol1)) +
153 1);
154 return (insideInner && insideOuter && insidePhi);
155}
#define M_PI
double square(double x) const
helper function for squaring
@ locY
local cartesian
Definition ParamDefs.h:38
@ locX
Definition ParamDefs.h:37
@ locPhi
local polar
Definition ParamDefs.h:45

◆ insideLoc1()

bool Trk::EllipseBounds::insideLoc1 ( const Amg::Vector2D & locpo,
double tol1 = 0. ) const
inlinefinaloverridevirtual

Check for inside first local coordinate.

Implements Trk::SurfaceBounds.

Definition at line 164 of file EllipseBounds.h.

165{
166 bool insideInner = (m_boundValues[EllipseBounds::bv_rMinX] <= tol1) ||
168 (square(locpo[locX] / (m_boundValues[EllipseBounds::bv_rMinX] - tol1)) +
170 1);
171 bool insideOuter = (square(locpo[locX] / (m_boundValues[EllipseBounds::bv_rMaxX] + tol1)) +
173 1);
174 return (insideInner && insideOuter);
175}

◆ insideLoc2()

bool Trk::EllipseBounds::insideLoc2 ( const Amg::Vector2D & locpo,
double tol2 = 0. ) const
inlinefinaloverridevirtual

Check for inside second local coordinate.

Implements Trk::SurfaceBounds.

Definition at line 178 of file EllipseBounds.h.

179{
181 bool insidePhi = (m_boundValues[EllipseBounds::bv_halfPhiSector] + tol2 < M_PI)
183 : 1;
184 return insidePhi;
185}

◆ minDistance()

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

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

Implements Trk::SurfaceBounds.

Definition at line 98 of file EllipseBounds.cxx.

99{
100 const double pi2 = 2. * M_PI;
101
102 double r = sqrt(pos[0] * pos[0] + pos[1] * pos[1]);
103 if (r == 0.) {
107 }
108
109 const double inv_r = 1. / r;
110 double sn = pos[1] * inv_r;
111 double cs = pos[0] * inv_r;
112 double sf = 0.;
113 double dF = 0.;
114
116 dF = atan2(cs, sn) - m_boundValues[EllipseBounds::bv_averagePhi];
117 dF += (dF > M_PI) ? -pi2 : (dF < -M_PI) ? pi2 : 0;
118 double df = std::abs(dF) - m_boundValues[EllipseBounds::bv_halfPhiSector];
119 sf = r * sin(df);
120 if (df > 0.){
121 r *= cos(df);
122 }
123 } else {
124 sf = -1.e+10;
125 }
126
127 if (sf <= 0.) {
128
131 double sr0 = r - 1. / std::sqrt(a * a + b * b);
132 if (sr0 >= 0.)
133 return sr0;
136 double sr1 = 1. / std::sqrt(a * a + b * b) - r;
137 if (sr1 >= 0.){
138 return sr1;
139 }
140 if (sf < sr0){
141 sf = sr0;
142 }
143 if (sf < sr1){
144 sf = sr1;
145 }
146 return sf;
147 }
148
149 double fb;
152 sn = sin(fb);
153 cs = cos(fb);
156 double sr0 = r - 1. / std::sqrt(a * a + b * b);
157 if (sr0 >= 0.){
158 return std::sqrt(sr0 * sr0 + sf * sf);
159 }
162 double sr1 = 1. / sqrt(a * a + b * b) - r;
163 if (sr1 >= 0.){
164 return std::sqrt(sr1 * sr1 + sf * sf);
165 }
166 return sf;
167}
static Double_t a
virtual double r() const override final
This method returns the maximum expansion on the plane (=max(rMaxX,rMaxY))
df
Printing table to screen.

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

EllipseBounds & Trk::EllipseBounds::operator= ( const EllipseBounds & discbo)
default

Assignment operator.

◆ operator=() [2/2]

EllipseBounds & Trk::EllipseBounds::operator= ( EllipseBounds && discbo)
defaultnoexcept

Move assignment operator.

◆ operator==()

bool Trk::EllipseBounds::operator== ( const SurfaceBounds & sbo) const
overridevirtual

Equality operator.

Implements Trk::SurfaceBounds.

Definition at line 84 of file EllipseBounds.cxx.

85{
86 // check the type first not to compare apples with oranges
87 const Trk::EllipseBounds* discbo = dynamic_cast<const Trk::EllipseBounds*>(&sbo);
88 if (!discbo)
89 return false;
90 return (m_boundValues == discbo->m_boundValues);
91}

◆ r()

double Trk::EllipseBounds::r ( ) const
inlinefinaloverridevirtual

This method returns the maximum expansion on the plane (=max(rMaxX,rMaxY))

Implements Trk::SurfaceBounds.

Definition at line 208 of file EllipseBounds.h.

◆ rMaxX()

double Trk::EllipseBounds::rMaxX ( ) const
inline

This method returns first outer radius.

Definition at line 198 of file EllipseBounds.h.

199{
201}

◆ rMaxY()

double Trk::EllipseBounds::rMaxY ( ) const
inline

This method returns second outer radius.

Definition at line 203 of file EllipseBounds.h.

204{
206}

◆ rMinX()

double Trk::EllipseBounds::rMinX ( ) const
inline

This method returns first inner radius.

Definition at line 188 of file EllipseBounds.h.

189{
191}

◆ rMinY()

double Trk::EllipseBounds::rMinY ( ) const
inline

This method returns second inner radius.

Definition at line 193 of file EllipseBounds.h.

194{
196}

◆ square()

double Trk::EllipseBounds::square ( double x) const
inlineprivate

helper function for squaring

Definition at line 130 of file EllipseBounds.h.

130{ return x * x; };
@ x
Definition ParamDefs.h:55

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

Return the type of the bounds for persistency.

Implements Trk::SurfaceBounds.

Definition at line 83 of file EllipseBounds.h.

83{ return SurfaceBounds::Ellipse; }

Member Data Documentation

◆ m_boundValues

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

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

Definition at line 127 of file EllipseBounds.h.


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