File indexing completed on 2025-01-18 09:14:58
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #include "DD4hep/DetFactoryHelper.h"
0011
0012 #include "DDRec/Surface.h"
0013 #include "DDRec/DetectorData.h"
0014
0015
0016 using namespace dd4hep;
0017 using namespace dd4hep::detail;
0018 using namespace dd4hep::rec ;
0019
0020 static Ref_t create_element(Detector& description, xml_h e, SensitiveDetector ) {
0021
0022 xml_det_t x_det = e;
0023 std::string name = x_det.nameStr();
0024
0025 DetElement airTube( name, x_det.id() ) ;
0026
0027 PlacedVolume pv;
0028
0029
0030
0031 xml_dim_t dim = x_det.dimensions();
0032
0033 double inner_r = dim.rmin() ;
0034 double outer_r = dim.rmax() ;
0035 double z_half = dim.zhalf() ;
0036 double tube_thick = outer_r - inner_r ;
0037
0038
0039
0040 Tube tubeSolid (inner_r, outer_r, z_half ) ;
0041
0042 Volume tube_vol( name+"_inner_cylinder_air", tubeSolid , description.material("Air") ) ;
0043
0044 Vector3D ocyl( inner_r + 0.5*tube_thick , 0. , 0. ) ;
0045
0046 VolCylinder cylSurf( tube_vol , SurfaceType( SurfaceType::Helper ) , 0.5*tube_thick , 0.5*tube_thick , ocyl ) ;
0047
0048 volSurfaceList( airTube )->push_back( cylSurf ) ;
0049
0050
0051
0052
0053 Volume mother = description.pickMotherVolume( airTube ) ;
0054
0055 pv = mother.placeVolume( tube_vol ) ;
0056
0057 pv.addPhysVolID( "system", x_det.id() ) ;
0058
0059 airTube.setPlacement( pv );
0060
0061 return airTube;
0062 }
0063
0064 DECLARE_DETELEMENT( AirTube,create_element)