CMS 3D CMS Logo

TrapezoidalPlaneBounds.cc
Go to the documentation of this file.
1 
2 
5 #include <cmath>
6 
7 TrapezoidalPlaneBounds::TrapezoidalPlaneBounds(float be, float te, float a, float t)
8  : hbotedge(be), htopedge(te), hapothem(a), hthickness(t) {
9  // pre-compute offset of triangle vertex and tg of (half) opening
10  // angle of the trapezoid for faster inside() implementation.
11 
12  offset = a * (te + be) / (te - be); // check sign if te < be !!!
13  tan_a = te / std::abs(offset + a);
14 }
15 
16 int TrapezoidalPlaneBounds::yAxisOrientation() const { return (hbotedge > htopedge) ? -1 : 1; }
17 
19  return (std::abs(p.y()) < hapothem) & (std::abs(p.x()) < tan_a * std::abs(p.y() + offset));
20 }
21 
23  return ((std::abs(p.y()) < hapothem) & (std::abs(p.z()) < hthickness)) &&
24  std::abs(p.x()) < tan_a * std::abs(p.y() + offset);
25 }
26 
27 bool TrapezoidalPlaneBounds::inside(const Local3DPoint& p, const LocalError& err, float scale) const {
28  if (scale >= 0 && inside(p))
29  return true;
30 
32  htopedge + std::sqrt(err.xx()) * scale,
33  hapothem + std::sqrt(err.yy()) * scale,
34  hthickness);
35  return tmp.inside(p);
36 }
37 
38 bool TrapezoidalPlaneBounds::inside(const Local2DPoint& p, const LocalError& err, float scale) const {
39  return Bounds::inside(p, err, scale);
40 }
41 
43  return std::max((std::abs(p.y()) - hapothem) / std::sqrt(err.yy()),
44  (std::abs(p.x()) - tan_a * std::abs(p.y() + offset)) / std::sqrt(err.xx()));
45 }
46 
48 
49 const std::array<const float, 4> TrapezoidalPlaneBounds::parameters() const {
50  // Same order as geant3 for constructor compatibility
51  std::array<const float, 4> vec{{hbotedge, htopedge, hthickness, hapothem}};
52  return vec;
53 }
float xx() const
Definition: LocalError.h:22
T y() const
Definition: PV2DBase.h:44
virtual const std::array< const float, 4 > parameters() const
TrapezoidalPlaneBounds(float be, float te, float a, float t)
T y() const
Definition: PV3DBase.h:60
Bounds * clone() const override
virtual bool inside(const Local3DPoint &) const =0
Determine if the point is inside the bounds.
float yy() const
Definition: LocalError.h:24
T sqrt(T t)
Definition: SSEVec.h:19
T z() const
Definition: PV3DBase.h:61
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool inside(const Local2DPoint &p) const override
double a
Definition: hdecay.h:119
Definition: Bounds.h:20
float significanceInside(const Local3DPoint &, const LocalError &) const override
virtual int yAxisOrientation() const
tmp
align.sh
Definition: createJobs.py:716
T x() const
Definition: PV2DBase.h:43
T x() const
Definition: PV3DBase.h:59