CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
RectangularPlaneBounds Class Reference

#include <RectangularPlaneBounds.h>

Inheritance diagram for RectangularPlaneBounds:
Bounds

Public Member Functions

virtual Boundsclone () const
 
virtual bool inside (const Local2DPoint &p) const
 
virtual bool inside (const Local3DPoint &p) const
 Determine if the point is inside the bounds. More...
 
virtual bool inside (const Local2DPoint &p, float tollerance) const
 Determine if a point is inside the bounds, taking a tollerance into account. More...
 
virtual bool inside (const Local3DPoint &p, const LocalError &err, float scale=1.) const
 Determine if a point is inside the bounds, taking error into account. More...
 
virtual bool inside (const Local2DPoint &p, const LocalError &err, float scale=1.) const
 Determine if a 2D point is inside the bounds, taking error into account. More...
 
virtual float length () const
 Lenght along local Y. More...
 
 RectangularPlaneBounds (float w, float h, float t)
 
virtual float thickness () const
 Thickness of the volume in local Z. More...
 
virtual float width () const
 Width along local X. More...
 
- Public Member Functions inherited from Bounds
virtual float widthAtHalfLength () const
 Width at half length. Useful for e.g. pitch definition. More...
 
virtual ~Bounds ()
 

Private Attributes

float halfLength
 
float halfThickness
 
float halfWidth
 

Detailed Description

Rectangular plane bounds. Local Coordinate system coincides with center of the box with X axis along the width and Y axis along the lenght.

Definition at line 14 of file RectangularPlaneBounds.h.

Constructor & Destructor Documentation

RectangularPlaneBounds::RectangularPlaneBounds ( float  w,
float  h,
float  t 
)

Construct from half width (extension in local X), half length (Y) and half thickness (Z)

Definition at line 5 of file RectangularPlaneBounds.cc.

Referenced by clone().

5  :
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
T w() const

Member Function Documentation

Bounds * RectangularPlaneBounds::clone ( void  ) const
virtual

Implements Bounds.

Definition at line 54 of file RectangularPlaneBounds.cc.

References RectangularPlaneBounds().

54  {
55  return new RectangularPlaneBounds(*this);
56 }
RectangularPlaneBounds(float w, float h, float t)
bool RectangularPlaneBounds::inside ( const Local2DPoint p) const
virtual

Reimplemented from Bounds.

Definition at line 9 of file RectangularPlaneBounds.cc.

References halfLength, halfWidth, PV2DBase< T, PVType, FrameType >::x(), and PV2DBase< T, PVType, FrameType >::y().

Referenced by TrackerValidationVariables::fillHitQuantities().

9  {
10  return fabs(p.x()) <= halfWidth && fabs(p.y()) <= halfLength;
11 }
T y() const
Definition: PV2DBase.h:45
T x() const
Definition: PV2DBase.h:44
bool RectangularPlaneBounds::inside ( const Local3DPoint ) const
virtual

Determine if the point is inside the bounds.

Implements Bounds.

Definition at line 13 of file RectangularPlaneBounds.cc.

References halfLength, halfThickness, halfWidth, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

13  {
14  return
15  fabs(p.x()) < halfWidth &&
16  fabs(p.y()) < halfLength &&
17  fabs(p.z()) < halfThickness;
18 }
bool RectangularPlaneBounds::inside ( const Local2DPoint p,
float  tollerance 
) const
virtual

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

Reimplemented from Bounds.

Definition at line 20 of file RectangularPlaneBounds.cc.

References abs, halfLength, halfWidth, PV2DBase< T, PVType, FrameType >::x(), and PV2DBase< T, PVType, FrameType >::y().

20  {
21  return std::abs(p.x()) < halfWidth + tollerance &&
22  std::abs(p.y()) < halfLength + tollerance;
23 
24 }
T y() const
Definition: PV2DBase.h:45
#define abs(x)
Definition: mlp_lapack.h:159
T x() const
Definition: PV2DBase.h:44
bool RectangularPlaneBounds::inside ( const Local3DPoint ,
const LocalError ,
float  scale = 1. 
) const
virtual

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

Implements Bounds.

Definition at line 26 of file RectangularPlaneBounds.cc.

References halfLength, halfThickness, halfWidth, mathSSE::sqrt(), PV3DBase< T, PVType, FrameType >::x(), LocalError::xx(), PV3DBase< T, PVType, FrameType >::y(), LocalError::yy(), and PV3DBase< T, PVType, FrameType >::z().

27  {
28  if(scale >=0){
29  return
30  fabs(p.z()) < halfThickness &&
31  (fabs(p.x()) < halfWidth || fabs(p.x()) < halfWidth + std::sqrt(err.xx())*scale) &&
32  (fabs(p.y()) < halfLength || fabs(p.y()) < halfLength + std::sqrt(err.yy())*scale);
33  }else{
34  return
35  fabs(p.z()) < halfThickness &&
36  (fabs(p.x()) < halfWidth + std::sqrt(err.xx())*scale) &&
37  (fabs(p.y()) < halfLength + std::sqrt(err.yy())*scale);
38  }
39 }
T sqrt(T t)
Definition: SSEVec.h:46
bool RectangularPlaneBounds::inside ( const Local2DPoint p,
const LocalError err,
float  scale = 1. 
) const
virtual

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

Reimplemented from Bounds.

Definition at line 41 of file RectangularPlaneBounds.cc.

References halfLength, halfWidth, mathSSE::sqrt(), PV2DBase< T, PVType, FrameType >::x(), LocalError::xx(), PV2DBase< T, PVType, FrameType >::y(), and LocalError::yy().

42  {
43  if(scale >=0){
44  return
45  (fabs(p.x()) < halfWidth || fabs(p.x()) < halfWidth + std::sqrt(err.xx())*scale) &&
46  (fabs(p.y()) < halfLength || fabs(p.y()) < halfLength + std::sqrt(err.yy())*scale);
47  }else{
48  return
49  (fabs(p.x()) < halfWidth + std::sqrt(err.xx())*scale) &&
50  (fabs(p.y()) < halfLength + std::sqrt(err.yy())*scale);
51  }
52 }
float xx() const
Definition: LocalError.h:24
T y() const
Definition: PV2DBase.h:45
float yy() const
Definition: LocalError.h:26
T sqrt(T t)
Definition: SSEVec.h:46
T x() const
Definition: PV2DBase.h:44
virtual float RectangularPlaneBounds::length ( ) const
inlinevirtual
virtual float RectangularPlaneBounds::thickness ( ) const
inlinevirtual

Thickness of the volume in local Z.

Implements Bounds.

Definition at line 26 of file RectangularPlaneBounds.h.

References halfThickness.

virtual float RectangularPlaneBounds::width ( ) const
inlinevirtual

Member Data Documentation

float RectangularPlaneBounds::halfLength
private

Definition at line 45 of file RectangularPlaneBounds.h.

Referenced by inside(), and length().

float RectangularPlaneBounds::halfThickness
private

Definition at line 46 of file RectangularPlaneBounds.h.

Referenced by inside(), and thickness().

float RectangularPlaneBounds::halfWidth
private

Definition at line 44 of file RectangularPlaneBounds.h.

Referenced by inside(), and width().