CMS 3D CMS Logo

RectangularPlaneBounds.cc
Go to the documentation of this file.
3 #include <cmath>
4 
6  : halfWidth(w), halfLength(h), halfThickness(t) {}
7 
9 
10 bool RectangularPlaneBounds::inside(const Local3DPoint& p, const LocalError& err, float scale) const {
11  if ((scale >= 0) && inside(p))
12  return true;
13  return std::abs(p.z()) < halfThickness && (std::abs(p.x()) < halfWidth + std::sqrt(err.xx()) * scale) &&
14  (std::abs(p.y()) < halfLength + std::sqrt(err.yy()) * scale);
15 }
16 
17 bool RectangularPlaneBounds::inside(const Local2DPoint& p, const LocalError& err, float scale) const {
18  if ((scale >= 0) && inside(p))
19  return true;
20  return (std::abs(p.x()) < halfWidth + std::sqrt(err.xx()) * scale) &&
21  (std::abs(p.y()) < halfLength + std::sqrt(err.yy()) * scale);
22 }
23 
25  return std::max((std::abs(p.x()) - halfWidth) / std::sqrt(err.xx()),
26  (std::abs(p.y()) - halfLength) / std::sqrt(err.yy()));
27 }
28 
29 std::pair<bool, bool> RectangularPlaneBounds::inout(const Local3DPoint& p, const LocalError& err, float scale) const {
30  float xl = std::abs(p.x()) - std::sqrt(err.xx()) * scale;
31  float xh = std::abs(p.x()) + std::sqrt(err.xx()) * scale;
32  bool inx = xl < halfWidth;
33  bool outx = xh > halfWidth;
34 
35  float yl = std::abs(p.y()) - std::sqrt(err.yy()) * scale;
36  float yh = std::abs(p.y()) + std::sqrt(err.yy()) * scale;
37  bool iny = yl < halfLength;
38  bool outy = yh > halfLength;
39 
40  return std::pair<bool, bool>(inx && iny, outx || outy);
41 }
42 
Bounds * clone() const override
T w() const
RectangularPlaneBounds(float w, float h, float t)
T sqrt(T t)
Definition: SSEVec.h:23
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::pair< bool, bool > inout(const Local3DPoint &p, const LocalError &err, float scale=1.f) const
bool inside(const Local2DPoint &p) const override
Definition: Bounds.h:18
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
float significanceInside(const Local3DPoint &, const LocalError &) const override