Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:53:30

0001 #ifndef DataFormats_GeometrySurface_DiskSectorBounds_h
0002 #define DataFormats_GeometrySurface_DiskSectorBounds_h
0003 
0004 #include "DataFormats/GeometryVector/interface/LocalPoint.h"
0005 #include "DataFormats/GeometrySurface/interface/LocalError.h"
0006 #include "DataFormats/GeometrySurface/interface/Bounds.h"
0007 #include <algorithm>
0008 #include <cmath>
0009 #include <cassert>
0010 
0011 class DiskSectorBounds final : public Bounds {
0012 public:
0013   DiskSectorBounds(float rmin, float rmax, float zmin, float zmax, float phiExt)
0014       : theRmin(rmin), theRmax(rmax), theZmin(zmin), theZmax(zmax), thePhiExtH(0.5f * phiExt) {
0015     assert(thePhiExtH > 0);
0016     if (theRmin > theRmax)
0017       std::swap(theRmin, theRmax);
0018     if (theZmin > theZmax)
0019       std::swap(theZmin, theZmax);
0020     theOffset = theRmin + 0.5f * (theRmax - theRmin);
0021   }
0022 
0023   float length() const override { return theRmax - theRmin * std::cos(thePhiExtH); }
0024   float width() const override { return 2.f * theRmax * std::sin(thePhiExtH); }
0025   float thickness() const override { return theZmax - theZmin; }
0026 
0027   bool inside(const Local3DPoint& p) const override;
0028 
0029   bool inside(const Local3DPoint& p, const LocalError& err, float scale) const override;
0030 
0031   Bounds* clone() const override { return new DiskSectorBounds(*this); }
0032 
0033   float innerRadius() const { return theRmin; }
0034   float outerRadius() const { return theRmax; }
0035   float phiHalfExtension() const { return thePhiExtH; }
0036 
0037 private:
0038   float theRmin;
0039   float theRmax;
0040   float theZmin;
0041   float theZmax;
0042   float thePhiExtH;
0043   float theOffset;
0044 };
0045 
0046 #endif