EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FCChhTrackerTkLayout_Beampipe.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file FCChhTrackerTkLayout_Beampipe.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2017 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
10 
11 #include "DD4hep/DetFactoryHelper.h"
12 
13 using dd4hep::DetElement;
14 using dd4hep::PlacedVolume;
15 using dd4hep::Tube;
16 using dd4hep::Volume;
17 
18 static dd4hep::Ref_t create_element(dd4hep::Detector& lcdd, xml_h e,
19  dd4hep::SensitiveDetector) {
20  xml_det_t x_det = e;
21  std::string det_name = x_det.nameStr();
22  // Make DetElement
23  DetElement beamtube(det_name, x_det.id());
24  Acts::ActsExtension* detvolume = new Acts::ActsExtension();
25  detvolume->addType("beampipe", "layer");
26  beamtube.addExtension<Acts::ActsExtension>(detvolume);
27  dd4hep::xml::Dimension x_det_dim(x_det.dimensions());
28  Tube tube_shape(x_det_dim.rmin(), x_det_dim.rmax(), x_det_dim.z());
29  Volume tube_vol(det_name, tube_shape,
30  lcdd.material(x_det_dim.attr<std::string>("material")));
31  tube_vol.setVisAttributes(lcdd, x_det_dim.visStr());
32  // Place Volume
33  Volume mother_vol = lcdd.pickMotherVolume(beamtube);
34  PlacedVolume placedTube = mother_vol.placeVolume(tube_vol);
35  beamtube.setPlacement(placedTube);
36  return beamtube;
37 }
38 
39 DECLARE_DETELEMENT(BeamTube, create_element)