CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 / fabs(offset + a);
16 }
17 
18 
20  int yAx = 1;
21  if(hbotedge>htopedge) yAx = -1;
22  return yAx;
23 }
24 
26  return fabs(p.y()) < hapothem &&
27  fabs(p.x())/fabs(p.y()+offset) < tan_a;
28 }
29 
31  return fabs(p.y()) < hapothem &&
32  fabs(p.x())/fabs(p.y()+offset) < tan_a &&
33  fabs(p.z()) < hthickness;
34 }
35 
37  const LocalError& err, float scale) const {
38  TrapezoidalPlaneBounds tmp( hbotedge + sqrt(err.xx())*scale,
39  htopedge + sqrt(err.xx())*scale,
40  hapothem + sqrt(err.yy())*scale,
41  hthickness);
42  return tmp.inside(p);
43 }
44 
45 bool TrapezoidalPlaneBounds::inside( const Local2DPoint& p, const LocalError& err, float scale) const {
46  return Bounds::inside(p,err,scale);
47 }
48 
50  return new TrapezoidalPlaneBounds(*this);
51 }
52 
53 
54 
55 const std::array<const float, 4> TrapezoidalPlaneBounds::parameters() const {
56  // Same order as geant3 for constructor compatibility
57  std::array<const float, 4> vec { { hbotedge, htopedge, hthickness, hapothem } };
58  return vec;
59 }
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
virtual bool inside(const Local3DPoint &) const =0
Determine if the point is inside the bounds.
TrapezoidalPlaneBounds(float be, float te, float a, float t)
T y() const
Definition: PV3DBase.h:63
virtual bool inside(const Local2DPoint &p) const
float yy() const
Definition: LocalError.h:26
T sqrt(T t)
Definition: SSEVec.h:48
T z() const
Definition: PV3DBase.h:64
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