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 }
Point2DBase< float, LocalTag >
TrapezoidalPlaneBounds::tan_a
float tan_a
Definition: TrapezoidalPlaneBounds.h:70
HLT_FULL_cff.scale
scale
Definition: HLT_FULL_cff.py:6634
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
TrapezoidalPlaneBounds::TrapezoidalPlaneBounds
TrapezoidalPlaneBounds(float be, float te, float a, float t)
Definition: TrapezoidalPlaneBounds.cc:7
TrapezoidalPlaneBounds::significanceInside
float significanceInside(const Local3DPoint &, const LocalError &) const override
Definition: TrapezoidalPlaneBounds.cc:42
TrapezoidalPlaneBounds::hbotedge
float hbotedge
Definition: TrapezoidalPlaneBounds.h:63
TrapezoidalPlaneBounds::offset
float offset
Definition: TrapezoidalPlaneBounds.h:69
Bounds
Definition: Bounds.h:18
TrapezoidalPlaneBounds::yAxisOrientation
virtual int yAxisOrientation() const
Definition: TrapezoidalPlaneBounds.cc:16
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
Bounds::inside
virtual bool inside(const Local3DPoint &) const =0
Determine if the point is inside the bounds.
LocalError.h
TrapezoidalPlaneBounds.h
TrapezoidalPlaneBounds::parameters
virtual const std::array< const float, 4 > parameters() const
Definition: TrapezoidalPlaneBounds.cc:49
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
Point3DBase< float, LocalTag >
a
double a
Definition: hdecay.h:119
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
LocalError
Definition: LocalError.h:12
TrapezoidalPlaneBounds::htopedge
float htopedge
Definition: TrapezoidalPlaneBounds.h:64
submitPVResolutionJobs.err
err
Definition: submitPVResolutionJobs.py:85
TrapezoidalPlaneBounds::hthickness
float hthickness
Definition: TrapezoidalPlaneBounds.h:66
TrapezoidalPlaneBounds
Definition: TrapezoidalPlaneBounds.h:15
TrapezoidalPlaneBounds::clone
Bounds * clone() const override
Definition: TrapezoidalPlaneBounds.cc:47
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
cms::cuda::be
int be
Definition: HistoContainer.h:126
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
TrapezoidalPlaneBounds::hapothem
float hapothem
Definition: TrapezoidalPlaneBounds.h:65
TrapezoidalPlaneBounds::inside
bool inside(const Local2DPoint &p) const override
Definition: TrapezoidalPlaneBounds.cc:18