File indexing completed on 2024-04-06 12:04:14
0001 #ifndef Geom_Surface_H
0002 #define Geom_Surface_H
0003
0004 #include "DataFormats/GeometrySurface/interface/ReferenceCounted.h"
0005
0006 #include "DataFormats/GeometrySurface/interface/GloballyPositioned.h"
0007
0008 #include "DataFormats/GeometrySurface/interface/MediumProperties.h"
0009 #include "DataFormats/GeometrySurface/interface/Bounds.h"
0010
0011 #include "FWCore/Utilities/interface/clone_ptr.h"
0012 #include <algorithm>
0013
0014
0015
0016
0017 namespace SurfaceOrientation {
0018 enum Side { positiveSide, negativeSide, onSurface };
0019 enum GlobalFace { outer, inner, zplus, zminus, phiplus, phiminus };
0020 }
0021
0022
0023
0024 class Plane;
0025 using TangentPlane = Plane;
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036 class Surface : public ReferenceCountedInConditions, public GloballyPositioned<float> {
0037 public:
0038 using Side = SurfaceOrientation::Side;
0039
0040 using Base = GloballyPositioned<float>;
0041
0042 ~Surface() override {}
0043
0044 protected:
0045 Surface() {}
0046 Surface(const PositionType& pos, const RotationType& rot) : Base(pos, rot) {}
0047
0048 Surface(const PositionType& pos, const RotationType& rot, Bounds* bounds) : Base(pos, rot), theBounds(bounds) {}
0049
0050 Surface(const PositionType& pos, const RotationType& rot, MediumProperties mp)
0051 : Base(pos, rot), theMediumProperties(mp) {}
0052
0053 Surface(const PositionType& pos, const RotationType& rot, MediumProperties mp, Bounds* bounds)
0054 : Base(pos, rot), theMediumProperties(mp), theBounds(bounds) {}
0055
0056 Surface(const Surface& iSurface)
0057 : ReferenceCountedInConditions(iSurface),
0058 Base(iSurface),
0059 theMediumProperties(iSurface.theMediumProperties),
0060 theBounds(iSurface.theBounds) {}
0061
0062 Surface(Surface&& iSurface)
0063 : ReferenceCountedInConditions(iSurface),
0064 Base(iSurface),
0065 theMediumProperties(iSurface.theMediumProperties),
0066 theBounds(std::move(iSurface.theBounds)) {}
0067
0068 public:
0069
0070
0071
0072
0073 virtual Side side(const LocalPoint& p, Scalar tolerance = 0) const = 0;
0074 virtual Side side(const GlobalPoint& p, Scalar tolerance = 0) const { return side(toLocal(p), tolerance); }
0075
0076 using Base::toGlobal;
0077 using Base::toLocal;
0078
0079 GlobalPoint toGlobal(const Point2DBase<Scalar, LocalTag> lp) const {
0080 return GlobalPoint(rotation().multiplyInverse(lp.basicVector()) + position().basicVector());
0081 }
0082
0083 const MediumProperties& mediumProperties() const { return theMediumProperties; }
0084
0085 void setMediumProperties(const MediumProperties& mp) { theMediumProperties = mp; }
0086
0087 const Bounds& bounds() const { return *theBounds; }
0088
0089
0090 std::pair<float, float> const& phiSpan() const { return bounds().phiSpan(); }
0091 std::pair<float, float> const& zSpan() const { return bounds().zSpan(); }
0092 std::pair<float, float> const& rSpan() const { return bounds().rSpan(); }
0093
0094
0095
0096
0097
0098
0099
0100 virtual ConstReferenceCountingPointer<TangentPlane> tangentPlane(const GlobalPoint&) const = 0;
0101
0102
0103 virtual ConstReferenceCountingPointer<TangentPlane> tangentPlane(const LocalPoint&) const = 0;
0104
0105 protected:
0106 MediumProperties theMediumProperties;
0107 extstd::clone_ptr<Bounds> theBounds;
0108 };
0109
0110 #endif