ATLAS Offline Software
SurfaceBounds.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // SurfaceBounds.h, (c) ATLAS Detector software
8 
9 #ifndef TRKSURFACES_SURFACEBOUNDS_H
10 #define TRKSURFACES_SURFACEBOUNDS_H
11 
12 // STD
13 #include <iomanip>
14 #include <iostream>
15 
16 // GaudiKernel
17 #include "GaudiKernel/MsgStream.h"
18 
19 // Geo & Math library
21 
22 // Trk included
24 
25 #ifdef TRKDETDESCR_USEFLOATPRECISON
26 typedef float TDD_real_t;
27 #else
28 typedef double TDD_real_t;
29 #endif
30 
31 namespace Trk {
32 
47 {
48 
49 public:
59  {
60  Cone = 0,
61  Cylinder = 1,
62  Diamond = 2,
63  Disc = 3,
64  Ellipse = 5,
65  Rectangle = 6,
67  Trapezoid = 8,
68  Triangle = 9,
70  Annulus = 11,
71  Other = 12
72 
73  };
74 
76  SurfaceBounds() = default;
77 
78  SurfaceBounds(const SurfaceBounds&) = default;
81  SurfaceBounds& operator=(SurfaceBounds&&) noexcept = default;
83  virtual ~SurfaceBounds() = default;
84 
87  virtual SurfaceBounds* clone() const = 0;
88 
90  virtual bool operator==(const SurfaceBounds& sb) const = 0;
91 
93  virtual bool operator!=(const SurfaceBounds& sb) const;
94 
96  virtual BoundsType type() const = 0;
97 
100  virtual bool inside(const Amg::Vector2D& locpo, double tol1 = 0., double tol2 = 0.) const = 0;
101  virtual bool inside(const Amg::Vector2D& locpo, const BoundaryCheck& bchk) const = 0;
105  virtual bool insideLoc1(const Amg::Vector2D& locpo, double tol1 = 0.) const = 0;
106 
110  virtual bool insideLoc2(const Amg::Vector2D& locpo, double tol2 = 0.) const = 0;
111 
113  virtual double minDistance(const Amg::Vector2D& pos) const = 0;
114 
116  virtual double r() const = 0;
117 
119  virtual MsgStream& dump(MsgStream& sl) const = 0;
120 
122  virtual std::ostream& dump(std::ostream& sl) const = 0;
123 
124 protected:
126  void swap(double& b1, double& b2);
127 
129  virtual void initCache() {}
130 };
131 
132 inline void
133 SurfaceBounds::swap(double& b1, double& b2)
134 {
135  double tmp = b1;
136  b1 = b2;
137  b2 = tmp;
138 }
139 
140 inline bool
142 {
143  return !((*this) == sb);
144 }
145 
147 MsgStream&
148 operator<<(MsgStream& sl, const SurfaceBounds& sb);
149 std::ostream&
150 operator<<(std::ostream& sl, const SurfaceBounds& sb);
151 
152 } // end of namespace
153 
154 #endif // TRKSURFACES_SURFACEBOUNDS_H
Trk::SurfaceBounds::BoundsType
BoundsType
Definition: SurfaceBounds.h:59
Trk::SurfaceBounds::DiscTrapezoidal
@ DiscTrapezoidal
Definition: SurfaceBounds.h:69
Trk::SurfaceBounds::operator=
SurfaceBounds & operator=(const SurfaceBounds &)=default
Trk::SurfaceBounds::inside
virtual bool inside(const Amg::Vector2D &locpo, double tol1=0., double tol2=0.) const =0
Each Bounds has a method inside, which checks if a LocalPosition is inside the bounds.
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::SurfaceBounds::swap
void swap(double &b1, double &b2)
Swap method to be called from DiscBounds or TrapezoidalBounds.
Definition: SurfaceBounds.h:133
Trk::SurfaceBounds::Annulus
@ Annulus
Definition: SurfaceBounds.h:70
Trk::SurfaceBounds::Diamond
@ Diamond
Definition: SurfaceBounds.h:62
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
protected
#define protected
Definition: DetDescrConditionsDict_dict_fixes.cxx:14
Trk::SurfaceBounds::minDistance
virtual double minDistance(const Amg::Vector2D &pos) const =0
Minimal distance to boundary ( > 0 if outside and <=0 if inside)
TDD_real_t
double TDD_real_t
Definition: SurfaceBounds.h:28
Trk::SurfaceBounds::SurfaceBounds
SurfaceBounds(const SurfaceBounds &)=default
GeoPrimitives.h
Trk::SurfaceBounds::insideLoc1
virtual bool insideLoc1(const Amg::Vector2D &locpo, double tol1=0.) const =0
Extend the interface to for single inside Loc 1 / Loc2 tests.
Trk::SurfaceBounds::type
virtual BoundsType type() const =0
Return the bounds type - for persistency optimization.
Trk::SurfaceBounds::initCache
virtual void initCache()
virtual initCache method for object persistency
Definition: SurfaceBounds.h:129
DeMoUpdate.tmp
string tmp
Definition: DeMoUpdate.py:1167
Trk::SurfaceBounds::insideLoc2
virtual bool insideLoc2(const Amg::Vector2D &locpo, double tol2=0.) const =0
Extend the interface to for single inside Loc 1 / Loc2 tests.
Trk::SurfaceBounds::SurfaceBounds
SurfaceBounds(SurfaceBounds &&) noexcept=default
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
keylayer_zslicemap.sb
sb
Definition: keylayer_zslicemap.py:192
Trk::SurfaceBounds::clone
virtual SurfaceBounds * clone() const =0
clone() method to make deep copy in Surface copy constructor and for assigment operator of the Surfac...
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
Trk::SurfaceBounds::Disc
@ Disc
Definition: SurfaceBounds.h:63
Trk::BoundaryCheck
Definition: BoundaryCheck.h:51
Trk::operator<<
MsgStream & operator<<(MsgStream &sl, const AlignModule &alignModule)
overload of << operator for MsgStream for debug output
Definition: AlignModule.cxx:204
BoundaryCheck.h
Trk::SurfaceBounds::RotatedTrapezoid
@ RotatedTrapezoid
Definition: SurfaceBounds.h:66
Trk::SurfaceBounds::Other
@ Other
Definition: SurfaceBounds.h:71
python.CaloScaleNoiseConfig.default
default
Definition: CaloScaleNoiseConfig.py:79
Trk::SurfaceBounds::SurfaceBounds
SurfaceBounds()=default
Default Constructor.
Trk::SurfaceBounds::dump
virtual MsgStream & dump(MsgStream &sl) const =0
Output Method for MsgStream, to be overloaded by child classes.
Trk::SurfaceBounds::Triangle
@ Triangle
Definition: SurfaceBounds.h:68
Trk::SurfaceBounds::Ellipse
@ Ellipse
Definition: SurfaceBounds.h:64
Trk::SurfaceBounds::Cylinder
@ Cylinder
Definition: SurfaceBounds.h:61
Trk::SurfaceBounds::operator!=
virtual bool operator!=(const SurfaceBounds &sb) const
Non-Equality operator.
Definition: SurfaceBounds.h:141
Trk::SurfaceBounds::r
virtual double r() const =0
Interface method for the maximal extension or the radius.