From fe8c7045b785657960216473b575637221b75b46 Mon Sep 17 00:00:00 2001
From: Frank Gaede <frank.gaede@desy.de>
Date: Fri, 18 Sep 2015 10:03:14 +0000
Subject: [PATCH]  - allow to set surface ID in VolSurfaceBase    subclasses

---
 DDRec/src/Surface.cpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/DDRec/src/Surface.cpp b/DDRec/src/Surface.cpp
index 1fbc5b4c6..65d146bf7 100644
--- a/DDRec/src/Surface.cpp
+++ b/DDRec/src/Surface.cpp
@@ -26,7 +26,7 @@ namespace DD4hep {
     void VolSurfaceBase::setV(const Vector3D& v_val) {  _v = v_val ; }
     void VolSurfaceBase::setNormal(const Vector3D& n) { _n = n ; }
     
-    long64 VolSurfaceBase::id() const  { return 0 ; } 
+    long64 VolSurfaceBase::id() const  { return _id ; } 
 
     const SurfaceType& VolSurfaceBase::type() const { return _type ; }
     Vector3D VolSurfaceBase::u( const Vector3D& point ) const {  point.x() ; return _u ; }
@@ -214,9 +214,8 @@ namespace DD4hep {
     }
 
 
-    std::vector< std::pair<Vector3D, Vector3D> > VolSurfaceBase::getLines(unsigned nMax) {
+    std::vector< std::pair<Vector3D, Vector3D> > VolSurfaceBase::getLines(unsigned ) {
       // dummy implementation returning empty set
-      nMax ;
       std::vector< std::pair<Vector3D, Vector3D> >  lines ;
       return lines ;
     }
@@ -637,7 +636,8 @@ namespace DD4hep {
       //======== set the unique surface ID from the DetElement ( and placements below ? )
 
       // just use the DetElement ID for now ...
-      _id = _det.volumeID() ;
+      // or the id set by the user to the VolSurface ...
+      _id = ( _volSurf.id()==0 ?  _det.volumeID() : _volSurf.id() ) ;
 
       // typedef PlacedVolume::VolIDs IDV ;
       // DetElement d = _det ;
-- 
GitLab