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 
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 
29  return std::max((std::abs(p.x()) - halfWidth )/std::sqrt(err.xx()),
30  (std::abs(p.y()) - halfLength)/std::sqrt(err.yy())
31  );
32 }
33 
34 
35 std::pair<bool,bool> RectangularPlaneBounds::inout( const Local3DPoint& p, const LocalError& err, float scale) const {
36  float xl = std::abs(p.x()) - std::sqrt(err.xx())*scale;
37  float xh = std::abs(p.x()) + std::sqrt(err.xx())*scale;
38  bool inx = xl<halfWidth;
39  bool outx = xh>halfWidth;
40 
41  float yl = std::abs(p.y()) - std::sqrt(err.yy())*scale;
42  float yh = std::abs(p.y()) + std::sqrt(err.yy())*scale;
43  bool iny = yl<halfLength;
44  bool outy = yh>halfLength;
45 
46  return std::pair<bool,bool>(inx&&iny,outx||outy);
47 
48 }
49 
51  return new RectangularPlaneBounds(*this);
52 }
53 
54 
float xx() const
Definition: LocalError.h:24
T y() const
Definition: PV2DBase.h:46
const double w
Definition: UKUtility.cc:23
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
T y() const
Definition: PV3DBase.h:63
RectangularPlaneBounds(float w, float h, float t)
float yy() const
Definition: LocalError.h:26
T sqrt(T t)
Definition: SSEVec.h:18
T z() const
Definition: PV3DBase.h:64
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Bounds * clone() const override
float significanceInside(const Local3DPoint &, const LocalError &) const override
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:22
T x() const
Definition: PV2DBase.h:45
T x() const
Definition: PV3DBase.h:62