From 253878d2e3683c002e87574352ab1fa3c3edf226 Mon Sep 17 00:00:00 2001 From: Frank Gaede <frank.gaede@desy.de> Date: Tue, 14 Jul 2015 14:11:17 +0000 Subject: [PATCH] changed type in SurfaceList and SurfaceMap from Surface to ISurface --- DDRec/include/DDRec/Surface.h | 4 ++-- DDRec/include/DDRec/SurfaceManager.h | 5 +++-- DDRec/src/SurfaceManager.cpp | 3 ++- UtilityApps/src/test_surfaces.cpp | 3 ++- UtilityApps/src/teve_display.cpp | 5 ++++- 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/DDRec/include/DDRec/Surface.h b/DDRec/include/DDRec/Surface.h index 242b36329..dde289f82 100644 --- a/DDRec/include/DDRec/Surface.h +++ b/DDRec/include/DDRec/Surface.h @@ -520,7 +520,7 @@ namespace DD4hep { * @date Apr, 10 2014 * @version $Id$ */ - class SurfaceList : public std::list< Surface* > { + class SurfaceList : public std::list< ISurface* > { protected: bool _isOwner ; @@ -530,7 +530,7 @@ namespace DD4hep { SurfaceList(bool isOwner=false ) : _isOwner( isOwner ) {} /// copy c'tor - SurfaceList(const SurfaceList& other ) : std::list< Surface* >( other ), _isOwner( false ){} + SurfaceList(const SurfaceList& other ) : std::list< ISurface* >( other ), _isOwner( false ){} /// required c'tor for extension mechanism SurfaceList(const Geometry::DetElement& ){ diff --git a/DDRec/include/DDRec/SurfaceManager.h b/DDRec/include/DDRec/SurfaceManager.h index 19466aac2..9f138d2b8 100644 --- a/DDRec/include/DDRec/SurfaceManager.h +++ b/DDRec/include/DDRec/SurfaceManager.h @@ -1,14 +1,15 @@ #ifndef DDRec_SurfaceManager_H_ #define DDRec_SurfaceManager_H_ -#include "DDRec/Surface.h" +#include "DDSurfaces/ISurface.h" #include <string> +#include <map> namespace DD4hep { namespace DDRec { /// typedef for surface maps, keyed by the cellID - typedef std::map< unsigned long, DD4hep::DDRec::Surface*> SurfaceMap ; + typedef std::map< unsigned long, DDSurfaces::ISurface*> SurfaceMap ; /** Surface manager class that holds maps of surfaces for all known * sensitive detector types and individual sub detectors. diff --git a/DDRec/src/SurfaceManager.cpp b/DDRec/src/SurfaceManager.cpp index 82ff1a529..9129e3380 100644 --- a/DDRec/src/SurfaceManager.cpp +++ b/DDRec/src/SurfaceManager.cpp @@ -8,6 +8,7 @@ namespace DD4hep { using namespace Geometry ; + using namespace DDSurfaces ; namespace DDRec { @@ -56,7 +57,7 @@ namespace DD4hep { _map.insert( std::make_pair( name , SurfaceMap() ) ) ; for( SurfaceList::const_iterator it = detSL.begin() ; it != detSL.end() ; ++it ){ - Surface* surf = *it ; + ISurface* surf = *it ; // enter surface into map for this detector _map[ name ].insert( std::make_pair( surf->id(), surf ) ) ; diff --git a/UtilityApps/src/test_surfaces.cpp b/UtilityApps/src/test_surfaces.cpp index 1c619bcf2..26e6d464e 100644 --- a/UtilityApps/src/test_surfaces.cpp +++ b/UtilityApps/src/test_surfaces.cpp @@ -132,7 +132,8 @@ int main(int argc, char** argv ){ Surface* surf = surfMap[ id ] ; #else SurfaceMap::const_iterator si = surfMap.find( id ) ; - Surface* surf = ( si != surfMap.end() ? si->second : 0 ) ; + // Surface* surf = dynamic_cast<Surface*> ( ( si != surfMap.end() ? si->second : 0 ) ) ; + ISurface* surf = ( si != surfMap.end() ? si->second : 0 ) ; #endif std::stringstream sst ; diff --git a/UtilityApps/src/teve_display.cpp b/UtilityApps/src/teve_display.cpp index 5a1982b8b..c8c612183 100644 --- a/UtilityApps/src/teve_display.cpp +++ b/UtilityApps/src/teve_display.cpp @@ -211,7 +211,10 @@ TEveStraightLineSet* getSurfaces(int col, const SurfaceType& type) { for( SurfaceList::const_iterator it = sL.begin() ; it != sL.end() ; ++it ){ - Surface* surf = *it ; + Surface* surf = dynamic_cast< Surface*> ( *it ) ; + + if( ! surf ) + continue ; if( ! ( surf->type().isVisible() && ( surf->type().isSimilar( type ) ) ) ) continue ; -- GitLab