ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TrackingVolumeCreation.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file TrackingVolumeCreation.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2016-2018 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 
19 
20 namespace Acts {
21 
24  const GeometryContext& gctx, double surfaceHalfLengthZ, double surfaceR,
25  double surfaceRstagger, double surfaceZoverlap, double layerEnvelope,
26  double volumeEnvelope, double innerVolumeR, double outerVolumeR,
27  const std::string& name) {
29  auto sfnPosition =
30  Vector3D(0., 0., -3 * surfaceHalfLengthZ - surfaceZoverlap);
31  auto sfnTransform =
32  std::make_shared<const Transform3D>(Translation3D(sfnPosition));
33  auto sfcTransform = nullptr;
34  auto sfpPosition = Vector3D(0., 0., 3 * surfaceHalfLengthZ - surfaceZoverlap);
35  auto sfpTransform =
36  std::make_shared<const Transform3D>(Translation3D(sfpPosition));
38  auto sfnBounds = std::make_shared<CylinderBounds>(
39  surfaceR - 0.5 * surfaceRstagger, surfaceHalfLengthZ);
40  auto sfn = Surface::makeShared<CylinderSurface>(sfnTransform, sfnBounds);
41  auto sfcBounds = std::make_shared<CylinderBounds>(
42  surfaceR + 0.5 * surfaceRstagger, surfaceHalfLengthZ);
43  auto sfc = Surface::makeShared<CylinderSurface>(sfcTransform, sfcBounds);
44  auto sfpBounds = std::make_shared<CylinderBounds>(
45  surfaceR - 0.5 * surfaceRstagger, surfaceHalfLengthZ);
46  auto sfp = Surface::makeShared<CylinderSurface>(sfpTransform, sfpBounds);
47 
49 
51  double bUmin = sfnPosition.z() - surfaceHalfLengthZ;
52  double bUmax = sfpPosition.z() + surfaceHalfLengthZ;
53 
54  std::vector<std::shared_ptr<const Surface>> surfaces_only = {{sfn, sfc, sfp}};
55  std::vector<const Surface*> surfaces_only_raw = {
56  {sfn.get(), sfc.get(), sfp.get()}};
57 
58  detail::Axis<detail::AxisType::Equidistant, detail::AxisBoundaryType::Bound>
59  axis(bUmin, bUmax, surfaces_only.size());
60  auto g2l = [](const Vector3D& glob) {
61  return std::array<double, 1>({{glob.z()}});
62  };
63  auto l2g = [](const std::array<double, 1>& loc) {
64  return Vector3D(0, 0, loc[0]);
65  };
66  auto sl = std::make_unique<SurfaceArray::SurfaceGridLookup<decltype(axis)>>(
67  g2l, l2g, std::make_tuple(axis));
68  sl->fill(gctx, surfaces_only_raw);
69  auto bArray = std::make_unique<SurfaceArray>(std::move(sl), surfaces_only);
70 
72  auto layer0bounds = std::make_shared<const CylinderBounds>(surfaceR, bUmax);
73  auto layer0 = CylinderLayer::create(nullptr, layer0bounds, std::move(bArray),
74  surfaceRstagger + 2 * layerEnvelope);
75  std::unique_ptr<const LayerArray> layerArray =
76  std::make_unique<const BinnedArrayXD<LayerPtr>>(layer0);
77 
79  auto volumeBounds = std::make_shared<const CylinderVolumeBounds>(
80  innerVolumeR, outerVolumeR, bUmax + volumeEnvelope);
81 
83  nullptr, volumeBounds, nullptr, std::move(layerArray), nullptr, {}, name);
85  return volume;
86 }
87 
92  double hVolumeR,
93  double hVolumeHalflength,
94  const std::string& name) {
96  using VAP = std::pair<TrackingVolumePtr, Vector3D>;
97  std::vector<VAP> volumes = {{iVolume, iVolume->binningPosition(gctx, binR)},
98  {oVolume, oVolume->binningPosition(gctx, binR)}};
100  auto hVolumeBounds = std::make_shared<const CylinderVolumeBounds>(
101  0., hVolumeR, hVolumeHalflength);
103  auto vUtility = std::make_unique<const BinUtility>(volumes.size(), 0.,
104  hVolumeR, open, binR);
105  std::shared_ptr<const TrackingVolumeArray> vArray =
106  std::make_shared<const BinnedArrayXD<TrackingVolumePtr>>(
107  volumes, std::move(vUtility));
109  auto hVolume = TrackingVolume::create(nullptr, hVolumeBounds, vArray, name);
110  // return the container
111  return hVolume;
112 }
113 } // namespace Acts