Go to the documentation of this file.00001 #ifndef Geom_Surface_H
00002 #define Geom_Surface_H
00003
00004 #include "DataFormats/GeometrySurface/interface/ReferenceCounted.h"
00005
00006 #include "DataFormats/GeometrySurface/interface/GloballyPositioned.h"
00007
00008 #include "DataFormats/GeometrySurface/interface/MediumProperties.h"
00009 #include "DataFormats/GeometrySurface/interface/Bounds.h"
00010
00011 #include "FWCore/Utilities/interface/GCC11Compatibility.h"
00012
00013 #ifndef CMS_NOCXX11
00014 #include "FWCore/Utilities/interface/clone_ptr.h"
00015 #endif
00016 #include <algorithm>
00017
00018
00019
00020
00024 namespace SurfaceOrientation {
00025 enum Side {positiveSide, negativeSide, onSurface};
00026 enum GlobalFace {outer,inner,zplus,zminus,phiplus,phiminus};
00027 }
00028
00029
00030
00031
00032 class Plane;
00033 #ifndef CMS_NOCXX11
00034 using TangentPlane = Plane;
00035 #else
00036 typedef Plane TangentPlane;
00037 #endif
00038
00048 class Surface : public GloballyPositioned<float>
00049 , public ReferenceCountedInConditions
00050 {
00051 public:
00052 typedef SurfaceOrientation::Side Side;
00053
00054 typedef GloballyPositioned<float> Base;
00055
00056 virtual ~Surface(){}
00057
00058 protected:
00059 Surface(){}
00060 Surface( const PositionType& pos, const RotationType& rot) :
00061 Base( pos, rot) {}
00062
00063 Surface( const PositionType& pos, const RotationType& rot,
00064 Bounds* bounds) :
00065 Base( pos, rot),
00066 theBounds(bounds)
00067 {}
00068
00069
00070 Surface( const PositionType& pos, const RotationType& rot,
00071 MediumProperties mp) :
00072 Base( pos, rot),
00073 theMediumProperties(mp)
00074 {}
00075
00076 Surface( const PositionType& pos, const RotationType& rot,
00077 MediumProperties mp,
00078 Bounds* bounds) :
00079 Base( pos, rot),
00080 theMediumProperties(mp),
00081 theBounds(bounds)
00082 {}
00083
00084
00085
00086 Surface( const Surface& iSurface ) :
00087 Base( iSurface),
00088 theMediumProperties(iSurface.theMediumProperties),
00089 theBounds(iSurface.theBounds)
00090 {}
00091
00092 #ifndef CMS_NOCXX11
00093 Surface(Surface&& iSurface ) :
00094 Base(iSurface),
00095 theMediumProperties(iSurface.theMediumProperties),
00096 theBounds(std::move(iSurface.theBounds))
00097 {}
00098 #endif
00099
00100 public:
00101
00106 virtual Side side( const LocalPoint& p, Scalar tolerance=0) const = 0;
00107 virtual Side side( const GlobalPoint& p, Scalar tolerance=0) const {
00108 return side( toLocal(p), tolerance);
00109 }
00110
00111 using Base::toGlobal;
00112 using Base::toLocal;
00113
00114 GlobalPoint toGlobal( const Point2DBase< Scalar, LocalTag> lp) const {
00115 return GlobalPoint( rotation().multiplyInverse( lp.basicVector()) +
00116 position().basicVector());
00117 }
00118
00119
00120 const MediumProperties & mediumProperties() const {
00121 return theMediumProperties;
00122 }
00123
00124 void setMediumProperties( const MediumProperties & mp ) {
00125 theMediumProperties = mp;
00126 }
00127
00128 const Bounds& bounds() const { return *theBounds; }
00129
00130
00131 std::pair<float,float> const & phiSpan() const { return bounds().phiSpan(); }
00132 std::pair<float,float> const & zSpan() const { return bounds().zSpan(); }
00133 std::pair<float,float> const & rSpan() const { return bounds().rSpan(); }
00134
00135
00142 virtual ReferenceCountingPointer<TangentPlane> tangentPlane (const GlobalPoint&) const = 0;
00145 virtual ReferenceCountingPointer<TangentPlane> tangentPlane (const LocalPoint&) const = 0;
00146
00147 protected:
00148 MediumProperties theMediumProperties;
00149 #ifndef CMS_NOCXX11
00150 extstd::clone_ptr<Bounds> theBounds;
00151 #else
00152 Bounds * theBounds;
00153 #endif
00154 };
00155
00156
00157 #endif // Geom_Surface_H