EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DemonstratorBeamPipe_geo.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file DemonstratorBeamPipe_geo.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2019 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 namespace std;
14 using namespace dd4hep;
15 
16 static Ref_t create_element(Detector& lcdd, xml_h xml,
17  SensitiveDetector /*sens*/) {
18  xml_det_t x_det = xml;
19  string det_name = x_det.nameStr();
20 
21  // Make DetElement
22  DetElement beamPipeElement(det_name, x_det.id());
23  // add Extension to Detlement for the RecoGeometry
24  Acts::ActsExtension* beamPipeExtension = new Acts::ActsExtension();
25  beamPipeExtension->addType("beampipe", "layer");
26  beamPipeElement.addExtension<Acts::ActsExtension>(beamPipeExtension);
27 
28  // Make Volume
29  xml_comp_t x_det_def = x_det.child(_U(description));
30  Tube tube_shape(x_det_def.rmin(), x_det_def.rmax(), x_det_def.dz());
31  Volume tube_vol(det_name, tube_shape, lcdd.material(x_det_def.materialStr()));
32  tube_vol.setVisAttributes(lcdd, x_det.visStr());
33 
34  // Place it in the mother
35  Volume mother_vol = lcdd.pickMotherVolume(beamPipeElement);
36  PlacedVolume placedTube = mother_vol.placeVolume(tube_vol);
37  placedTube.addPhysVolID("BeamTube", beamPipeElement.id());
38  beamPipeElement.setPlacement(placedTube);
39 
40  return beamPipeElement;
41 }
42 
43 DECLARE_DETELEMENT(DemonstratorBeamPipe, create_element)