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 
Point2DBase< float, LocalTag >
RectangularPlaneBounds::RectangularPlaneBounds
RectangularPlaneBounds(float w, float h, float t)
Definition: RectangularPlaneBounds.cc:5
RectangularPlaneBounds::~RectangularPlaneBounds
~RectangularPlaneBounds() override
Definition: RectangularPlaneBounds.cc:8
L1EGammaCrystalsEmulatorProducer_cfi.scale
scale
Definition: L1EGammaCrystalsEmulatorProducer_cfi.py:10
RectangularPlaneBounds::halfWidth
float halfWidth
Definition: RectangularPlaneBounds.h:53
RectangularPlaneBounds::halfLength
float halfLength
Definition: RectangularPlaneBounds.h:54
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
Bounds
Definition: Bounds.h:18
RectangularPlaneBounds::clone
Bounds * clone() const override
Definition: RectangularPlaneBounds.cc:43
LocalError.h
w
const double w
Definition: UKUtility.cc:23
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
RectangularPlaneBounds::inside
bool inside(const Local2DPoint &p) const override
Definition: RectangularPlaneBounds.h:29
RectangularPlaneBounds.h
h
Point3DBase< float, LocalTag >
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
LocalError
Definition: LocalError.h:12
RectangularPlaneBounds::halfThickness
float halfThickness
Definition: RectangularPlaneBounds.h:55
submitPVResolutionJobs.err
err
Definition: submitPVResolutionJobs.py:85
RectangularPlaneBounds::significanceInside
float significanceInside(const Local3DPoint &, const LocalError &) const override
Definition: RectangularPlaneBounds.cc:24
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
RectangularPlaneBounds::inout
std::pair< bool, bool > inout(const Local3DPoint &p, const LocalError &err, float scale=1.f) const
Definition: RectangularPlaneBounds.cc:29