ECCE @ 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 #include "DD4hep/DetFactoryHelper.h"
11 
12 using dd4hep::DetElement;
13 using dd4hep::PlacedVolume;
14 using dd4hep::Tube;
15 using dd4hep::Volume;
16 
17 static dd4hep::Ref_t create_element(dd4hep::Detector& lcdd, xml_h e,
18  dd4hep::SensitiveDetector) {
19  xml_det_t x_det = e;
20  std::string det_name = x_det.nameStr();
21  // Make DetElement
22  DetElement beamtube(det_name, x_det.id());
23  Acts::ActsExtension* detvolume = new Acts::ActsExtension();
24  detvolume->addType("beampipe", "layer");
25  beamtube.addExtension<Acts::ActsExtension>(detvolume);
26  dd4hep::xml::Dimension x_det_dim(x_det.dimensions());
27  Tube tube_shape(x_det_dim.rmin(), x_det_dim.rmax(), x_det_dim.z());
28  Volume tube_vol(det_name, tube_shape,
29  lcdd.material(x_det_dim.attr<std::string>("material")));
30  tube_vol.setVisAttributes(lcdd, x_det_dim.visStr());
31  // Place Volume
32  Volume mother_vol = lcdd.pickMotherVolume(beamtube);
33  PlacedVolume placedTube = mother_vol.placeVolume(tube_vol);
34  beamtube.setPlacement(placedTube);
35  return beamtube;
36 }
37 
38 DECLARE_DETELEMENT(BeamTube, create_element)