Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 10:12:44

0001 //==========================================================================
0002 //  AIDA Detector description implementation 
0003 //--------------------------------------------------------------------------
0004 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
0005 // All rights reserved.
0006 //
0007 // For the licensing terms see $DD4hepINSTALL/LICENSE.
0008 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
0009 //
0010 // Author     : F.Gaede
0011 //
0012 //==========================================================================
0013 #ifndef DDREC_SURFACE_H
0014 #define DDREC_SURFACE_H
0015 
0016 #include "DD4hep/Objects.h"
0017 #include "DD4hep/Volumes.h"
0018 #include "DD4hep/DetElement.h"
0019 
0020 #include "DDRec/ISurface.h"
0021 #include "DDRec/Material.h"
0022 
0023 #include <list>
0024 #include <memory>
0025 
0026 class TGeoMatrix ;
0027 
0028 namespace dd4hep {
0029   namespace rec {
0030   
0031     //-------------------------------------------------------------------------------------------
0032 
0033     class VolSurface  ;
0034 
0035     /** Implementation of ISurface for a local surface attached to a volume. 
0036      *  Provides default implementations for all methods but distance().
0037      *  Subclasses for specific surfaces overwrite methods as needed.
0038      * 
0039      *  @author F.Gaede, DESY
0040      *  @date Sep 11, 2015
0041      *  @version $Id$
0042      */
0043     class VolSurfaceBase : public ISurface {
0044       
0045       friend class VolSurface ;
0046 
0047     protected:
0048       SurfaceType _type {};
0049       Vector3D _u {};
0050       Vector3D _v {};
0051       Vector3D _n {};
0052       Vector3D _o {};
0053       double _th_i {0};
0054       double _th_o {0};
0055       MaterialData _innerMat {};
0056       MaterialData _outerMat {};    
0057       Volume _vol {};
0058       long64 _id {0};
0059       unsigned _refCount {0};
0060 
0061       /// setter for daughter classes
0062       virtual void setU(const Vector3D& u) ;
0063       /// setter for daughter classes
0064       virtual void setV(const Vector3D& v) ;
0065       /// setter for daughter classes
0066       virtual void setNormal(const Vector3D& n) ;
0067       /// setter for daughter classes
0068       virtual void setOrigin(const Vector3D& o) ;
0069 
0070     public:
0071     
0072       virtual ~VolSurfaceBase() = default;
0073 
0074       ///default c'tor
0075 
0076       VolSurfaceBase() = default;
0077       
0078       VolSurfaceBase( SurfaceType typ, 
0079                       double thickness_inner ,double thickness_outer, 
0080                       Vector3D u_val ,Vector3D v_val ,
0081                       Vector3D n ,Vector3D o, Volume vol,int identifier ) : 
0082         _type(typ ) ,
0083         _u( u_val ) ,
0084         _v( v_val ) ,
0085         _n( n ) ,
0086         _o( o ),
0087         _th_i( thickness_inner ),
0088         _th_o( thickness_outer ),  
0089         _vol(vol) ,
0090         _id( identifier ) {
0091       }
0092       
0093       
0094       /// Copy the from object
0095       VolSurfaceBase(const VolSurfaceBase& c) 
0096         : _type(c._type), _u(c._u), _v(c._v), _n(c._n), _o(c._o),
0097           _th_i(c._th_i), _th_o(c._th_o), _innerMat(c._innerMat),
0098           _outerMat(c._innerMat), _vol(c._vol), _id(c._id)
0099       {
0100       }
0101 
0102       /// the volume to which this surface is attached.
0103       Volume volume() const { return _vol ; }
0104 
0105       /// The id of this surface 
0106       virtual long64 id() const  ;
0107 
0108       /** properties of the surface encoded in Type.
0109        * @see SurfaceType
0110        */
0111       virtual const SurfaceType& type() const ;
0112     
0113       //==== geometry ====
0114       
0115       /** First direction of measurement U */
0116       virtual Vector3D u( const Vector3D& point = Vector3D() ) const ;
0117     
0118       /** Second direction of measurement V */
0119       virtual Vector3D v(const Vector3D& point = Vector3D() ) const ;
0120     
0121       /// Access to the normal direction at the given point
0122       virtual Vector3D normal(const Vector3D& point = Vector3D() ) const ;
0123     
0124       /** Get Origin of local coordinate system on surface */
0125       virtual const Vector3D& origin() const ;
0126       
0127       /** Convert the global position to the local position (u,v) on the surface */
0128       virtual Vector2D globalToLocal( const Vector3D& point) const ;
0129       
0130       /** Convert the local position (u,v) on the surface to the global position */
0131       virtual Vector3D localToGlobal( const Vector2D& point) const ;
0132       
0133       /// Access to the material in opposite direction of the normal
0134       virtual const IMaterial& innerMaterial() const ;
0135 
0136       /// Access to the material in direction of the normal
0137       virtual const IMaterial& outerMaterial() const ;
0138     
0139       /** Thickness of inner material */
0140       virtual double innerThickness() const ;
0141 
0142       /** Thickness of outer material */
0143       virtual double outerThickness() const ;
0144 
0145 
0146       /** The length of the surface along direction u at the origin. For 'regular' boundaries, like rectangles, 
0147        *  this can be used to speed up the computation of inSideBounds.
0148        */
0149       virtual double length_along_u() const ;
0150 
0151       /** The length of the surface along direction v at the origin. For 'regular' boundaries, like rectangles, 
0152        *  this can be used to speed up the computation of inSideBounds.
0153        */
0154       virtual double length_along_v() const ;
0155 
0156 
0157       /** Distance to surface */
0158       virtual double distance(const Vector3D& point ) const ;
0159       
0160       /// Checks if the given point lies within the surface
0161       virtual bool insideBounds(const Vector3D& point, double epsilon=1e-4 ) const ;
0162 
0163 
0164       virtual std::vector< std::pair<Vector3D, Vector3D> > getLines(unsigned nMax=100) ;
0165  
0166       /// set the inner Material
0167       void setInnerMaterial( const IMaterial& mat ){ _innerMat = mat ; }
0168 
0169       /// set the outer Materal
0170       void setOuterMaterial( const IMaterial& mat ){ _outerMat = mat ; }
0171 
0172     };
0173 
0174     //---------------------------------------------------------------------------------------------
0175     /** Reference counted handle class for a local surface attached to a volume (VolSurfaceBase). 
0176      *
0177      * @author F.Gaede, DESY
0178      * @date Sep, 14 2015
0179      * @version $Id$
0180      */
0181     class VolSurface : public ISurface {
0182     
0183     protected:
0184 
0185       VolSurfaceBase* _surf ;
0186 
0187     public:
0188     
0189       virtual ~VolSurface(){
0190         if( _surf ) {
0191           -- _surf->_refCount ;
0192           if(  _surf->_refCount == 0 ) delete _surf ;
0193         }
0194       } 
0195       ///default c'tor
0196       VolSurface() : _surf(0) { }
0197 
0198       /// Constructor to be used with an existing object
0199       VolSurface(VolSurfaceBase* p) : _surf( p ) { ++ _surf->_refCount ; }
0200 
0201       /// Constructor to be used with an existing object
0202       VolSurface(const VolSurface& vsurf) : _surf( vsurf._surf ) {
0203         ++ _surf->_refCount ;
0204       }
0205       
0206       VolSurface& operator=(const VolSurface& vsurf) {
0207         _surf = vsurf._surf ;
0208         ++ _surf->_refCount ;
0209         return *this ;
0210       }
0211       
0212 
0213       /// the volume to which this surface is attached.
0214       Volume volume() const { return _surf->volume() ; }
0215 
0216       /// pointer to underlying object 
0217       VolSurfaceBase* ptr() const { return _surf ; }    
0218       
0219       /// The id of this surface - always 0 for VolSurfaces
0220       virtual long64 id() const  ;
0221 
0222       /** properties of the surface encoded in Type.
0223        * @see SurfaceType
0224        */
0225       virtual const SurfaceType& type() const ;
0226     
0227       //==== geometry ====
0228       
0229       /** First direction of measurement U */
0230       virtual Vector3D u( const Vector3D& point = Vector3D() ) const ;
0231     
0232       /** Second direction of measurement V */
0233       virtual Vector3D v(const Vector3D& point = Vector3D() ) const ;
0234     
0235       /// Access to the normal direction at the given point
0236       virtual Vector3D normal(const Vector3D& point = Vector3D() ) const ;
0237     
0238       /** Get Origin of local coordinate system on surface */
0239       virtual const Vector3D& origin() const ;
0240       
0241       /** Convert the global position to the local position (u,v) on the surface */
0242       virtual Vector2D globalToLocal( const Vector3D& point) const ;
0243       
0244       /** Convert the local position (u,v) on the surface to the global position */
0245       virtual Vector3D localToGlobal( const Vector2D& point) const ;
0246       
0247       /// Access to the material in opposite direction of the normal
0248       virtual const IMaterial& innerMaterial() const ;
0249 
0250       /// Access to the material in direction of the normal
0251       virtual const IMaterial& outerMaterial() const ;
0252     
0253       /** Thickness of inner material */
0254       virtual double innerThickness() const ;
0255 
0256       /** Thickness of outer material */
0257       virtual double outerThickness() const ;
0258 
0259 
0260       /** The length of the surface along direction u at the origin. For 'regular' boundaries, like rectangles, 
0261        *  this can be used to speed up the computation of inSideBounds.
0262        */
0263       virtual double length_along_u() const ;
0264 
0265       /** The length of the surface along direction v at the origin. For 'regular' boundaries, like rectangles, 
0266        *  this can be used to speed up the computation of inSideBounds.
0267        */
0268       virtual double length_along_v() const ;
0269 
0270       /** Distance to surface */
0271       virtual double distance(const Vector3D& point ) const ;
0272       
0273       /// Checks if the given point lies within the surface
0274       virtual bool insideBounds(const Vector3D& point, double epsilon=1e-4 ) const ;
0275 
0276       virtual std::vector< std::pair<Vector3D, Vector3D> > getLines(unsigned nMax=100) ;
0277  
0278       /// set the innerMaterial
0279       void setInnerMaterial( const IMaterial& mat ){ _surf->setInnerMaterial( mat ) ; }
0280 
0281       /// set the outer Materal
0282       void setOuterMaterial( const IMaterial& mat ){  _surf->setOuterMaterial( mat ) ; }
0283 
0284     };
0285 
0286     //======================================================================================================
0287 
0288 
0289     struct VolSurfaceList ;
0290     /** Helper function for accessing the list assigned to a DetElement - attaches
0291      * empty list if needed.
0292      */
0293     VolSurfaceList* volSurfaceList( DetElement& det) ;
0294 
0295     /** std::list of VolSurfaces that takes ownership.
0296      * @author F.Gaede, DESY
0297      * @date Apr, 6 2014
0298      * @version $Id$
0299      */
0300     struct VolSurfaceList : std::list< VolSurface > {
0301     
0302       VolSurfaceList() {}
0303 
0304       // required c'tor for extension mechanism
0305       VolSurfaceList(DetElement& det){
0306 
0307         VolSurfaceList* sL = volSurfaceList( det ) ; 
0308 
0309         std::copy( this->end() , sL->begin() , sL->end() ) ;
0310       }
0311 
0312 
0313       // required c'tor for extension mechanism
0314       VolSurfaceList(const VolSurfaceList& vsl, DetElement& /*det*/ ){
0315     
0316         this->insert( this->end() , vsl.begin() , vsl.end() ) ;
0317       }
0318     
0319       virtual ~VolSurfaceList() ;
0320 
0321     } ;
0322   
0323 
0324     //======================================================================================================
0325 
0326     /** Implementation of a planar surface attached to a volume 
0327      * @author F.Gaede, DESY
0328      * @date Sep, 14 2014
0329      * @version $Id$
0330      */
0331     class VolPlaneImpl : public VolSurfaceBase {
0332       
0333     public:
0334       
0335       ///default c'tor
0336       VolPlaneImpl() : VolSurfaceBase() { }
0337 
0338       /// standard c'tor with all necessary arguments - origin is (0,0,0) if not given.
0339       VolPlaneImpl( SurfaceType typ, double thickness_inner ,double thickness_outer, 
0340                     Vector3D u_val ,Vector3D v_val ,Vector3D n_val , Vector3D o_val, Volume vol, int id_val  ) :
0341     
0342         VolSurfaceBase( typ, thickness_inner, thickness_outer, u_val,v_val, n_val, o_val, vol, id_val ) {
0343     
0344         _type.setProperty( SurfaceType::Plane    , true ) ;
0345         _type.setProperty( SurfaceType::Cylinder , false ) ;
0346         _type.setProperty( SurfaceType::Cone     , false ) ;
0347         _type.checkParallelToZ( *this ) ;
0348         _type.checkOrthogonalToZ( *this ) ;
0349       }      
0350       
0351       /** Distance to surface */
0352       virtual double distance(const Vector3D& point ) const  ;
0353     } ;
0354 
0355     //======================================================================================================
0356     /** Implementation of cylindrical surface attached to a volume 
0357      * @author F.Gaede, DESY
0358      * @date Apr, 6 2014
0359      * @version $Id$
0360      */
0361     class VolCylinderImpl : public VolSurfaceBase {
0362       
0363     public:
0364       
0365       /// default c'tor
0366       VolCylinderImpl() : VolSurfaceBase() { }
0367 
0368       
0369       /** The standard constructor. The origin vector points to the origin of the coordinate system on the cylinder,
0370        *  its rho defining the radius of the cylinder. The measurement direction v is set to be (0,0,1), the normal is
0371        *  chosen to be parallel to the origin vector and u = n X v. 
0372        */
0373       VolCylinderImpl( Volume vol, SurfaceType type, double thickness_inner ,double thickness_outer,  Vector3D origin ) ;
0374 
0375       /** First direction of measurement U - rotated to point projected onto the cylinder.
0376        *  No check is done whether the point actually is on the cylinder surface
0377        */
0378       virtual Vector3D u( const Vector3D& point = Vector3D() ) const ;
0379       
0380       /** The normal direction at the given point, projected  onto the cylinder.
0381        *  No check is done whether the point actually is on the cylinder surface
0382        */
0383       virtual Vector3D normal(const Vector3D& point = Vector3D() ) const ;
0384 
0385       /** Distance to surface */
0386       virtual double distance(const Vector3D& point ) const  ;
0387       
0388       /** Convert the global position to the local position (u,v) on the surface - v runs along the axis of the cylinder, u is r*phi */
0389       virtual Vector2D globalToLocal( const Vector3D& point) const ;
0390       
0391       /** Convert the local position (u,v) on the surface to the global position  - v runs along the axis of the cylinder, u is r*phi*/
0392       virtual Vector3D localToGlobal( const Vector2D& point) const ;
0393     } ;
0394 
0395     //======================================================================================================
0396     /** Implementation of conical surface attached to a volume 
0397      * @author F.Gaede, DESY
0398      * @date Nov, 6 2015
0399      * @version $Id$
0400      */
0401     class VolConeImpl : public VolSurfaceBase {
0402       
0403       //internal helper variables
0404       double _ztip        { 0.0 }; // z position of the tip in the volume coordinate system
0405       double _zt0         { 0.0 }; // z distance of the front face from the tip
0406       double _zt1         { 0.0 }; // z distance of the back face from the tip
0407       double _tanTheta    { 0.0 }; // tan of half the openeing angle 
0408 
0409     public:
0410       
0411       /// default c'tor
0412       VolConeImpl() : VolSurfaceBase() { }
0413       
0414       
0415       /** The standard constructor. The origin vector points to the origin of the coordinate system on the cone,
0416        *  its rho defining the mean radius of the cone (z-component of the origin is ignored !).
0417        *  The measurement direction v defines the opening angle of the cone,
0418        *  the normal is chosen to be orthogonal to v. NB: the cone is always parallel to the local z axis.
0419        */
0420       VolConeImpl( Volume vol, SurfaceType type, double thickness_inner ,double thickness_outer,
0421                    Vector3D v, Vector3D origin ) ;
0422       
0423       /** First direction of measurement U - rotated to point projected onto the cone.
0424        *  No check is done whether the point actually is on the cone surface
0425        */
0426       virtual Vector3D u( const Vector3D& point = Vector3D() ) const ;
0427 
0428       /** Second direction of measurement V - rotated to point projected onto the cone.
0429        *  No check is done whether the point actually is on the cone surface
0430        */
0431       virtual Vector3D v( const Vector3D& point = Vector3D() ) const ;
0432       
0433       /** The normal direction at the given point, projected  onto the cone.
0434        *  No check is done whether the point actually is on the cone surface
0435        */
0436       virtual Vector3D normal(const Vector3D& point = Vector3D() ) const ;
0437 
0438       /** Distance to surface */
0439       virtual double distance(const Vector3D& point ) const  ;
0440       
0441       /** Convert the global position to the local position (u,v) on the surface - v runs along the axis of the cone, u is r*phi */
0442       virtual Vector2D globalToLocal( const Vector3D& point) const ;
0443       
0444       /** Convert the local position (u,v) on the surface to the global position  - v runs along the axis of the cone, u is r*phi*/
0445       virtual Vector3D localToGlobal( const Vector2D& point) const ;
0446 
0447       virtual std::vector< std::pair<Vector3D, Vector3D> > getLines(unsigned nMax=100) ;
0448     } ;
0449 
0450 
0451 
0452     //======================================================================================================
0453     
0454     /** Template for VolSurface specializations.
0455      *  Works for surfaces that take all surface vectors (u,v,n,o) in the c'tor.
0456      * @author F.Gaede, DESY
0457      * @date Sep, 14 2015
0458      * @version $Id$
0459      */
0460     template <class T>
0461     class VolSurfaceHandle : public VolSurface {
0462       
0463     public:
0464       VolSurfaceHandle( Volume vol, SurfaceType typ, double thickness_inner ,double thickness_outer, 
0465                         Vector3D u_val ,Vector3D v_val ,Vector3D n_val , Vector3D o_val = Vector3D(0.,0.,0.) ) :
0466     
0467         VolSurface(  new T( typ, thickness_inner, thickness_outer, u_val, v_val, n_val, o_val, vol , 0 )  ){
0468       }
0469       
0470       T* operator->() { return static_cast<T*>( _surf ) ; }
0471     } ;
0472 
0473     //---------------------------------------------------------------------------------------------
0474     typedef VolSurfaceHandle< VolPlaneImpl > VolPlane ;
0475     //---------------------------------------------------------------------------------------------
0476 
0477     class VolCylinder : public VolSurface{
0478     public:
0479       VolCylinder( Volume vol, SurfaceType typ_val, double thickness_inner ,double thickness_outer,  Vector3D origin_val ) :
0480         VolSurface( new VolCylinderImpl( vol,  typ_val,  thickness_inner , thickness_outer, origin_val ) ) {}
0481     } ;
0482 
0483     class VolCone : public VolSurface{
0484     public:
0485       VolCone( Volume vol, SurfaceType typ_val, double thickness_inner ,double thickness_outer, Vector3D v_val, Vector3D origin_val ) :
0486         VolSurface( new VolConeImpl( vol,  typ_val,  thickness_inner , thickness_outer, v_val,  origin_val ) ) {}
0487     } ;
0488 
0489     //======================================================================================================
0490     
0491     /** Implementation of Surface class holding a local surface attached to a volume and the DetElement 
0492      *  holding this surface.
0493      * 
0494      * @author F.Gaede, DESY
0495      * @date Apr, 7 2014
0496      * @version $Id$
0497      */
0498     class Surface:  public ISurface {
0499       
0500     protected:
0501       
0502       DetElement _det ;
0503       mutable VolSurface _volSurf ;
0504       std::unique_ptr<TGeoMatrix> _wtM ; // matrix for world transformation of surface
0505       
0506       long64 _id {0};
0507       
0508       SurfaceType _type {};
0509       Vector3D _u {};
0510       Vector3D _v {};
0511       Vector3D _n {};
0512       Vector3D _o {};
0513 
0514       /// default c'tor etc. removed
0515       Surface() = delete;
0516       Surface( Surface const& ) = delete;
0517       Surface& operator=( Surface const& ) = delete;
0518 
0519     public:
0520     
0521       virtual ~Surface() {} 
0522 
0523       /** Standard c'tor initializes the surface from the parameters of the VolSurface and the 
0524        *  transform (placement) of the corresponding volume, if found in DetElement 
0525        */
0526       Surface( DetElement det, VolSurface volSurf ) ;      
0527     
0528       /// The id of this surface - corresponds to DetElement id.
0529       virtual long64 id() const ;
0530 
0531       /** properties of the surface encoded in Type.
0532        * @see SurfaceType
0533        */
0534       virtual const SurfaceType& type() const ;
0535     
0536       /// The volume that has the surface attached.
0537       Volume volume() const { return _volSurf.volume()  ; }
0538 
0539       /// The VolSurface attched to the volume.
0540       VolSurface volSurface() const { return _volSurf ; }
0541 
0542       /// The DetElement belonging to the surface volume
0543       DetElement detElement() const { return _det; }
0544 
0545 
0546       //==== geometry ====
0547       
0548       /** First direction of measurement U */
0549       virtual Vector3D u( const Vector3D& point = Vector3D() ) const ;
0550     
0551       /** Second direction of measurement V */
0552       virtual Vector3D v(const Vector3D& point = Vector3D() ) const ;
0553     
0554       /// Access to the normal direction at the given point
0555       virtual  Vector3D normal(const Vector3D& point = Vector3D() ) const ;
0556     
0557       /** Get Origin of local coordinate system on surface */
0558       virtual const Vector3D& origin() const ;
0559 
0560       /** Convert the global position to the local position (u,v) on the surface */
0561       virtual Vector2D globalToLocal( const Vector3D& point) const ;
0562       
0563       /** Convert the local position (u,v) on the surface to the global position*/
0564       virtual Vector3D localToGlobal( const Vector2D& point) const ;
0565 
0566       /** Thickness of inner material */
0567       virtual double innerThickness() const ;
0568 
0569       /** Thickness of outer material */
0570       virtual double outerThickness() const ;
0571 
0572       /// Access to the material in opposite direction of the normal
0573       virtual const IMaterial& innerMaterial() const ;
0574      
0575       /// Access to the material in direction of the normal
0576       virtual const IMaterial& outerMaterial() const ;
0577           
0578       /** Distance to surface */
0579       virtual double distance(const Vector3D& point ) const  ;
0580       
0581       /// Checks if the given point lies within the surface
0582       virtual bool insideBounds(const Vector3D& point, double epsilon=1.e-4) const ;
0583 
0584       /** Get Origin of local coordinate system of the associated volume */
0585       virtual Vector3D volumeOrigin() const  ; 
0586 
0587       /** The length of the surface along direction u at the origin. For 'regular' boundaries, like rectangles, 
0588        *  this can be used to speed up the computation of inSideBounds.
0589        */
0590       virtual double length_along_u() const ;
0591 
0592       /** The length of the surface along direction v at the origin. For 'regular' boundaries, like rectangles, 
0593        *  this can be used to speed up the computation of inSideBounds.
0594        */
0595       virtual double length_along_v() const ;
0596 
0597       /** Get lines constraining the surface for drawing ( might not be exact boundaries) -
0598        *  at most nMax lines are returned.
0599        */
0600       virtual std::vector< std::pair< Vector3D, Vector3D> > getLines(unsigned nMax=100) ;
0601 
0602     protected:
0603       void initialize() ;
0604 
0605     };
0606 
0607     //======================================================================================================
0608 
0609     /** Specialization of Surface for cylinders. Provides acces to the cylinder radius and
0610      *  implements the access to the rotated surface vectors for points on the cylinder.
0611      *  @author F.Gaede, DESY
0612      *  @date May, 10 2014
0613      */
0614     class CylinderSurface:  public Surface, public ICylinder {
0615 
0616     public:
0617 
0618       ///Standard c'tor.
0619       CylinderSurface( DetElement det, VolSurface volSurf ) : Surface( det, volSurf ) { }      
0620       
0621       /** First direction of measurement U - rotated to point projected onto the cylinder.
0622        *  No check is done whether the point actually is on the cylinder surface
0623        */
0624       virtual Vector3D u( const Vector3D& point = Vector3D() ) const ;
0625     
0626       /** Second direction of measurement V - rotated to point projected onto the cylinder.
0627        *  No check is done whether the point actually is on the cylinder surface
0628        */
0629       virtual Vector3D v(const Vector3D& point = Vector3D() ) const ;
0630     
0631       /** The normal direction at the given point - rotated to point projected onto the cylinder.
0632        *  No check is done whether the point actually is on the cylinder surface
0633        */
0634       virtual Vector3D normal(const Vector3D& point = Vector3D() ) const ;
0635  
0636       /** Convert the global position to the local position (u,v) on the surface - u runs along the axis of the cylinder, v is r*phi */
0637       virtual Vector2D globalToLocal( const Vector3D& point) const ;
0638       
0639       /** Convert the local position (u,v) on the surface to the global position  - u runs along the axis of the cylinder, v is r*phi*/
0640       virtual Vector3D localToGlobal( const Vector2D& point) const ;
0641 
0642       /// the radius of the cylinder (rho of the origin vector)
0643       virtual double radius() const ;
0644 
0645       /// the center of the cylinder 
0646       virtual Vector3D center() const ;
0647 
0648     } ;
0649     //======================================================================================================
0650 
0651     /** Specialization of Surface for cones - specializes CyliderSurface (for lazyness ...)
0652      *  @author F.Gaede, DESY
0653      *  @date May, 10 2014
0654      */
0655     class ConeSurface : public CylinderSurface, public ICone {
0656     public:      
0657       ConeSurface( DetElement det, VolSurface volSurf ) : CylinderSurface( det, volSurf ) { }      
0658       
0659       /// the start radius of the cone
0660       virtual double radius0() const ;
0661       
0662       /// the end radius of the cone
0663       virtual double radius1() const ;
0664 
0665       /// the start z of the cone
0666       virtual double z0() const ;
0667       
0668       /// the end z of the cone
0669       virtual double z1() const ;
0670       
0671       /// the center of the cone 
0672       virtual Vector3D center() const ;
0673      
0674     };
0675     //======================================================================================================
0676     /** std::list of Surfaces that optionally takes ownership.
0677      * @author F.Gaede, DESY
0678      * @date Apr, 10 2014
0679      * @version $Id$
0680      */
0681     class SurfaceList : public std::list< ISurface* > {
0682     
0683     protected:
0684       bool _isOwner {false};
0685 
0686     public:
0687       /// defaul c'tor - allow to set ownership for surfaces
0688       SurfaceList() = default;
0689       /// defaul c'tor - allow to set ownership for surfaces
0690       SurfaceList(bool isOwner ) : _isOwner( isOwner )  {}
0691       /// copy c'tor
0692       SurfaceList(const SurfaceList& other ) = default;
0693       /// required c'tor for extension mechanism
0694       SurfaceList(const DetElement& ) {}
0695       /// required c'tor for extension mechanism
0696       SurfaceList(const SurfaceList& ,const DetElement& ) {}    
0697       /// d'tor deletes all owned surfaces
0698       virtual ~SurfaceList();
0699     };
0700   
0701     //    SurfaceList* surfaceList( DetElement& det ) ;
0702 
0703     //======================================================================================================
0704 
0705   
0706   } /* namespace */
0707 } /* namespace */
0708 
0709 
0710 
0711 #endif // DDREC_SURFACE_H