Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:04:14

0001 #ifndef Geom_RectangularPlaneBounds_H
0002 #define Geom_RectangularPlaneBounds_H
0003 
0004 #include "DataFormats/GeometryVector/interface/LocalPoint.h"
0005 #include "DataFormats/GeometrySurface/interface/Bounds.h"
0006 
0007 /** \class RectangularPlaneBounds
0008  *  Rectangular plane bounds.
0009  *  Local Coordinate system coincides with center of the box
0010  *  with X axis along the width and Y axis along the lenght.
0011  */
0012 class RectangularPlaneBounds final : public Bounds {
0013 public:
0014   /// Construct from  half width (extension in local X),
0015   /// half length (Y) and half thickness (Z)
0016   RectangularPlaneBounds(float w, float h, float t);
0017   ~RectangularPlaneBounds() override;
0018 
0019   /// Lenght along local Y
0020   float length() const override { return 2 * halfLength; }
0021   /// Width along local X
0022   float width() const override { return 2 * halfWidth; }
0023   /// Thickness of the volume in local Z
0024   float thickness() const override { return 2 * halfThickness; }
0025 
0026   // basic bounds function
0027   using Bounds::inside;
0028 
0029   bool inside(const Local2DPoint& p) const override {
0030     return (std::abs(p.x()) < halfWidth) && (std::abs(p.y()) < halfLength);
0031   }
0032 
0033   bool inside(const Local3DPoint& p) const override {
0034     return (std::abs(p.x()) < halfWidth) && (std::abs(p.y()) < halfLength) && (std::abs(p.z()) < halfThickness);
0035   }
0036 
0037   bool inside(const Local2DPoint& p, float tollerance) const override {
0038     return (std::abs(p.x()) < (halfWidth + tollerance)) && (std::abs(p.y()) < (halfLength + tollerance));
0039   }
0040 
0041   bool inside(const Local3DPoint& p, const LocalError& err, float scale = 1.f) const override;
0042 
0043   bool inside(const Local2DPoint& p, const LocalError& err, float scale = 1.f) const override;
0044 
0045   float significanceInside(const Local3DPoint&, const LocalError&) const override;
0046 
0047   // compatible of being inside or outside...
0048   std::pair<bool, bool> inout(const Local3DPoint& p, const LocalError& err, float scale = 1.f) const;
0049 
0050   Bounds* clone() const override;
0051 
0052 private:
0053   float halfWidth;
0054   float halfLength;
0055   float halfThickness;
0056 };
0057 
0058 #endif