ECCE @ 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 #include "DD4hep/DetFactoryHelper.h"
11 
12 using namespace std;
13 using namespace dd4hep;
14 
15 static Ref_t create_element(Detector& lcdd, xml_h e,
16  SensitiveDetector /*sens*/) {
17  xml_det_t x_det = e;
18  string det_name = x_det.nameStr();
19  // Make DetElement
20  DetElement beamtube(det_name, x_det.id());
21  // Add Extension to Detlement for the RecoGeometry
22  Acts::ActsExtension* beamPipeExtension = new Acts::ActsExtension();
23  beamPipeExtension->addType("beampipe", "layer");
24  beamtube.addExtension<Acts::ActsExtension>(beamPipeExtension);
25 
26  // Create the shape and volume
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.air()); // air at the moment change later
31  tube_vol.setVisAttributes(lcdd, x_det_dim.visStr());
32 
33  // Place Volume
34  Volume mother_vol = lcdd.pickMotherVolume(beamtube);
35  PlacedVolume placedTube = mother_vol.placeVolume(tube_vol);
36  placedTube.addPhysVolID("tube", beamtube.id());
37  beamtube.setPlacement(placedTube);
38 
39  // Return the detector element
40  return beamtube;
41 }
42 
43 DECLARE_DETELEMENT(BeamPipe, create_element)