CMS 3D CMS Logo

Plane.h
Go to the documentation of this file.
1 #ifndef Geom_Plane_H
2 #define Geom_Plane_H
3 
15 
16 class Plane : public Surface {
17 public:
18  template <typename... Args>
19  Plane(Args&&... args) : Surface(std::forward<Args>(args)...) {
20  setPosPrec();
21  computeSpan();
22  }
23 
28 
32  template <typename... Args>
33  static PlanePointer build(Args&&... args) {
34  return PlanePointer(new Plane(std::forward<Args>(args)...));
35  }
36 
37  ~Plane() override {}
38 
39  // extension of Surface interface for planes
40 
41  GlobalVector normalVector() const { return GlobalVector(rotation().z()); }
42 
45  float localZ(const GlobalPoint& gp) const { return normalVector().dot(gp - position()); }
46 
47  float localZclamped(const GlobalPoint& gp) const {
48  auto d = localZ(gp);
49  return std::abs(d) > posPrec() ? d : 0;
50  }
51 
53  float localZ(const GlobalVector& gv) const { return normalVector().dot(gv); }
54 
55  // precision on position
56  float posPrec() const { return m_posPrec; }
57 
58  void computeSpan() {
59  if (theBounds)
60  theBounds->computeSpan(*this);
61  }
62 
63  // implementation of Surface interface
64 
65  SurfaceOrientation::Side side(const LocalPoint& p, Scalar toler) const final {
66  return (std::abs(p.z()) < toler)
69  }
70 
71  SurfaceOrientation::Side side(const GlobalPoint& p, Scalar toler) const final {
72  Scalar lz = localZ(p);
73  return (std::abs(lz) < toler ? SurfaceOrientation::onSurface
75  }
76 
79 
82 
83 private:
84  void setPosPrec() {
85  constexpr auto maxf = std::numeric_limits<float>::max();
86  auto p = position();
87  float l = std::max(std::max(std::abs(p.x()), std::abs(p.y())), std::abs(p.z()));
89  l - ::nextafterf(l, maxf)); // LSB (can be multiplied by 4 or divided by 4 for safety depending on usage)
90  }
91 
92  Scalar m_posPrec; // the precision on the actual global position
93 };
94 using BoundPlane = Plane;
95 
96 #endif
Vector3DBase
Definition: Vector3DBase.h:8
writedatasetfile.args
args
Definition: writedatasetfile.py:18
SurfaceOrientation::onSurface
Definition: Surface.h:18
Plane::computeSpan
void computeSpan()
Definition: Plane.h:58
Plane::side
SurfaceOrientation::Side side(const GlobalPoint &p, Scalar toler) const final
Definition: Plane.h:71
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
Plane::PlanePointer
ReferenceCountingPointer< Plane > PlanePointer
Definition: Plane.h:24
ConstReferenceCountingPointer< Plane >
Surface
Definition: Surface.h:36
ReferenceCountingPointer< Plane >
GloballyPositioned< float >::GlobalVector
Vector3DBase< float, GlobalTag > GlobalVector
Definition: GloballyPositioned.h:25
Plane::side
SurfaceOrientation::Side side(const LocalPoint &p, Scalar toler) const final
Definition: Plane.h:65
Plane::m_posPrec
Scalar m_posPrec
Definition: Plane.h:92
Surface.h
DDAxes::z
Plane::localZ
float localZ(const GlobalVector &gv) const
Fast access to component perpendicular to plane for a vector.
Definition: Plane.h:53
Point3DBase< float, GlobalTag >
Plane::build
static PlanePointer build(Args &&... args)
Definition: Plane.h:33
runTauDisplay.gp
gp
Definition: runTauDisplay.py:431
Plane::setPosPrec
void setPosPrec()
Definition: Plane.h:84
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
Plane::localZ
float localZ(const GlobalPoint &gp) const
Definition: Plane.h:45
Plane::~Plane
~Plane() override
Definition: Plane.h:37
SurfaceOrientation::negativeSide
Definition: Surface.h:18
Vector3DBase::dot
PreciseFloatType< T, U >::Type dot(const Vector3DBase< U, FrameTag > &v) const
Definition: Vector3DBase.h:99
Plane::posPrec
float posPrec() const
Definition: Plane.h:56
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:204
SurfaceOrientation::Side
Side
Definition: Surface.h:18
Plane::Plane
Plane(Args &&... args)
Definition: Plane.h:19
GloballyPositioned< float >::position
const PositionType & position() const
Definition: GloballyPositioned.h:36
std
Definition: JetResolutionObject.h:76
Plane::localZclamped
float localZclamped(const GlobalPoint &gp) const
Definition: Plane.h:47
Surface::theBounds
extstd::clone_ptr< Bounds > theBounds
Definition: Surface.h:107
BoundPlane
Plane
Definition: Plane.h:16
SurfaceOrientation::positiveSide
Definition: Surface.h:18
ztail.d
d
Definition: ztail.py:151
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
GloballyPositioned< float >::rotation
const RotationType & rotation() const
Definition: GloballyPositioned.h:38
GloballyPositioned< float >::Scalar
float Scalar
Definition: GloballyPositioned.h:20
Plane::tangentPlane
ConstReferenceCountingPointer< TangentPlane > tangentPlane(const GlobalPoint &) const final
tangent plane to surface from global point
Definition: Plane.cc:4
Plane::normalVector
GlobalVector normalVector() const
Definition: Plane.h:41