CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GeneralTrapezoidalPlaneBounds.cc
Go to the documentation of this file.
1 
4 #include <cmath>
5 
7  float a, float t) :
8  hbotedge(be), htopedge(te), tilt_angle(ang), hapothem(a), hthickness(t) {
9 
10  // pre-compute offsets of triangles and tg of (half) opening
11  // angles of the trapezoid for faster inside() implementation
12 
13  tg_tilt = tan(ang*M_PI/180.);
14  xoff = a * tg_tilt;
15  offsetp = a * (te+be) / (te-be+2.*xoff); // for x > 0
16  tan_ap = (te+xoff) / (offsetp + a);
17  offsetn = a * (te+be) / (te-be-2.*xoff); // for x < 0
18  tan_an = (xoff-te) / (offsetn + a);
19 }
20 
22  return std::abs(p.y()) <= hapothem &&
23  ( (p.x() >=0. && p.x()/(p.y()+offsetp) <= tan_ap) ||
24  (p.x() < 0. && p.x()/(p.y()+offsetn) >= tan_an) );
25 }
26 
28  return std::abs(p.y()) <= hapothem &&
29  ( (p.x() >=0. && p.x()/(p.y()+offsetp) <= tan_ap) ||
30  (p.x() < 0. && p.x()/(p.y()+offsetn) >= tan_an) ) &&
31  std::abs(p.z()) <= hthickness;
32 }
33 
35  const LocalError& err, float scale) const {
36 
38  htopedge + sqrt(err.xx())*scale,
39  tilt_angle,
40  hapothem + sqrt(err.yy())*scale,
41  hthickness);
42  return tmp.inside(p);
43 }
44 
45 const std::vector<float> GeneralTrapezoidalPlaneBounds::parameters() const {
46  std::vector<float> vec(7);
47  // Same order as geant3 for constructor compatibility
48  vec[0] = hthickness;
49  vec[1] = 0;
50  vec[2] = 0;
51  vec[3] = hapothem;
52  vec[4] = hbotedge;
53  vec[5] = htopedge;
54  vec[6] = tilt_angle;
55  return vec;
56 }
float xx() const
Definition: LocalError.h:24
T y() const
Definition: PV2DBase.h:45
virtual const std::vector< float > parameters() const
T y() const
Definition: PV3DBase.h:62
#define abs(x)
Definition: mlp_lapack.h:159
GeneralTrapezoidalPlaneBounds(float be, float te, float ang, float a, float t)
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
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
#define M_PI
Definition: BFit3D.cc:3
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
double a
Definition: hdecay.h:121
T x() const
Definition: PV2DBase.h:44
T x() const
Definition: PV3DBase.h:61