ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AirTube_geo.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file AirTube_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 
9 // This DD4hep Constructor is strongly inspired by (adds the ActsExtension)
10 // https://github.com/AIDASoft/DD4hep/tree/master/examples/SimpleDetector
11 
12 // $Id: $
13 //====================================================================
14 // // Simple tube filled with air
15 // // used for tracking purposes ...
16 //
17 //--------------------------------------------------------------------
18 //
19 // Author : F.Gaede
20 //
21 //====================================================================
23 #include "DD4hep/DetFactoryHelper.h"
24 
25 using namespace dd4hep;
26 
27 static Ref_t create_element(Detector& lcdd, xml_h e,
28  SensitiveDetector /* sens */) {
29  xml_det_t x_det = e;
30  std::string name = x_det.nameStr();
31 
32  DetElement airTube(name, x_det.id());
33  // Extension to Detlement for the RecoGeometry
34  Acts::ActsExtension* airTubeExtension = new Acts::ActsExtension();
35  airTubeExtension->addType("beampipe", "layer");
36  airTube.addExtension<Acts::ActsExtension>(airTubeExtension);
37 
38  PlacedVolume pv;
39 
40  // ----- read xml ----------------------
41 
42  xml_dim_t dim = x_det.dimensions();
43 
44  double inner_r = dim.rmin();
45  double outer_r = dim.rmax();
46  double z_half = dim.zhalf();
47 
48  //--------------------------------------
49 
50  Tube tubeSolid(inner_r, outer_r, z_half);
51 
52  Volume tube_vol(name + "_inner_cylinder_air", tubeSolid,
53  lcdd.material("Air"));
54 
55  Volume mother = lcdd.pickMotherVolume(airTube);
56 
57  pv = mother.placeVolume(tube_vol);
58 
59  pv.addPhysVolID("system", x_det.id());
60 
61  airTube.setPlacement(pv);
62 
63  return airTube;
64 }
65 
66 DECLARE_DETELEMENT(AirTube, create_element)