Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:04:14

0001 #ifndef Geom_Cone_H
0002 #define Geom_Cone_H
0003 
0004 /** \class Cone
0005  *
0006  *  A Cone.
0007  *
0008  *  \warning Surfaces are reference counted, so only ReferenceCountingPointer
0009  *  should be used to point to them. For this reason, they should be 
0010  *  using the static build() method. 
0011  *  (The normal constructors will become private in the future).
0012  *
0013  */
0014 
0015 #include "DataFormats/GeometrySurface/interface/Surface.h"
0016 
0017 class Cone final : public Surface {
0018 public:
0019   template <typename... Args>
0020   Cone(const PositionType& vert, Geom::Theta<Scalar> angle, Args&&... args)
0021       : Surface(std::forward<Args>(args)...), theVertex(vert), theAngle(angle) {}
0022 
0023   typedef ReferenceCountingPointer<Cone> ConePointer;
0024   typedef ReferenceCountingPointer<Cone> ConstConePointer;
0025 
0026   /// Construct a cone with the specified vertex and opening angle.
0027   /// The reference frame is defined by pos and rot;
0028   /// the cone axis is parallel to the local Z axis.
0029   static ConePointer build(const PositionType& pos,
0030                            const RotationType& rot,
0031                            const PositionType& vert,
0032                            Geom::Theta<Scalar> angle) {
0033     return ConePointer(new Cone(vert, angle, pos, rot));
0034   }
0035 
0036   // -- DEPRECATED CONSTRUCTOR
0037 
0038   /// Do not use this constructor directly; use the static build method,
0039   /// which returns a ReferenceCountingPointer.
0040   /// This constructor will soon become private
0041   Cone(const PositionType& pos, const RotationType& rot, const PositionType& vert, Geom::Theta<Scalar> angle)
0042       : Surface(pos, rot), theVertex(vert), theAngle(angle) {}
0043 
0044   // -- Extension of Surface interface for cone
0045 
0046   /// Global position of the cone vertex
0047   GlobalPoint vertex() const { return theVertex; }
0048 
0049   /// Angle of the cone
0050   Geom::Theta<float> openingAngle() const { return theAngle; }
0051 
0052   // -- Implementation of Surface interface
0053 
0054   Side side(const LocalPoint& p, Scalar tolerance) const override { return side(toGlobal(p), tolerance); }
0055   Side side(const GlobalPoint& p, Scalar tolerance) const override;
0056 
0057   // Tangent plane to surface from global point
0058   ConstReferenceCountingPointer<TangentPlane> tangentPlane(const GlobalPoint&) const override;
0059   // Tangent plane to surface from local point
0060   ConstReferenceCountingPointer<TangentPlane> tangentPlane(const LocalPoint&) const override;
0061 
0062 private:
0063   GlobalPoint theVertex;
0064   Geom::Theta<Scalar> theAngle;
0065 };
0066 
0067 #endif