File indexing completed on 2025-01-18 09:14:35
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #include "DDRec/DetectorSurfaces.h"
0014
0015 namespace dd4hep {
0016 namespace rec {
0017
0018
0019
0020 DetectorSurfaces::DetectorSurfaces(dd4hep::DetElement const& e) : DetElement(e) , _sL( 0 ) {
0021
0022 initialize() ;
0023 }
0024
0025 DetectorSurfaces::~DetectorSurfaces(){
0026
0027
0028 }
0029
0030
0031 void DetectorSurfaces::initialize() {
0032
0033 DetElement det = *this ;
0034
0035 const VolSurfaceList* vsL = volSurfaceList(det) ;
0036
0037 try {
0038 _sL = det.extension< SurfaceList >(false) ;
0039 if (not _sL) {
0040 _sL = det.addExtension<SurfaceList >( new SurfaceList( true ) ) ;
0041 }
0042 } catch(const std::exception& e) {
0043 _sL = det.addExtension<SurfaceList >( new SurfaceList( true ) ) ;
0044 }
0045
0046 if( ! vsL->empty() && _sL->empty() ) {
0047
0048
0049
0050
0051
0052
0053
0054 for( VolSurfaceList::const_iterator it = vsL->begin() ; it != vsL->end() ; ++it ){
0055
0056 VolSurface volSurf = *it ;
0057
0058 Surface* surf = 0 ;
0059
0060 if( volSurf.type().isCylinder() )
0061 surf = new CylinderSurface( det, volSurf ) ;
0062
0063 else if( volSurf.type().isCone() )
0064 surf = new ConeSurface( det, volSurf ) ;
0065
0066 else
0067 surf = new Surface( det, volSurf ) ;
0068
0069
0070
0071
0072
0073 _sL->push_back( surf ) ;
0074
0075 }
0076
0077
0078 }
0079
0080 }
0081
0082
0083
0084 }
0085 }