File indexing completed on 2025-01-18 09:11:25
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "Acts/Geometry/TrackingVolumeArrayCreator.hpp"
0010
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/Geometry/GeometryObjectSorter.hpp"
0013 #include "Acts/Geometry/TrackingVolume.hpp"
0014 #include "Acts/Geometry/VolumeBounds.hpp"
0015 #include "Acts/Utilities/BinUtility.hpp"
0016 #include "Acts/Utilities/BinnedArrayXD.hpp"
0017
0018 #include <algorithm>
0019 #include <vector>
0020
0021 std::shared_ptr<const Acts::TrackingVolumeArray>
0022 Acts::TrackingVolumeArrayCreator::trackingVolumeArray(
0023 const GeometryContext& gctx, const TrackingVolumeVector& tVolumes,
0024 AxisDirection aDir) const {
0025
0026
0027
0028 TrackingVolumeVector volumes(tVolumes);
0029
0030 GeometryObjectSorterT<std::shared_ptr<const TrackingVolume>> volumeSorter(
0031 gctx, aDir);
0032 std::ranges::sort(volumes, volumeSorter);
0033
0034
0035
0036 std::vector<float> boundaries;
0037 boundaries.reserve(tVolumes.size() + 1);
0038
0039 std::vector<TrackingVolumeOrderPosition> tVolumesOrdered;
0040
0041
0042 for (auto& tVolume : volumes) {
0043
0044 Vector3 referencePosition = tVolume->referencePosition(gctx, aDir);
0045 double referenceBorder = tVolume->volumeBounds().referenceBorder(aDir);
0046
0047 double value = tVolume->referencePositionValue(gctx, aDir);
0048
0049 if (boundaries.empty()) {
0050 boundaries.push_back(value - referenceBorder);
0051 }
0052
0053 boundaries.push_back(value + referenceBorder);
0054
0055 tVolumesOrdered.push_back(
0056 TrackingVolumeOrderPosition(tVolume, referencePosition));
0057 }
0058
0059
0060 auto binUtility = std::make_unique<const BinUtility>(boundaries, open, aDir);
0061
0062
0063 return std::make_shared<const BinnedArrayXD<TrackingVolumePtr>>(
0064 tVolumesOrdered, std::move(binUtility));
0065 }