CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/DataFormats/GeometrySurface/interface/Cylinder.h

Go to the documentation of this file.
00001 #ifndef Geom_Cylinder_H
00002 #define Geom_Cylinder_H
00003 
00017 #include "DataFormats/GeometrySurface/interface/Surface.h"
00018 #include "DataFormats/GeometrySurface/interface/Plane.h"
00019 
00020 class Cylinder : public virtual Surface {
00021 public:
00022   typedef ReferenceCountingPointer<Cylinder> CylinderPointer;
00023   typedef ConstReferenceCountingPointer<Cylinder> ConstCylinderPointer;
00024 
00025 
00029   static CylinderPointer build(const PositionType& pos,
00030                                const RotationType& rot,
00031                                Scalar radius,
00032                                MediumProperties* mp=0) {
00033     return CylinderPointer(new Cylinder(pos, rot, radius, mp));
00034   }
00035 
00036 
00037   // -- DEPRECATED CONSTRUCTORS
00038 
00042   Cylinder( const PositionType& pos, const RotationType& rot, Scalar radius) :
00043     Surface( pos, rot), theRadius(radius) {}
00044 
00048   Cylinder( const PositionType& pos, const RotationType& rot, Scalar radius,
00049          MediumProperties* mp) : 
00050     Surface( pos, rot, mp), theRadius(radius) {}
00051 
00052   // -- Extension of Surface interface for cylinder
00053 
00055   Scalar radius() const {return theRadius;}
00056 
00057   // -- Implementation of Surface interface    
00058 
00059   using Surface::side;
00060   virtual Side side( const LocalPoint& p, Scalar toler) const;
00061 
00063   virtual ReferenceCountingPointer<TangentPlane> tangentPlane (const GlobalPoint&) const;
00065   virtual ReferenceCountingPointer<TangentPlane> tangentPlane (const LocalPoint&) const;
00066 
00068   Plane fastTangent(const GlobalPoint& aPoint) const{
00069     GlobalVector yPlane(rotation().z());
00070     GlobalVector xPlane(yPlane.cross(aPoint-position()));
00071     return Plane(aPoint,RotationType(xPlane, yPlane));
00072   }
00073 
00075   Plane fastTangent(const LocalPoint& aPoint) const {
00076     return fastTangent(toGlobal(aPoint));
00077   } 
00078 
00079 private:
00080 
00081   Scalar theRadius;
00082 
00083 };
00084 
00085 #endif