Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef GeneralNSurfaceDelimitedBounds_H
0002 #define GeneralNSurfaceDelimitedBounds_H
0003 
0004 #include "DataFormats/GeometrySurface/interface/Bounds.h"
0005 #include "DataFormats/GeometrySurface/interface/Surface.h"
0006 
0007 #include <vector>
0008 
0009 /** Bounds for a surface of any type, delimited by N other surfaces of any type.
0010  *  A point is "inside" if it is on the correct side of all delimiting surfaces.
0011  *  This way of computing "inside" is relatively expensive, and should only be applied
0012  *  to situations where there is no specialized implementation for the concrete
0013  *  surface types. 
0014  */
0015 
0016 class GeneralNSurfaceDelimitedBounds final : public Bounds {
0017 public:
0018   typedef std::pair<const Surface*, SurfaceOrientation::Side> SurfaceAndSide;
0019   typedef std::vector<SurfaceAndSide> SurfaceContainer;
0020 
0021   GeneralNSurfaceDelimitedBounds(const Surface* surf, const std::vector<SurfaceAndSide>& limits)
0022       : theLimits(limits), theSurface(surf) {}
0023 
0024   float length() const override { return 0; }
0025   float width() const override { return 0; }
0026   float thickness() const override { return 0; }
0027 
0028   using Bounds::inside;
0029 
0030   bool inside(const Local3DPoint& lp) const override { return myInside(lp, 0); }
0031 
0032   bool inside(const Local3DPoint&, const LocalError&, float scale = 1.f) const override;
0033 
0034   Bounds* clone() const override { return new GeneralNSurfaceDelimitedBounds(*this); }
0035 
0036 private:
0037   SurfaceContainer theLimits;
0038   const Surface* theSurface;
0039 
0040   bool myInside(const Local3DPoint& lp, float tolerance) const;
0041 };
0042 
0043 #endif