Analysis Software
Documentation for sPHENIX simulation 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 
9 #pragma once
10 
21 
22 namespace Acts {
23 
26  const GeometryContext& gctx, double surfaceHalfLengthZ, double surfaceR,
27  double surfaceRstagger, double surfaceZoverlap, double layerEnvelope,
28  double volumeEnvelope, double innerVolumeR, double outerVolumeR,
29  const std::string& name) {
31  auto sfnPosition = Vector3(0., 0., -3 * surfaceHalfLengthZ - surfaceZoverlap);
32  auto sfnTransform = Transform3(Translation3(sfnPosition));
33  auto sfcTransform = Transform3::Identity();
34  auto sfpPosition = Vector3(0., 0., 3 * surfaceHalfLengthZ - surfaceZoverlap);
35  auto sfpTransform = Transform3(Translation3(sfpPosition));
37  auto sfnBounds = std::make_shared<CylinderBounds>(
38  surfaceR - 0.5 * surfaceRstagger, surfaceHalfLengthZ);
39  auto sfn = Surface::makeShared<CylinderSurface>(sfnTransform, sfnBounds);
40  auto sfcBounds = std::make_shared<CylinderBounds>(
41  surfaceR + 0.5 * surfaceRstagger, surfaceHalfLengthZ);
42  auto sfc = Surface::makeShared<CylinderSurface>(sfcTransform, sfcBounds);
43  auto sfpBounds = std::make_shared<CylinderBounds>(
44  surfaceR - 0.5 * surfaceRstagger, surfaceHalfLengthZ);
45  auto sfp = Surface::makeShared<CylinderSurface>(sfpTransform, sfpBounds);
46 
48 
50  double bUmin = sfnPosition.z() - surfaceHalfLengthZ;
51  double bUmax = sfpPosition.z() + surfaceHalfLengthZ;
52 
53  std::vector<std::shared_ptr<const Surface>> surfaces_only = {{sfn, sfc, sfp}};
54  std::vector<const Surface*> surfaces_only_raw = {
55  {sfn.get(), sfc.get(), sfp.get()}};
56 
57  detail::Axis<detail::AxisType::Equidistant, detail::AxisBoundaryType::Bound>
58  axis(bUmin, bUmax, surfaces_only.size());
59  auto g2l = [](const Vector3& glob) {
60  return std::array<double, 1>({{glob.z()}});
61  };
62  auto l2g = [](const std::array<double, 1>& loc) {
63  return Vector3(0, 0, loc[0]);
64  };
65  auto sl = std::make_unique<SurfaceArray::SurfaceGridLookup<decltype(axis)>>(
66  g2l, l2g, std::make_tuple(axis));
67  sl->fill(gctx, surfaces_only_raw);
68  auto bArray = std::make_unique<SurfaceArray>(std::move(sl), surfaces_only);
69 
71  auto layer0bounds = std::make_shared<const CylinderBounds>(surfaceR, bUmax);
72  auto layer0 = CylinderLayer::create(Transform3::Identity(), layer0bounds,
73  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 
82  TrackingVolumePtr volume =
83  TrackingVolume::create(Transform3::Identity(), volumeBounds, nullptr,
84  std::move(layerArray), nullptr, {}, name);
86  return volume;
87 }
88 
93  double hVolumeR,
94  double hVolumeHalflength,
95  const std::string& name) {
97  using VAP = std::pair<TrackingVolumePtr, Vector3>;
98  std::vector<VAP> volumes = {{iVolume, iVolume->binningPosition(gctx, binR)},
99  {oVolume, oVolume->binningPosition(gctx, binR)}};
101  auto hVolumeBounds = std::make_shared<const CylinderVolumeBounds>(
102  0., hVolumeR, hVolumeHalflength);
104  auto vUtility = std::make_unique<const BinUtility>(volumes.size(), 0.,
105  hVolumeR, open, binR);
106  std::shared_ptr<const TrackingVolumeArray> vArray =
107  std::make_shared<const BinnedArrayXD<TrackingVolumePtr>>(
108  volumes, std::move(vUtility));
110  auto hVolume = TrackingVolume::create(Transform3::Identity(), hVolumeBounds,
111  vArray, name);
112  // return the container
113  return hVolume;
114 }
115 } // namespace Acts