CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2/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   ~Cylinder(){}
00038 
00039   // -- DEPRECATED CONSTRUCTORS
00040 
00044   Cylinder( const PositionType& pos, const RotationType& rot, Scalar radius) :
00045     Surface( pos, rot), theRadius(radius) {}
00046 
00050   Cylinder( const PositionType& pos, const RotationType& rot, Scalar radius,
00051          MediumProperties* mp) : 
00052     Surface( pos, rot, mp), theRadius(radius) {}
00053 
00054   // -- Extension of Surface interface for cylinder
00055 
00057   Scalar radius() const {return theRadius;}
00058 
00059   // -- Implementation of Surface interface    
00060 
00061   using Surface::side;
00062   virtual Side side( const LocalPoint& p, Scalar toler) const;
00063 
00065   virtual ReferenceCountingPointer<TangentPlane> tangentPlane (const GlobalPoint&) const;
00067   virtual ReferenceCountingPointer<TangentPlane> tangentPlane (const LocalPoint&) const;
00068 
00070   Plane fastTangent(const GlobalPoint& aPoint) const{
00071     GlobalVector yPlane(rotation().z());
00072     GlobalVector xPlane(yPlane.cross(aPoint-position()));
00073     return Plane(aPoint,RotationType(xPlane, yPlane));
00074   }
00075 
00077   Plane fastTangent(const LocalPoint& aPoint) const {
00078     return fastTangent(toGlobal(aPoint));
00079   } 
00080 
00081 private:
00082 
00083   Scalar theRadius;
00084 
00085 };
00086 
00087 #endif