CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC4_patch1/src/DataFormats/GeometrySurface/interface/Plane.h

Go to the documentation of this file.
00001 #ifndef Geom_Plane_H
00002 #define Geom_Plane_H
00003 
00014 #include "DataFormats/GeometrySurface/interface/Surface.h"
00015 #include "boost/intrusive_ptr.hpp" 
00016 
00017 class Plane : public virtual Surface {
00018 public:
00019   typedef ReferenceCountingPointer<Plane> PlanePointer;
00020   typedef ConstReferenceCountingPointer<Plane> ConstPlanePointer;
00021 
00025   static PlanePointer build(const PositionType& pos,
00026                                     const RotationType& rot,
00027                                     MediumProperties* mp=0) {
00028     return PlanePointer(new Plane(pos, rot, mp));
00029   }
00030 
00031   // -- DEPRECATED CONSTRUCTORS
00032 
00036   Plane( const PositionType& pos, const RotationType& rot) :
00037     Surface( pos, rot) {}
00038 
00042   Plane( const PositionType& pos, const RotationType& rot, MediumProperties* mp) : 
00043     Surface( pos, rot, mp) {}
00044 
00045   ~Plane(){}
00046 
00047 // extension of Surface interface for planes
00048 
00049   GlobalVector normalVector() const {
00050     return GlobalVector( rotation().zx(), rotation().zy(), rotation().zz());
00051   }
00052 
00054   float localZ (const GlobalPoint& gp) const {
00055     return normalVector().dot(gp-position());
00056   }
00057 
00059   float localZ (const GlobalVector& gv) const {
00060     return normalVector().dot(gv);
00061   }
00062 
00063 // implementation of Surface interface    
00064 
00065   virtual SurfaceOrientation::Side side( const LocalPoint& p, Scalar toler) const GCC11_FINAL {
00066     return (std::abs(p.z())<toler) ? SurfaceOrientation::onSurface : 
00067         (p.z()>0 ? SurfaceOrientation::positiveSide : SurfaceOrientation::negativeSide);
00068   }
00069 
00070   virtual SurfaceOrientation::Side side( const GlobalPoint& p, Scalar toler) const GCC11_FINAL {
00071     Scalar lz = localZ(p);
00072     return (std::abs(lz)<toler ? SurfaceOrientation::onSurface : 
00073             (lz>0 ? SurfaceOrientation::positiveSide : SurfaceOrientation::negativeSide));
00074   }
00075 
00077   virtual ReferenceCountingPointer<TangentPlane> tangentPlane (const GlobalPoint&) const GCC11_FINAL;
00078 
00080   virtual ReferenceCountingPointer<TangentPlane> tangentPlane (const LocalPoint&) const GCC11_FINAL;
00081 
00082 
00083 
00084 
00085 };
00086 
00087 #endif