CMS 3D CMS Logo

TrapezoidalPlaneBounds.cc
Go to the documentation of this file.
1 
2 
5 #include <cmath>
6 
8  float a, float t) :
9  hbotedge(be), htopedge(te), hapothem(a), hthickness(t) {
10 
11  // pre-compute offset of triangle vertex and tg of (half) opening
12  // angle of the trapezoid for faster inside() implementation.
13 
14  offset = a * (te+be) / (te-be); // check sign if te < be !!!
15  tan_a = te / std::abs(offset + a);
16 }
17 
18 
20  return (hbotedge>htopedge) ? -1 : 1;
21 }
22 
24  return (std::abs(p.y()) < hapothem) &
25  (std::abs(p.x()) < tan_a*std::abs(p.y()+offset));
26 }
27 
29  return ((std::abs(p.y()) < hapothem) & (std::abs(p.z()) < hthickness)) && std::abs(p.x()) < tan_a*std::abs(p.y()+offset);
30 }
31 
33  const LocalError& err, float scale) const {
34  if (scale>=0 && inside(p)) return true;
35 
37  htopedge + std::sqrt(err.xx())*scale,
38  hapothem + std::sqrt(err.yy())*scale,
39  hthickness);
40  return tmp.inside(p);
41 }
42 
43 bool TrapezoidalPlaneBounds::inside( const Local2DPoint& p, const LocalError& err, float scale) const {
44  return Bounds::inside(p,err,scale);
45 }
46 
48  return new TrapezoidalPlaneBounds(*this);
49 }
50 
51 
52 
53 const std::array<const float, 4> TrapezoidalPlaneBounds::parameters() const {
54  // Same order as geant3 for constructor compatibility
55  std::array<const float, 4> vec { { hbotedge, htopedge, hthickness, hapothem } };
56  return vec;
57 }
float xx() const
Definition: LocalError.h:24
T y() const
Definition: PV2DBase.h:46
virtual Bounds * clone() const
virtual const std::array< const float, 4 > parameters() const
TrapezoidalPlaneBounds(float be, float te, float a, float t)
T y() const
Definition: PV3DBase.h:63
virtual bool inside(const Local2DPoint &p) const
virtual bool inside(const Local3DPoint &) const =0
Determine if the point is inside the bounds.
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
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
double a
Definition: hdecay.h:121
Definition: Bounds.h:22
virtual int yAxisOrientation() const
T x() const
Definition: PV2DBase.h:45
T x() const
Definition: PV3DBase.h:62