test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RectangularPlaneBounds.cc
Go to the documentation of this file.
3 #include <cmath>
4 
6  halfWidth(w), halfLength(h), halfThickness(t) {}
7 
8 
10 
12  float scale) const {
13  if( (scale >=0) && inside(p) ) return true;
14  return
15  std::abs(p.z()) < halfThickness &&
16  (std::abs(p.x()) < halfWidth + std::sqrt(err.xx())*scale) &&
17  (std::abs(p.y()) < halfLength + std::sqrt(err.yy())*scale);
18 }
19 
21  float scale) const {
22  if( (scale >=0) && inside(p) ) return true;
23  return
24  (std::abs(p.x()) < halfWidth + std::sqrt(err.xx())*scale) &&
25  (std::abs(p.y()) < halfLength + std::sqrt(err.yy())*scale);
26 }
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 }
43 
45  return new RectangularPlaneBounds(*this);
46 }
47 
48 
float xx() const
Definition: LocalError.h:24
T y() const
Definition: PV2DBase.h:46
const double w
Definition: UKUtility.cc:23
T y() const
Definition: PV3DBase.h:63
virtual Bounds * clone() const
virtual bool inside(const Local2DPoint &p) const
RectangularPlaneBounds(float w, float h, float t)
float yy() const
Definition: LocalError.h:26
T sqrt(T t)
Definition: SSEVec.h:48
T z() const
Definition: PV3DBase.h:64
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
std::pair< bool, bool > inout(const Local3DPoint &p, const LocalError &err, float scale=1.f) const
Definition: Bounds.h:22
T x() const
Definition: PV2DBase.h:45
T x() const
Definition: PV3DBase.h:62