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 
24 #include "DD4hep/DetFactoryHelper.h"
25 
26 using namespace dd4hep;
27 
28 static Ref_t create_element(Detector& lcdd, xml_h e,
29  SensitiveDetector /* sens */) {
30  xml_det_t x_det = e;
31  std::string name = x_det.nameStr();
32 
33  DetElement airTube(name, x_det.id());
34  // Extension to Detlement for the RecoGeometry
35  Acts::ActsExtension* airTubeExtension = new Acts::ActsExtension();
36  airTubeExtension->addType("beampipe", "layer");
37  airTube.addExtension<Acts::ActsExtension>(airTubeExtension);
38 
39  PlacedVolume pv;
40 
41  // ----- read xml ----------------------
42 
43  xml_dim_t dim = x_det.dimensions();
44 
45  double inner_r = dim.rmin();
46  double outer_r = dim.rmax();
47  double z_half = dim.zhalf();
48 
49  //--------------------------------------
50 
51  Tube tubeSolid(inner_r, outer_r, z_half);
52 
53  Volume tube_vol(name + "_inner_cylinder_air", tubeSolid,
54  lcdd.material("Air"));
55 
56  Volume mother = lcdd.pickMotherVolume(airTube);
57 
58  pv = mother.placeVolume(tube_vol);
59 
60  pv.addPhysVolID("system", x_det.id());
61 
62  airTube.setPlacement(pv);
63 
64  return airTube;
65 }
66 
67 DECLARE_DETELEMENT(AirTube, create_element)