DD4hep  1.33.0
Detector Description Toolkit for High Energy Physics
DetectorSurfaces.cpp
Go to the documentation of this file.
1 //==========================================================================
2 // AIDA Detector description implementation
3 //--------------------------------------------------------------------------
4 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
5 // All rights reserved.
6 //
7 // For the licensing terms see $DD4hepINSTALL/LICENSE.
8 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
9 //
10 // Author : F.Gaede
11 //
12 //==========================================================================
13 #include "DDRec/DetectorSurfaces.h"
14 
15 namespace dd4hep {
16  namespace rec {
17 
18 
20 
21  initialize(e) ;
22  }
23 
25 
26  const VolSurfaceList* vsL = volSurfaceList(det) ;
27 
28  _sL = det.extension< SurfaceList >(false) ;
29  if (! _sL) {
30  _sL = det.addExtension<SurfaceList >( new SurfaceList( true ) ) ;
31  }
32 
33  if( ! _sL->empty() ) { // only fill surfaces for this DetElement once
34  return ;
35  }
36 
37  // std::cout << " detector " << det.name() << " id: " << det.id() << " has " << vsL->size() << " surfaces " << std::endl ;
38 
39  // std::cout << " ------------------------- "
40  // << " DetectorSurfaces::initialize() adding surfaces : "
41  // << std::endl ;
42 
43  for( const auto& volSurf : *vsL ) {
44 
45  Surface* surf = nullptr ;
46 
47  if( volSurf.type().isCylinder() )
48  surf = new CylinderSurface( det, volSurf ) ;
49 
50  else if( volSurf.type().isCone() )
51  surf = new ConeSurface( det, volSurf ) ;
52 
53  else
54  surf = new Surface( det, volSurf ) ;
55 
56  // std::cout << " ------------------------- "
57  // << " surface: " << *surf << std::endl
58  // << " ------------------------- " << std::endl ;
59 
60  _sL->push_back( surf ) ;
61 
62  }
63 
64  }
65 
66 
67  } // namespace
68 }// namespace
dd4hep::rec::CylinderSurface
Definition: Surface.h:612
dd4hep::DetElement
Handle class describing a detector element.
Definition: DetElement.h:187
dd4hep::rec::SurfaceList
Definition: Surface.h:679
dd4hep::rec::VolSurfaceList
Definition: Surface.h:300
DetectorSurfaces.h
dd4hep::rec::ConeSurface
Definition: Surface.h:653
dd4hep::rec::DetectorSurfaces::DetectorSurfaces
DetectorSurfaces(const DetElement &e)
Definition: DetectorSurfaces.cpp:19
dd4hep::rec::DetectorSurfaces::_sL
SurfaceList * _sL
Definition: DetectorSurfaces.h:37
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
det
DetElement::Object * det
Definition: AlignmentsCalculator.cpp:66
dd4hep::rec::volSurfaceList
VolSurfaceList * volSurfaceList(const DetElement &det)
Definition: Surface.cpp:518
dd4hep::rec::DetectorSurfaces::initialize
void initialize(const DetElement &det)
initializes surfaces from VolSurfaces assigned to this DetElement in detector construction
Definition: DetectorSurfaces.cpp:24
dd4hep::rec::Surface
Definition: Surface.h:496