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

#include <ConeBounds.h>

Inheritance diagram for Trk::ConeBounds:
Collaboration diagram for Trk::ConeBounds:

Public Types

enum  BoundValues {
  bv_alpha = 0, bv_minZ = 1, bv_maxZ = 2, bv_averagePhi = 3,
  bv_halfPhiSector = 4, bv_length = 5
}
 BoundValues for readablility. 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

 ConeBounds ()
 Default Constructor. More...
 
 ConeBounds (double alpha, bool symm, double halfphi=M_PI, double avphi=0.)
 Constructor - open cone with alpha, by default a full cone but optionally can make a conical section. More...
 
 ConeBounds (double alpha, double zmin, double zmax, double halfphi=M_PI, double avphi=0.)
 Constructor - open cone with alpha, minz and maxz, by default a full cone but can optionally make it a conical section. More...
 
 ConeBounds (const ConeBounds &cylbo)=default
 Copy Constructor. More...
 
ConeBoundsoperator= (const ConeBounds &cylbo)=default
 Assignment operator. More...
 
 ConeBounds (ConeBounds &&annbo)=default
 Move constructor. More...
 
ConeBoundsoperator= (ConeBounds &&sbo)=default
 Move assignment. More...
 
virtual ~ConeBounds ()=default
 Destructor. More...
 
virtual bool operator== (const SurfaceBounds &sbo) const override
 Equality operator. More...
 
bool operator== (const ConeBounds &bo) const
 
virtual ConeBoundsclone () const override
 Virtual constructor. More...
 
virtual BoundsType type () const override
 Return the bounds type. More...
 
virtual bool inside (const Amg::Vector2D &locpo, double tol1, double tol2) const override final
 This method checks if a LocalPosition is inside z bounds and rphi value- interface method. More...
 
virtual bool inside (const Amg::Vector2D &locpo, const BoundaryCheck &bchk=true) const override final
 
virtual bool inside (const Amg::Vector3D &gp, double tol1=0., double tol2=0.) const final
 This method checks if a GlobalPosition is inside the Cylinder - not an interface method, assumes that GlobalPosition is in the right frame. More...
 
virtual bool inside (const Amg::Vector3D &locpo, const BoundaryCheck &bchk) const 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 loc1. More...
 
virtual double minDistance (const Amg::Vector2D &pos) const override
 Minimal distance to boundary ( > 0 if outside and <=0 if inside) More...
 
virtual double r () const override
 This method returns the maximal radius - for an unbound cone it returns MAXBOUNDVALUE. More...
 
double r (double z) const
 Return the radius at a specific z values. More...
 
double tanAlpha () const
 This method returns the average phi. More...
 
double sinAlpha () const
 
double cosAlpha () const
 
double alpha () const
 
double minZ () const
 This method returns the minimum z value in the local framee. More...
 
double maxZ () const
 This method returns the maximum z value in the local framee. More...
 
double averagePhi () const
 This method returns the average phi value (i.e. More...
 
double halfPhiSector () const
 This method returns the half-phi width of the sector (so that averagePhi +/- halfPhiSector gives the phi bounds of the cone) 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...
 

Private Member Functions

virtual void initCache () override final
 Helper function for angle parameter initialization. More...
 
double minPhi () const
 Helpers for inside() functions. More...
 
double maxPhi () const
 

Private Attributes

std::vector< TDD_real_tm_boundValues
 internal storage of the geometry parameters More...
 
TDD_real_t m_tanAlpha
 
TDD_real_t m_sinAlpha
 
TDD_real_t m_cosAlpha
 

Detailed Description

Bounds for a conical Surface, the opening angle is stored in \( \tan(\alpha) \) and always positively defined. The cone can open to both sides, steered by \( z_min \) and \( z_max \).

Author
Ian.W.nosp@m.atso.nosp@m.n@cer.nosp@m.n.ch, Andre.nosp@m.as.S.nosp@m.alzbu.nosp@m.rger.nosp@m.@cern.nosp@m..ch, Rober.nosp@m.t.La.nosp@m.ngenb.nosp@m.erg@.nosp@m.cern..nosp@m.ch

Definition at line 43 of file ConeBounds.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

BoundValues for readablility.

Enumerator
bv_alpha 
bv_minZ 
bv_maxZ 
bv_averagePhi 
bv_halfPhiSector 
bv_length 

Definition at line 47 of file ConeBounds.h.

48  {
49  bv_alpha = 0,
50  bv_minZ = 1,
51  bv_maxZ = 2,
52  bv_averagePhi = 3,
53  bv_halfPhiSector = 4,
54  bv_length = 5
55  };

Constructor & Destructor Documentation

◆ ConeBounds() [1/5]

Trk::ConeBounds::ConeBounds ( )

Default Constructor.

Definition at line 18 of file ConeBounds.cxx.

20  , m_tanAlpha(0.)
21  , m_sinAlpha(0.)
22  , m_cosAlpha(0.)
23 {}

◆ ConeBounds() [2/5]

Trk::ConeBounds::ConeBounds ( double  alpha,
bool  symm,
double  halfphi = M_PI,
double  avphi = 0. 
)

Constructor - open cone with alpha, by default a full cone but optionally can make a conical section.

Definition at line 25 of file ConeBounds.cxx.

◆ ConeBounds() [3/5]

Trk::ConeBounds::ConeBounds ( double  alpha,
double  zmin,
double  zmax,
double  halfphi = M_PI,
double  avphi = 0. 
)

Constructor - open cone with alpha, minz and maxz, by default a full cone but can optionally make it a conical section.

Definition at line 39 of file ConeBounds.cxx.

◆ ConeBounds() [4/5]

Trk::ConeBounds::ConeBounds ( const ConeBounds cylbo)
default

Copy Constructor.

◆ ConeBounds() [5/5]

Trk::ConeBounds::ConeBounds ( ConeBounds &&  annbo)
default

Move constructor.

◆ ~ConeBounds()

virtual Trk::ConeBounds::~ConeBounds ( )
virtualdefault

Destructor.

Member Function Documentation

◆ alpha()

double Trk::ConeBounds::alpha ( ) const

◆ averagePhi()

double Trk::ConeBounds::averagePhi ( ) const

This method returns the average phi value (i.e.

the "middle" phi value for the conical sector we are describing)

◆ clone()

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

Virtual constructor.

Implements Trk::SurfaceBounds.

◆ cosAlpha()

double Trk::ConeBounds::cosAlpha ( ) const

◆ dump() [1/2]

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

Output Method for MsgStream.

Implements Trk::SurfaceBounds.

Definition at line 145 of file ConeBounds.cxx.

146 {
147  sl << std::setiosflags(std::ios::fixed);
148  sl << std::setprecision(7);
149  sl << "Trk::ConeBounds: (tanAlpha, minZ, maxZ, averagePhi, halfPhiSector) = ";
150  sl << "(" << this->tanAlpha() << ", " << this->minZ() << ", " << this->maxZ() << ", " << this->averagePhi() << ", "
151  << this->halfPhiSector() << ")";
152  sl << std::setprecision(-1);
153  return sl;
154 }

◆ dump() [2/2]

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

Output Method for std::ostream.

Implements Trk::SurfaceBounds.

Definition at line 157 of file ConeBounds.cxx.

158 {
159  sl << std::setiosflags(std::ios::fixed);
160  sl << std::setprecision(7);
161  sl << "Trk::ConeBounds: (tanAlpha, minZ, maxZ, averagePhi, halfPhiSector) = ";
162  sl << "(" << this->tanAlpha() << ", " << this->minZ() << ", " << this->maxZ() << ", " << this->averagePhi() << ", "
163  << this->halfPhiSector() << ")";
164  sl << std::setprecision(-1);
165  return sl;
166 }

◆ halfPhiSector()

double Trk::ConeBounds::halfPhiSector ( ) const

This method returns the half-phi width of the sector (so that averagePhi +/- halfPhiSector gives the phi bounds of the cone)

◆ initCache()

void Trk::ConeBounds::initCache ( )
finaloverrideprivatevirtual

◆ inside() [1/4]

virtual bool Trk::ConeBounds::inside ( const Amg::Vector2D locpo,
const BoundaryCheck bchk = true 
) const
finaloverridevirtual

Implements Trk::SurfaceBounds.

◆ inside() [2/4]

virtual bool Trk::ConeBounds::inside ( const Amg::Vector2D locpo,
double  tol1,
double  tol2 
) const
finaloverridevirtual

This method checks if a LocalPosition is inside z bounds and rphi value- interface method.

Implements Trk::SurfaceBounds.

◆ inside() [3/4]

virtual bool Trk::ConeBounds::inside ( const Amg::Vector3D gp,
double  tol1 = 0.,
double  tol2 = 0. 
) const
finalvirtual

This method checks if a GlobalPosition is inside the Cylinder - not an interface method, assumes that GlobalPosition is in the right frame.

◆ inside() [4/4]

virtual bool Trk::ConeBounds::inside ( const Amg::Vector3D locpo,
const BoundaryCheck bchk 
) const
finalvirtual

◆ insideLoc1()

virtual bool Trk::ConeBounds::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::ConeBounds::insideLoc2 ( const Amg::Vector2D locpo,
double  tol2 = 0. 
) const
finaloverridevirtual

This method checks inside bounds in loc1.

  • loc1/loc2 correspond to the natural coordinates of the surface

Implements Trk::SurfaceBounds.

◆ maxPhi()

double Trk::ConeBounds::maxPhi ( ) const
inlineprivate

Definition at line 164 of file ConeBounds.h.

◆ maxZ()

double Trk::ConeBounds::maxZ ( ) const

This method returns the maximum z value in the local framee.

  • for an unbound cone, it returns MAXBOUNDVALUE

◆ minDistance()

double Trk::ConeBounds::minDistance ( const Amg::Vector2D pos) const
overridevirtual

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

Implements Trk::SurfaceBounds.

Definition at line 74 of file ConeBounds.cxx.

75 {
76  // This needs to be split based on where pos is with respect to the
77  // cone. Inside, its easy, inside the z-region or inside the phi
78  // region, just get the difference from the outside quantity, for
79  // outside both the z and dphi regions, need to get the distance to
80  // the cone corner, but remember, the cone piece will be symmetric
81  // about the center of phi
82 
83  // TODO: The whole scheme here assumes that the local position is in
84  // a half of R^3 where the cone is defined. If the local position is
85  // in say the z < 0 half, and the cone is only defined for z > 0,
86  // then it won't work
87 
88  // find the minimum distance along the z direction
89  double toMinZ = m_boundValues[ConeBounds::bv_minZ] - pos[locZ];
90  double toMaxZ = pos[locZ] - m_boundValues[ConeBounds::bv_maxZ];
91  double toZ = (fabs(toMinZ) < fabs(toMaxZ)) ? toMinZ : toMaxZ;
92 
93  // NB this works only if the localPos is in the same hemisphere as
94  // the cone (i.e. if the localPos has z < 0 and the cone only
95  // defined for z > z_min where z_min > 0, this is wrong)
96  double zDist = sqrt(toZ * toZ * (1. + m_tanAlpha * m_tanAlpha));
97  if (toZ < 0.) // positive if outside the cone only
98  zDist = -zDist;
99 
100  // if the cone is complete, or pos is in the same phi range as the
101  // cone piece then its just the distance along the cone.
103  return zDist;
104 
105  // we have a conical segment, so find also the phi distance
106  // Note that here we take the phi distance as the distance from
107  // going to the correct phi by a straight line at the point that was
108  // input by the user (not at the point of closest approach to the
109  // cone)
110  double posR = pos[locZ] * m_tanAlpha;
111  double deltaPhi = pos[locRPhi] / posR - m_boundValues[ConeBounds::bv_averagePhi]; // from center
112  if (deltaPhi > M_PI)
113  deltaPhi = 2 * M_PI - deltaPhi;
114  if (deltaPhi < -M_PI)
115  deltaPhi = 2 * M_PI + deltaPhi;
116 
117  // straight line distance (goes off cone)
118  double phiDist = 2 * posR * sin(.5 * (deltaPhi - m_boundValues[ConeBounds::bv_halfPhiSector]));
119 
120  // if inside the cone, return the smaller length (since both are
121  // negative, the *larger* of the 2 is the *smaller* distance)
122  if (phiDist <= 0. && zDist <= 0) {
123  if (phiDist > zDist){
124  return phiDist;
125  }
126  return zDist;
127  }
128 
129  // if inside the phi or z boundary, return the other
130  if (phiDist <= 0.){
131  return zDist;
132  }
133  if (zDist <= 0.){
134  return phiDist;
135  }
136 
137  // otherwise, return both (this should be the distance to the corner
138  // closest to the cone
139  return sqrt(zDist * zDist + phiDist * phiDist);
140 }

◆ minPhi()

double Trk::ConeBounds::minPhi ( ) const
inlineprivate

Helpers for inside() functions.

Definition at line 160 of file ConeBounds.h.

◆ minZ()

double Trk::ConeBounds::minZ ( ) const

This method returns the minimum z value in the local framee.

  • for an unbound symmetric cone, it returns -MAXBOUNDVALUE

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

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

Move assignment.

◆ operator=() [2/2]

ConeBounds& Trk::ConeBounds::operator= ( const ConeBounds cylbo)
default

Assignment operator.

◆ operator==() [1/2]

bool Trk::ConeBounds::operator== ( const ConeBounds bo) const

◆ operator==() [2/2]

bool Trk::ConeBounds::operator== ( const SurfaceBounds sbo) const
overridevirtual

Equality operator.

Implements Trk::SurfaceBounds.

Definition at line 65 of file ConeBounds.cxx.

65  {
66  // check the type first not to compare apples with oranges
67  const Trk::ConeBounds* conebo = dynamic_cast<const Trk::ConeBounds*>(&sbo);
68  if (!conebo)
69  return false;
70  return (m_boundValues == conebo->m_boundValues);
71 }

◆ r() [1/2]

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

This method returns the maximal radius - for an unbound cone it returns MAXBOUNDVALUE.

Implements Trk::SurfaceBounds.

◆ r() [2/2]

double Trk::ConeBounds::r ( double  z) const

Return the radius at a specific z values.

◆ sinAlpha()

double Trk::ConeBounds::sinAlpha ( ) const

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

◆ tanAlpha()

double Trk::ConeBounds::tanAlpha ( ) const

This method returns the average phi.

◆ type()

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

Return the bounds type.

Implements Trk::SurfaceBounds.

Definition at line 93 of file ConeBounds.h.

93 { return SurfaceBounds::Cone; }

Member Data Documentation

◆ m_boundValues

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

internal storage of the geometry parameters

Definition at line 151 of file ConeBounds.h.

◆ m_cosAlpha

TDD_real_t Trk::ConeBounds::m_cosAlpha
private

Definition at line 154 of file ConeBounds.h.

◆ m_sinAlpha

TDD_real_t Trk::ConeBounds::m_sinAlpha
private

Definition at line 153 of file ConeBounds.h.

◆ m_tanAlpha

TDD_real_t Trk::ConeBounds::m_tanAlpha
private

Definition at line 152 of file ConeBounds.h.


The documentation for this class was generated from the following files:
Trk::ConeBounds::m_tanAlpha
TDD_real_t m_tanAlpha
Definition: ConeBounds.h:152
Trk::SurfaceBounds::DiscTrapezoidal
@ DiscTrapezoidal
Definition: SurfaceBounds.h:69
Trk::SurfaceBounds::Cone
@ Cone
Definition: SurfaceBounds.h:60
PixelAthClusterMonAlgCfg.zmin
zmin
Definition: PixelAthClusterMonAlgCfg.py:169
Trk::SurfaceBounds::Rectangle
@ Rectangle
Definition: SurfaceBounds.h:65
xAOD::deltaPhi
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setInterceptInner setEtaMap setEtaBin setIsTgcFailure setDeltaPt deltaPhi
Definition: L2StandAloneMuon_v1.cxx:160
Trk::locRPhi
@ locRPhi
Definition: ParamDefs.h:40
Trk::ConeBounds::m_cosAlpha
TDD_real_t m_cosAlpha
Definition: ConeBounds.h:154
M_PI
#define M_PI
Definition: ActiveFraction.h:11
Trk::SurfaceBounds::Annulus
@ Annulus
Definition: SurfaceBounds.h:70
Trk::ConeBounds
Definition: ConeBounds.h:44
Trk::SurfaceBounds::Diamond
@ Diamond
Definition: SurfaceBounds.h:62
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
Trk::ConeBounds::m_sinAlpha
TDD_real_t m_sinAlpha
Definition: ConeBounds.h:153
Trk::ConeBounds::m_boundValues
std::vector< TDD_real_t > m_boundValues
internal storage of the geometry parameters
Definition: ConeBounds.h:151
Trk::ConeBounds::averagePhi
double averagePhi() const
This method returns the average phi value (i.e.
Trk::ConeBounds::halfPhiSector
double halfPhiSector() const
This method returns the half-phi width of the sector (so that averagePhi +/- halfPhiSector gives the ...
Trk::ConeBounds::minZ
double minZ() const
This method returns the minimum z value in the local framee.
Trk::ConeBounds::bv_maxZ
@ bv_maxZ
Definition: ConeBounds.h:51
Trk::ConeBounds::bv_halfPhiSector
@ bv_halfPhiSector
Definition: ConeBounds.h:53
Trk::locZ
@ locZ
local cylindrical
Definition: ParamDefs.h:42
Trk::ConeBounds::bv_alpha
@ bv_alpha
Definition: ConeBounds.h:49
Trk::ConeBounds::initCache
virtual void initCache() override final
Helper function for angle parameter initialization.
Definition: ConeBounds.cxx:53
PixelAthClusterMonAlgCfg.zmax
zmax
Definition: PixelAthClusterMonAlgCfg.py:169
drawFromPickle.tan
tan
Definition: drawFromPickle.py:36
DeMoUpdate.tmp
string tmp
Definition: DeMoUpdate.py:1167
Trk::ConeBounds::bv_averagePhi
@ bv_averagePhi
Definition: ConeBounds.h:52
Trk::ConeBounds::tanAlpha
double tanAlpha() const
This method returns the average phi.
Trk::ConeBounds::bv_minZ
@ bv_minZ
Definition: ConeBounds.h:50
keylayer_zslicemap.sb
sb
Definition: keylayer_zslicemap.py:192
Trk::SurfaceBounds::Trapezoid
@ Trapezoid
Definition: SurfaceBounds.h:67
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
Trk::ConeBounds::alpha
double alpha() const
Trk::SurfaceBounds::Disc
@ Disc
Definition: SurfaceBounds.h:63
MAXBOUNDVALUE
const double MAXBOUNDVALUE
Definition: ConeBounds.h:24
Trk::ConeBounds::bv_length
@ bv_length
Definition: ConeBounds.h:54
Trk::SurfaceBounds::RotatedTrapezoid
@ RotatedTrapezoid
Definition: SurfaceBounds.h:66
Trk::SurfaceBounds::Other
@ Other
Definition: SurfaceBounds.h:71
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
Trk::SurfaceBounds::Triangle
@ Triangle
Definition: SurfaceBounds.h:68
Trk::ConeBounds::maxZ
double maxZ() const
This method returns the maximum z value in the local framee.
Trk::SurfaceBounds::Ellipse
@ Ellipse
Definition: SurfaceBounds.h:64
Trk::SurfaceBounds::Cylinder
@ Cylinder
Definition: SurfaceBounds.h:61