EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
BeamPipe_geo.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file BeamPipe_geo.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 namespace std;
14 using namespace dd4hep;
15 
16 static Ref_t create_element(Detector& lcdd, xml_h e,
17  SensitiveDetector /*sens*/) {
18  xml_det_t x_det = e;
19  string det_name = x_det.nameStr();
20  // Make DetElement
21  DetElement beamtube(det_name, x_det.id());
22  // Add Extension to Detlement for the RecoGeometry
23  Acts::ActsExtension* beamPipeExtension = new Acts::ActsExtension();
24  beamPipeExtension->addType("beampipe", "layer");
25  beamtube.addExtension<Acts::ActsExtension>(beamPipeExtension);
26 
27  // Create the shape and volume
28  dd4hep::xml::Dimension x_det_dim(x_det.dimensions());
29  Tube tube_shape(x_det_dim.rmin(), x_det_dim.rmax(), x_det_dim.z());
30  Volume tube_vol(det_name, tube_shape,
31  lcdd.air()); // air at the moment change later
32  tube_vol.setVisAttributes(lcdd, x_det_dim.visStr());
33 
34  // Place Volume
35  Volume mother_vol = lcdd.pickMotherVolume(beamtube);
36  PlacedVolume placedTube = mother_vol.placeVolume(tube_vol);
37  placedTube.addPhysVolID("tube", beamtube.id());
38  beamtube.setPlacement(placedTube);
39 
40  // Return the detector element
41  return beamtube;
42 }
43 
44 DECLARE_DETELEMENT(BeamPipe, create_element)