DD4hep - The AIDA detector description toolkit for high energy physics experiments
DD4hep  Rev:Unversioneddirectory
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DetectorSurfaces.cpp
Go to the documentation of this file.
2 
3 namespace DD4hep {
4  namespace DDRec {
5 
6 
7 
9 
10  initialize() ;
11  }
12 
14  // nothing to do: SurfaceList is added as extension
15  // and is deleted automatically
16  }
17 
18 
20 
21  DetElement det = *this ;
22 
23  const VolSurfaceList* vsL = volSurfaceList(det) ;
24 
25  try {
26  _sL = det.extension< SurfaceList >() ;
27 
28  } catch(const std::exception& e) {
29  _sL = det.addExtension<SurfaceList >( new SurfaceList( true ) ) ;
30  }
31 
32  if( ! vsL->empty() && _sL->empty() ) { // only fill surfaces for this DetElement once
33 
34  // std::cout << " detector " << det.name() << " id: " << det.id() << " has " << vsL->size() << " surfaces " << std::endl ;
35 
36  // std::cout << " ------------------------- "
37  // << " DetectorSurfaces::initialize() adding surfaces : "
38  // << std::endl ;
39 
40  for( VolSurfaceList::const_iterator it = vsL->begin() ; it != vsL->end() ; ++it ){
41 
42  VolSurface volSurf = *it ;
43 
44  Surface* surf = 0 ;
45 
46  if( volSurf.type().isCylinder() )
47  surf = new CylinderSurface( det, volSurf ) ;
48 
49  else if( volSurf.type().isCone() )
50  surf = new ConeSurface( det, volSurf ) ;
51 
52  else
53  surf = new Surface( det, volSurf ) ;
54 
55  // std::cout << " ------------------------- "
56  // << " surface: " << *surf << std::endl
57  // << " ------------------------- " << std::endl ;
58 
59  _sL->push_back( surf ) ;
60 
61  }
62 
63 
64  }
65 
66  }
67 
68 
69 
70  } // namespace
71 }// namespace
void initialize()
initializes surfaces from VolSurfaces assigned to this DetElement in detector construction ...
IFACE * addExtension(CONCRETE *c) const
Extend the detector element with an arbitrary structure accessible by the type.
Definition: Detector.h:297
bool isCylinder() const
true if this a cylindrical surface
Definition: ISurface.h:195
return e
Definition: Volumes.cpp:297
virtual const SurfaceType & type() const
Definition: Surface.cpp:228
Handle class describing a detector element.
Definition: Detector.h:172
VolSurfaceList * volSurfaceList(DetElement &det)
Definition: Surface.cpp:511
IFACE * extension() const
Access extension element by the type.
Definition: Detector.h:302
DetectorSurfaces(const DetElement &e)
bool isCone() const
true if this a conical surface
Definition: ISurface.h:198