Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef Geom_Bounds_H
0002 #define Geom_Bounds_H
0003 
0004 #include "DataFormats/GeometryVector/interface/LocalPoint.h"
0005 #include "DataFormats/GeometrySurface/interface/LocalError.h"
0006 
0007 #include "DataFormats/GeometrySurface/interface/BoundSpan.h"
0008 
0009 /** \class Bounds 
0010  *
0011  *  Abstract base class for Bounds.
0012  *
0013  *  Bounds provide a general way to specify the form of a concrete 
0014  *  surface. For example, a BoundPlane with TrapezoidalPlaneBounds
0015  *  has a trapezoidal shape.
0016  */
0017 
0018 class Bounds {
0019 public:
0020   virtual ~Bounds() {}
0021 
0022   /// "Lenght" of the bounded volume; refer to the concrete class documentation
0023   /// for the specific definition.
0024   virtual float length() const = 0;
0025 
0026   /// "width" of the bounds; refer to the concrete class documentation
0027   /// for the specific definition.
0028   virtual float width() const = 0;
0029 
0030   /// "Thickness" of the bound around the surface;
0031   /// refer to the concrete class documentation for the specific definition.
0032   virtual float thickness() const = 0;
0033 
0034   /// Width at half length. Useful for e.g. pitch definition.
0035   virtual float widthAtHalfLength() const { return width(); }
0036 
0037   /// Determine if the point is inside the bounds.
0038   virtual bool inside(const Local3DPoint&) const = 0;
0039   virtual bool inside(const Local2DPoint& p) const { return inside(Local3DPoint(p.x(), p.y(), 0)); }
0040 
0041   /// Determine if a point is inside the bounds, taking a tollerance into account
0042   virtual bool inside(const Local2DPoint& p, float tollerance) const {
0043     return inside(p, LocalError(tollerance * tollerance, 0.f, tollerance * tollerance));
0044   }
0045 
0046   // For propagation with uncertainties - one has to know by how
0047   // much one missed a surface
0048   // virtual Local2DVector<float> howFar( const Local2DPoint&) = 0;
0049   //
0050   // Or maybe a better way of determining if a surface is "touched"
0051   // by a trajectory is to have a method
0052 
0053   /// Determine if a point is inside the bounds, taking error into account
0054   virtual bool inside(const Local3DPoint&, const LocalError&, float scale = 1.f) const = 0;
0055 
0056   /// Determine if a 2D point is inside the bounds, taking error into account
0057   virtual bool inside(const Local2DPoint& p, const LocalError& err, float scale = 1.f) const {
0058     return inside(Local3DPoint(p.x(), p.y(), 0), err, scale);
0059   }
0060 
0061   virtual float significanceInside(const Local3DPoint&, const LocalError&) const;
0062 
0063   virtual Bounds* clone() const = 0;
0064 
0065   std::pair<float, float> const& phiSpan() const { return m_span.phiSpan(); }
0066   std::pair<float, float> const& zSpan() const { return m_span.zSpan(); }
0067   std::pair<float, float> const& rSpan() const { return m_span.rSpan(); }
0068 
0069   void computeSpan(Surface const& plane) { m_span.compute(plane); }
0070 
0071 private:
0072   BoundSpan m_span;
0073 };
0074 
0075 #endif