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 Referencefinal

#include <RectangularPlaneBounds.h>

Inheritance diagram for RectangularPlaneBounds:
Bounds

Public Member Functions

virtual Boundsclone () const
 
std::pair< bool, bool > inout (const Local3DPoint &p, const LocalError &err, float scale=1.f) 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.f) 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.f) 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...
 
 ~RectangularPlaneBounds ()
 
- Public Member Functions inherited from Bounds
void computeSpan (Surface const &plane)
 
std::pair< float, float > const & phiSpan () const
 
std::pair< float, float > const & rSpan () 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 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  :
const double w
Definition: UKUtility.cc:23
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
RectangularPlaneBounds::~RectangularPlaneBounds ( )

Definition at line 9 of file RectangularPlaneBounds.cc.

9 {}

Member Function Documentation

Bounds * RectangularPlaneBounds::clone ( void  ) const
virtual

Implements Bounds.

Definition at line 44 of file RectangularPlaneBounds.cc.

References RectangularPlaneBounds().

44  {
45  return new RectangularPlaneBounds(*this);
46 }
RectangularPlaneBounds(float w, float h, float t)
std::pair< bool, bool > RectangularPlaneBounds::inout ( const Local3DPoint p,
const LocalError err,
float  scale = 1.f 
) const

Definition at line 29 of file RectangularPlaneBounds.cc.

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

29  {
30  float xl = std::abs(p.x()) - std::sqrt(err.xx())*scale;
31  float xh = std::abs(p.x()) + std::sqrt(err.xx())*scale;
32  bool inx = xl<halfWidth;
33  bool outx = xh>halfWidth;
34 
35  float yl = std::abs(p.y()) - std::sqrt(err.yy())*scale;
36  float yh = std::abs(p.y()) + std::sqrt(err.yy())*scale;
37  bool iny = yl<halfLength;
38  bool outy = yh>halfLength;
39 
40  return std::pair<bool,bool>(inx&&iny,outx||outy);
41 
42 }
float xx() const
Definition: LocalError.h:24
T y() const
Definition: PV3DBase.h:63
float yy() const
Definition: LocalError.h:26
T sqrt(T t)
Definition: SSEVec.h:18
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
T x() const
Definition: PV3DBase.h:62
virtual bool RectangularPlaneBounds::inside ( const Local2DPoint p) const
inlinevirtual

Reimplemented from Bounds.

Definition at line 32 of file RectangularPlaneBounds.h.

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

Referenced by inside().

32  {
33  return
34  (std::abs(p.x()) < halfWidth) &
35  (std::abs(p.y()) < halfLength);
36  }
T y() const
Definition: PV2DBase.h:46
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
T x() const
Definition: PV2DBase.h:45
virtual bool RectangularPlaneBounds::inside ( const Local3DPoint ) const
inlinevirtual

Determine if the point is inside the bounds.

Implements Bounds.

Definition at line 38 of file RectangularPlaneBounds.h.

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

38  {
39  return
40  (std::abs(p.x()) < halfWidth) &
41  (std::abs(p.y()) < halfLength) &
42  (std::abs(p.z()) < halfThickness);
43  }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
virtual bool RectangularPlaneBounds::inside ( const Local2DPoint p,
float  tollerance 
) const
inlinevirtual

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

Reimplemented from Bounds.

Definition at line 47 of file RectangularPlaneBounds.h.

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

47  {
48  return (std::abs(p.x()) < (halfWidth + tollerance) ) &
49  (std::abs(p.y()) < (halfLength + tollerance) );
50  }
T y() const
Definition: PV2DBase.h:46
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
T x() const
Definition: PV2DBase.h:45
bool RectangularPlaneBounds::inside ( const Local3DPoint ,
const LocalError ,
float  scale = 1.f 
) const
virtual

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

Implements Bounds.

Definition at line 11 of file RectangularPlaneBounds.cc.

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

12  {
13  if( (scale >=0) && inside(p) ) return true;
14  return
15  std::abs(p.z()) < halfThickness &&
16  (std::abs(p.x()) < halfWidth + std::sqrt(err.xx())*scale) &&
17  (std::abs(p.y()) < halfLength + std::sqrt(err.yy())*scale);
18 }
virtual bool inside(const Local2DPoint &p) const
T sqrt(T t)
Definition: SSEVec.h:18
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool RectangularPlaneBounds::inside ( const Local2DPoint p,
const LocalError err,
float  scale = 1.f 
) const
virtual

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

Reimplemented from Bounds.

Definition at line 20 of file RectangularPlaneBounds.cc.

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

21  {
22  if( (scale >=0) && inside(p) ) return true;
23  return
24  (std::abs(p.x()) < halfWidth + std::sqrt(err.xx())*scale) &&
25  (std::abs(p.y()) < halfLength + std::sqrt(err.yy())*scale);
26 }
float xx() const
Definition: LocalError.h:24
T y() const
Definition: PV2DBase.h:46
virtual bool inside(const Local2DPoint &p) const
float yy() const
Definition: LocalError.h:26
T sqrt(T t)
Definition: SSEVec.h:18
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
T x() const
Definition: PV2DBase.h:45
virtual float RectangularPlaneBounds::length ( ) const
inlinevirtual

Lenght along local Y.

Implements Bounds.

Definition at line 23 of file RectangularPlaneBounds.h.

References halfLength.

23 { return 2*halfLength;}
virtual float RectangularPlaneBounds::thickness ( ) const
inlinevirtual

Thickness of the volume in local Z.

Implements Bounds.

Definition at line 27 of file RectangularPlaneBounds.h.

References halfThickness.

virtual float RectangularPlaneBounds::width ( ) const
inlinevirtual

Width along local X.

Implements Bounds.

Definition at line 25 of file RectangularPlaneBounds.h.

References halfWidth.

25 { return 2*halfWidth;}

Member Data Documentation

float RectangularPlaneBounds::halfLength
private

Definition at line 66 of file RectangularPlaneBounds.h.

Referenced by inout(), inside(), and length().

float RectangularPlaneBounds::halfThickness
private

Definition at line 67 of file RectangularPlaneBounds.h.

Referenced by inside(), and thickness().

float RectangularPlaneBounds::halfWidth
private

Definition at line 65 of file RectangularPlaneBounds.h.

Referenced by inout(), inside(), and width().