Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include "DDRec/DetectorSurfaces.h"
namespace DD4hep {
namespace DDRec {
DetectorSurfaces::DetectorSurfaces(DD4hep::Geometry::DetElement const& e) : DetElement(e) , _sL( 0 ) {
initialize() ;
}
DetectorSurfaces::~DetectorSurfaces(){
// nothing to do: SurfaceList is added as extension
// and is deleted automatically
}
void DetectorSurfaces::initialize() {
DetElement det = *this ;
const VolSurfaceList* vsL = volSurfaceList(det) ;
try {
_sL = det.extension< SurfaceList >() ;
} catch( std::runtime_error e){
_sL = det.addExtension<SurfaceList >( new SurfaceList( true ) ) ;
}
if( ! vsL->empty() ) {
// std::cout << " detector " << det.name() << " id: " << det.id() << " has " << vsL->size() << " surfaces " << std::endl ;
// std::cout << " ------------------------- "
// << " DetectorSurfaces::initialize() adding surfaces : "
// << std::endl ;
for( VolSurfaceList::const_iterator it = vsL->begin() ; it != vsL->end() ; ++it ){
VolSurface volSurf = *it ;
Surface* surf = ( volSurf.type().isCylinder() ? new CylinderSurface( det, volSurf ) : new Surface( det, volSurf ) ) ;
// std::cout << " ------------------------- "
// << " surface: " << *surf << std::endl
// << " ------------------------- " << std::endl ;