Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-13 08:24:08

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 #include "DDRec/DetectorSurfaces.h"
0014 
0015 namespace dd4hep {
0016   namespace rec {
0017     
0018 
0019     DetectorSurfaces::DetectorSurfaces(dd4hep::DetElement const& e) {
0020 
0021       initialize(e) ;
0022     }
0023     
0024     void DetectorSurfaces::initialize(dd4hep::DetElement const& det) {
0025       
0026       const VolSurfaceList* vsL = volSurfaceList(det) ;
0027 
0028       _sL = det.extension< SurfaceList >(false) ;
0029       if (! _sL) {
0030         _sL = det.addExtension<SurfaceList >(  new SurfaceList( true )  ) ;
0031       }
0032 
0033       if( ! _sL->empty() ) {  // only fill surfaces for this DetElement once
0034         return ;
0035       }
0036     
0037       // std::cout <<  "     detector  " << det.name() << " id: " << det.id() << " has " <<  vsL->size() << " surfaces "  << std::endl ;
0038 
0039       // std::cout << " ------------------------- "
0040       //      << "  DetectorSurfaces::initialize()  adding surfaces : "
0041       //      << std::endl ;
0042 
0043       for( const auto& volSurf : *vsL ) {
0044 
0045         Surface* surf = nullptr ;
0046 
0047         if( volSurf.type().isCylinder() )
0048           surf = new CylinderSurface(  det,  volSurf ) ;
0049 
0050         else if( volSurf.type().isCone() )
0051           surf = new ConeSurface( det, volSurf ) ;
0052 
0053         else
0054           surf = new Surface(  det,  volSurf ) ;
0055 
0056         // std::cout << " ------------------------- "
0057         //          << " surface: "   << *surf        << std::endl
0058         //          << " ------------------------- "  << std::endl ;
0059 
0060         _sL->push_back( surf ) ;
0061 
0062       }
0063 
0064     }
0065 
0066 
0067   } // namespace
0068 }// namespace