#ifndef HELICALSURFACE_HH #define HELICALSURFACE_HH // // $Id: HelicalSurface.hpp,v 1.4 2001/03/31 16:43:13 hobbs Exp $ // // File: HelicalSurface.hpp // Purpose: // Created: 14-JUL-1999 Andrei Mayorov // // $Revision: 1.4 $ // // // Include files #include #include #include #include namespace dgs { /** A helical surface. A helical surface specified by its radius, z half-length and half-width in phi. The surface is oriented with its axis along the z-axis. Center of the surface is positioned at z=0 phi=0 */ class HelicalSurface: public CylindricalSurface { public: /// Default constructor. HelicalSurface(): CylindricalSurface(0,0),_dphi(0),_dphidz(0), _cvers("Revision:$") {}; /// Construct helical surface with specified radius, z half-length, width in phi and dphi/dz. HelicalSurface(const double radius, const double zhalf,const double dphi,const double dphidz): CylindricalSurface(radius,zhalf),_dphi(dphi),_dphidz(dphidz), _cvers("Revision:$") {}; /// helical width double get_dphi() const {return _dphi;}; /// double get_dphidz() const {return _dphidz;}; /// Convert local point to global one. SpacePoint local_to_global( const HelicalCoordinate& lpt) const; /// Convert global point to local one. HelicalCoordinate global_to_local(const SpacePoint &gpt) const; // assuming point is on surface, so we do not need r. HelicalCoordinate global_to_local(double phi,double z) const; /// Resize cylinder by specied change in radius and z half-length. bool resize(const double dr, const double dzhalf, const double dphi,const double ddphidz=0.0); /// Position child surface at specified local point. bool position_child_at(const HelicalCoordinate& lpt, GeometryElement& kid); /// check if global point is on surface bool onSurface(const SpacePoint &gpt) const; // comparisons friend bool operator ==(const HelicalSurface& lhs, const HelicalSurface& rhs); friend bool operator !=(const HelicalSurface& lhs, const HelicalSurface& rhs); friend bool operator <(const HelicalSurface& lhs, const HelicalSurface &rhs); /// Get source code version. Kept to allow following code changes const std::string& code_version() const { return _cvers; }; /// Stream insertion operator. friend std::ostream& operator<<(std::ostream &os, const HelicalSurface &me); private: /// halp width in phi double _dphi; /// direction - dphi/dz double _dphidz; /// Support for positioning child on surface. HelicalCoordinate xform_to_local(const GeometryXform &xf) const; /// Support for positioning child on surface. GeometryXform local_to_xform(const HelicalCoordinate &lpt) const; /// RCS version std::string _cvers; // Replaced at checkout protected: bool onSurface(const HelicalCoordinate& lpt) const; public: std::exception OutOfSurface; D0_OBJECT_SETUP(HelicalSurface); }; } #endif // HELICALSURFACE_HH