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 = Transform3D(Translation3D(sfnPosition));
32  auto sfcTransform = Transform3D::Identity();
33  auto sfpPosition = Vector3D(0., 0., 3 * surfaceHalfLengthZ - surfaceZoverlap);
34  auto sfpTransform = Transform3D(Translation3D(sfpPosition));
36  auto sfnBounds = std::make_shared<CylinderBounds>(
37  surfaceR - 0.5 * surfaceRstagger, surfaceHalfLengthZ);
38  auto sfn = Surface::makeShared<CylinderSurface>(sfnTransform, sfnBounds);
39  auto sfcBounds = std::make_shared<CylinderBounds>(
40  surfaceR + 0.5 * surfaceRstagger, surfaceHalfLengthZ);
41  auto sfc = Surface::makeShared<CylinderSurface>(sfcTransform, sfcBounds);
42  auto sfpBounds = std::make_shared<CylinderBounds>(
43  surfaceR - 0.5 * surfaceRstagger, surfaceHalfLengthZ);
44  auto sfp = Surface::makeShared<CylinderSurface>(sfpTransform, sfpBounds);
45 
47 
49  double bUmin = sfnPosition.z() - surfaceHalfLengthZ;
50  double bUmax = sfpPosition.z() + surfaceHalfLengthZ;
51 
52  std::vector<std::shared_ptr<const Surface>> surfaces_only = {{sfn, sfc, sfp}};
53  std::vector<const Surface*> surfaces_only_raw = {
54  {sfn.get(), sfc.get(), sfp.get()}};
55 
56  detail::Axis<detail::AxisType::Equidistant, detail::AxisBoundaryType::Bound>
57  axis(bUmin, bUmax, surfaces_only.size());
58  auto g2l = [](const Vector3D& glob) {
59  return std::array<double, 1>({{glob.z()}});
60  };
61  auto l2g = [](const std::array<double, 1>& loc) {
62  return Vector3D(0, 0, loc[0]);
63  };
64  auto sl = std::make_unique<SurfaceArray::SurfaceGridLookup<decltype(axis)>>(
65  g2l, l2g, std::make_tuple(axis));
66  sl->fill(gctx, surfaces_only_raw);
67  auto bArray = std::make_unique<SurfaceArray>(std::move(sl), surfaces_only);
68 
70  auto layer0bounds = std::make_shared<const CylinderBounds>(surfaceR, bUmax);
71  auto layer0 = CylinderLayer::create(Transform3D::Identity(), layer0bounds,
72  std::move(bArray),
73  surfaceRstagger + 2 * layerEnvelope);
74  std::unique_ptr<const LayerArray> layerArray =
75  std::make_unique<const BinnedArrayXD<LayerPtr>>(layer0);
76 
78  auto volumeBounds = std::make_shared<const CylinderVolumeBounds>(
79  innerVolumeR, outerVolumeR, bUmax + volumeEnvelope);
80 
82  TrackingVolume::create(Transform3D::Identity(), volumeBounds, nullptr,
83  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(Transform3D::Identity(), hVolumeBounds,
110  vArray, name);
111  // return the container
112  return hVolume;
113 }
114 } // namespace Acts