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::vector<float> TrapezoidalPlaneBounds::parameters() const {
56  std::vector<float> vec(4);
57  // Same order as geant3 for constructor compatibility
58  vec[0] = hbotedge;
59  vec[1] = htopedge;
60  vec[3] = hapothem;
61  vec[2] = hthickness;
62  return vec;
63 }
float xx() const
Definition: LocalError.h:24
T y() const
Definition: PV2DBase.h:45
virtual Bounds * clone() 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:62
virtual const std::vector< float > parameters() const
virtual bool inside(const Local2DPoint &p) const
float yy() const
Definition: LocalError.h:26
T sqrt(T t)
Definition: SSEVec.h:46
T z() const
Definition: PV3DBase.h:63
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
double a
Definition: hdecay.h:121
Definition: Bounds.h:18
virtual int yAxisOrientation() const
T x() const
Definition: PV2DBase.h:44
T x() const
Definition: PV3DBase.h:61