Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef Geom_TrapezoidalPlaneBounds_H
0002 #define Geom_TrapezoidalPlaneBounds_H
0003 
0004 #include "DataFormats/GeometryVector/interface/LocalPoint.h"
0005 #include "DataFormats/GeometrySurface/interface/Bounds.h"
0006 #include <array>
0007 
0008 /** \class TrapezoidalPlaneBounds
0009  *  Trapezoidal plane bounds.
0010  *  Local Coordinate system coincides with center of the box
0011  *  with Y axis being the symmetry axis along the height
0012  *  and pointing in the direction of top_edge.
0013  */
0014 
0015 class TrapezoidalPlaneBounds /* final */ : public Bounds {
0016 public:
0017   /** constructed from:
0018    *    half bottom edge (smaller side width)
0019    *    half top edge    (larger side width)
0020    *    half apothem (distance from top to bottom sides, 
0021    *                  measured perpendicularly to them)
0022    *    half thickness
0023    */
0024   TrapezoidalPlaneBounds(float be, float te, float a, float t);
0025 
0026   /** apothem (full, not half)*/
0027   float length() const override { return 2 * hapothem; }
0028 
0029   /** largest width (full, not half)*/
0030   float width() const override { return 2 * std::max(hbotedge, htopedge); }
0031 
0032   /** thickness (full, not half)*/
0033   float thickness() const override { return 2 * hthickness; }
0034 
0035   /** Width at half length. Useful for e.g. pitch definition.
0036    */
0037   float widthAtHalfLength() const override { return hbotedge + htopedge; }
0038 
0039   virtual int yAxisOrientation() const;
0040 
0041   using Bounds::inside;
0042 
0043   bool inside(const Local2DPoint& p) const override;
0044 
0045   bool inside(const Local3DPoint& p) const override;
0046 
0047   bool inside(const Local3DPoint& p, const LocalError& err, float scale) const override;
0048 
0049   bool inside(const Local2DPoint& p, const LocalError& err, float scale) const override;
0050 
0051   float significanceInside(const Local3DPoint&, const LocalError&) const override;
0052 
0053   /** returns the 4 parameters needed for construction, in the order
0054    * ( half bottom edge, half top edge, half thickness, half apothem).
0055    * Beware! This order is different from the one in the constructor!
0056    */
0057   virtual const std::array<const float, 4> parameters() const;
0058 
0059   Bounds* clone() const override;
0060 
0061 private:
0062   // persistent part
0063   float hbotedge;
0064   float htopedge;
0065   float hapothem;
0066   float hthickness;
0067 
0068   // transient part
0069   float offset;
0070   float tan_a;
0071 };
0072 
0073 #endif  // Geom_TrapezoidalPlaneBounds_H