DD4hep  1.30.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 
19 
21 
22  initialize() ;
23  }
24 
26  // nothing to do: SurfaceList is added as extension
27  // and is deleted automatically
28  }
29 
30 
32 
33  DetElement det = *this ;
34 
35  const VolSurfaceList* vsL = volSurfaceList(det) ;
36 
37  try {
38  _sL = det.extension< SurfaceList >(false) ;
39  if (not _sL) {
40  _sL = det.addExtension<SurfaceList >( new SurfaceList( true ) ) ;
41  }
42  } catch(const std::exception& e) {
43  _sL = det.addExtension<SurfaceList >( new SurfaceList( true ) ) ;
44  }
45 
46  if( ! vsL->empty() && _sL->empty() ) { // only fill surfaces for this DetElement once
47 
48  // std::cout << " detector " << det.name() << " id: " << det.id() << " has " << vsL->size() << " surfaces " << std::endl ;
49 
50  // std::cout << " ------------------------- "
51  // << " DetectorSurfaces::initialize() adding surfaces : "
52  // << std::endl ;
53 
54  for( VolSurfaceList::const_iterator it = vsL->begin() ; it != vsL->end() ; ++it ){
55 
56  VolSurface volSurf = *it ;
57 
58  Surface* surf = 0 ;
59 
60  if( volSurf.type().isCylinder() )
61  surf = new CylinderSurface( det, volSurf ) ;
62 
63  else if( volSurf.type().isCone() )
64  surf = new ConeSurface( det, volSurf ) ;
65 
66  else
67  surf = new Surface( det, volSurf ) ;
68 
69  // std::cout << " ------------------------- "
70  // << " surface: " << *surf << std::endl
71  // << " ------------------------- " << std::endl ;
72 
73  _sL->push_back( surf ) ;
74 
75  }
76 
77 
78  }
79 
80  }
81 
82 
83 
84  } // namespace
85 }// namespace
dd4hep::rec::VolSurface::type
virtual const SurfaceType & type() const
Definition: Surface.cpp:248
dd4hep::exception
void exception(const std::string &src, const std::string &msg)
Definition: RootDictionary.h:69
dd4hep::rec::DetectorSurfaces::DetElement
DetElement DetElement
Definition: DetectorSurfaces.h:31
dd4hep::rec::CylinderSurface
Definition: Surface.h:614
dd4hep::rec::SurfaceType::isCone
bool isCone() const
true if this a conical surface
Definition: ISurface.h:211
dd4hep::rec::DetectorSurfaces::~DetectorSurfaces
virtual ~DetectorSurfaces()
Definition: DetectorSurfaces.cpp:25
dd4hep::rec::volSurfaceList
VolSurfaceList * volSurfaceList(DetElement &det)
Definition: Surface.cpp:528
dd4hep::DetElement
Handle class describing a detector element.
Definition: DetElement.h:188
dd4hep::rec::SurfaceList
Definition: Surface.h:681
dd4hep::rec::VolSurface
Definition: Surface.h:181
dd4hep::rec::DetectorSurfaces::initialize
void initialize()
initializes surfaces from VolSurfaces assigned to this DetElement in detector construction
Definition: DetectorSurfaces.cpp:31
dd4hep::rec::VolSurfaceList
Definition: Surface.h:300
DetectorSurfaces.h
dd4hep::rec::ConeSurface
Definition: Surface.h:655
dd4hep::rec::DetectorSurfaces::DetectorSurfaces
DetectorSurfaces(const DetElement &e)
Definition: DetectorSurfaces.cpp:20
dd4hep::rec::DetectorSurfaces::_sL
SurfaceList * _sL
Definition: DetectorSurfaces.h:41
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
det
DetElement::Object * det
Definition: AlignmentsCalculator.cpp:66
dd4hep::rec::Surface
Definition: Surface.h:498
dd4hep::rec::SurfaceType::isCylinder
bool isCylinder() const
true if this a cylindrical surface
Definition: ISurface.h:208