CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
FourPointPlaneBounds Class Reference

#include <FourPointPlaneBounds.h>

Inheritance diagram for FourPointPlaneBounds:
Bounds

Public Types

typedef LocalPoint::ScalarType Scalar
 

Public Member Functions

Boundsclone () const override
 
 FourPointPlaneBounds (const LocalPoint &a, const LocalPoint &b, const LocalPoint &c, const LocalPoint &d)
 
bool inside (const Local3DPoint &lp) const override
 Determine if the point is inside the bounds. More...
 
bool inside (const Local3DPoint &lp, const LocalError &e, float scale) const override
 Determine if a point is inside the bounds, taking error into account. More...
 
float length () const override
 
float thickness () const override
 
float width () const override
 
 ~FourPointPlaneBounds () override
 
- Public Member Functions inherited from Bounds
void computeSpan (Surface const &plane)
 
virtual bool inside (const Local2DPoint &p) const
 
virtual bool inside (const Local2DPoint &p, const LocalError &err, float scale=1.f) const
 Determine if a 2D point is inside the bounds, taking error into account. More...
 
virtual bool inside (const Local2DPoint &p, float tollerance) const
 Determine if a point is inside the bounds, taking a tollerance into account. More...
 
std::pair< float, float > const & phiSpan () const
 
std::pair< float, float > const & rSpan () const
 
virtual float significanceInside (const Local3DPoint &, const LocalError &) const
 
virtual float widthAtHalfLength () const
 Width at half length. Useful for e.g. pitch definition. More...
 
std::pair< float, float > const & zSpan () const
 
virtual ~Bounds ()
 

Private Member Functions

double checkSide (int i, const Local2DPoint &lp) const
 
double checkSide (int i, Scalar x, Scalar y) const
 
const Local2DPointcorner (int i) const
 

Private Attributes

Local2DPoint corners_ [4]
 

Detailed Description

Definition at line 10 of file FourPointPlaneBounds.h.

Member Typedef Documentation

◆ Scalar

Definition at line 12 of file FourPointPlaneBounds.h.

Constructor & Destructor Documentation

◆ FourPointPlaneBounds()

FourPointPlaneBounds::FourPointPlaneBounds ( const LocalPoint a,
const LocalPoint b,
const LocalPoint c,
const LocalPoint d 
)

The corners are ASSUMED to come in cyclic order

Definition at line 8 of file FourPointPlaneBounds.cc.

11  {
12  corners_[0] = Local2DPoint(a.x(), a.y());
13  corners_[1] = Local2DPoint(b.x(), b.y());
14  corners_[2] = Local2DPoint(c.x(), c.y());
15  corners_[3] = Local2DPoint(d.x(), d.y());
16 
17  // check for convexity
18  for (int i = 0; i < 4; ++i) {
19  if (checkSide(i, corner(i + 2)) * checkSide(i, corner(i + 3)) < 0) { // not on same side
20  throw GeometryError("FourPointPlaneBounds: coners not in order or not convex");
21  }
22  }
23 
24  double side = checkSide(0, corners_[2]); // - for clockwise corners, + for counterclockwise
25  if (side < 0) {
26  std::cout << "FourPointPlaneBounds: Changing order of corners to counterclockwise" << std::endl;
27  std::swap(corners_[1], corners_[3]);
28  }
29 }

References a, b, c, checkSide(), corner(), corners_, gather_cfg::cout, ztail::d, mps_fire::i, and std::swap().

Referenced by clone().

◆ ~FourPointPlaneBounds()

FourPointPlaneBounds::~FourPointPlaneBounds ( )
inlineoverride

Definition at line 17 of file FourPointPlaneBounds.h.

17 {}

Member Function Documentation

◆ checkSide() [1/2]

double FourPointPlaneBounds::checkSide ( int  i,
const Local2DPoint lp 
) const
private

Definition at line 31 of file FourPointPlaneBounds.cc.

31 { return checkSide(i, lp.x(), lp.y()); }

References mps_fire::i, PV2DBase< T, PVType, FrameType >::x(), and PV2DBase< T, PVType, FrameType >::y().

Referenced by FourPointPlaneBounds(), and inside().

◆ checkSide() [2/2]

double FourPointPlaneBounds::checkSide ( int  i,
Scalar  x,
Scalar  y 
) const
inlineprivate

Definition at line 36 of file FourPointPlaneBounds.h.

36  {
37  const Local2DPoint& cor(corner(i));
38  Local2DVector v(corner(i + 1) - cor);
39  // Local2DVector normal( -v.y(), v.x()); // 90 deg rotated
40  return -v.y() * (x - cor.x()) + v.x() * (y - cor.y()); // == normal.dot(LP(x,y)-cor))
41  }

References corner(), mps_fire::i, findQualityFiles::v, x, PV2DBase< T, PVType, FrameType >::x(), y, and PV2DBase< T, PVType, FrameType >::y().

◆ clone()

Bounds* FourPointPlaneBounds::clone ( void  ) const
inlineoverridevirtual

Implements Bounds.

Definition at line 28 of file FourPointPlaneBounds.h.

28 { return new FourPointPlaneBounds(*this); }

References FourPointPlaneBounds().

◆ corner()

const Local2DPoint& FourPointPlaneBounds::corner ( int  i) const
inlineprivate

Definition at line 33 of file FourPointPlaneBounds.h.

33 { return corners_[i % 4]; }

References corners_, and mps_fire::i.

Referenced by checkSide(), and FourPointPlaneBounds().

◆ inside() [1/2]

bool FourPointPlaneBounds::inside ( const Local3DPoint ) const
overridevirtual

Determine if the point is inside the bounds.

Implements Bounds.

Definition at line 33 of file FourPointPlaneBounds.cc.

33  {
34  for (int i = 0; i < 4; ++i) {
35  if (checkSide(i, lp.x(), lp.y()) < 0)
36  return false;
37  }
38  return true;
39 }

References checkSide(), mps_fire::i, PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

◆ inside() [2/2]

bool FourPointPlaneBounds::inside ( const Local3DPoint ,
const LocalError ,
float  scale 
) const
inlineoverridevirtual

Determine if a point is inside the bounds, taking error into account.

Implements Bounds.

Definition at line 26 of file FourPointPlaneBounds.h.

26 { return inside(lp); }

References inside().

Referenced by inside().

◆ length()

float FourPointPlaneBounds::length ( ) const
overridevirtual

"Lenght" of the bounded volume; refer to the concrete class documentation for the specific definition.

Implements Bounds.

Definition at line 41 of file FourPointPlaneBounds.cc.

41 { return 0; }

◆ thickness()

float FourPointPlaneBounds::thickness ( ) const
overridevirtual

"Thickness" of the bound around the surface; refer to the concrete class documentation for the specific definition.

Implements Bounds.

Definition at line 43 of file FourPointPlaneBounds.cc.

43 { return 0; }

◆ width()

float FourPointPlaneBounds::width ( ) const
overridevirtual

"width" of the bounds; refer to the concrete class documentation for the specific definition.

Implements Bounds.

Definition at line 42 of file FourPointPlaneBounds.cc.

42 { return 0; }

Member Data Documentation

◆ corners_

Local2DPoint FourPointPlaneBounds::corners_[4]
private

Definition at line 31 of file FourPointPlaneBounds.h.

Referenced by corner(), and FourPointPlaneBounds().

Point2DBase< float, LocalTag >
DDAxes::y
mps_fire.i
i
Definition: mps_fire.py:428
gather_cfg.cout
cout
Definition: gather_cfg.py:144
DDAxes::x
findQualityFiles.v
v
Definition: findQualityFiles.py:179
FourPointPlaneBounds::inside
bool inside(const Local3DPoint &lp) const override
Determine if the point is inside the bounds.
Definition: FourPointPlaneBounds.cc:33
std::swap
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
Definition: DataFrameContainer.h:209
Vector2DBase
Definition: Vector2DBase.h:8
b
double b
Definition: hdecay.h:118
a
double a
Definition: hdecay.h:119
FourPointPlaneBounds::FourPointPlaneBounds
FourPointPlaneBounds(const LocalPoint &a, const LocalPoint &b, const LocalPoint &c, const LocalPoint &d)
Definition: FourPointPlaneBounds.cc:8
PV2DBase::y
T y() const
Definition: PV2DBase.h:44
PV2DBase::x
T x() const
Definition: PV2DBase.h:43
FourPointPlaneBounds::corner
const Local2DPoint & corner(int i) const
Definition: FourPointPlaneBounds.h:33
FourPointPlaneBounds::corners_
Local2DPoint corners_[4]
Definition: FourPointPlaneBounds.h:31
GeometryError
Definition: GeomExceptions.h:18
ztail.d
d
Definition: ztail.py:151
FourPointPlaneBounds::checkSide
double checkSide(int i, const Local2DPoint &lp) const
Definition: FourPointPlaneBounds.cc:31
Local2DPoint
Point2DBase< float, LocalTag > Local2DPoint
Definition: LocalPoint.h:8
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:56