File indexing completed on 2025-01-18 09:12:14
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "Acts/Plugins/ActSVG/DetectorSvgConverter.hpp"
0010
0011 #include "Acts/Detector/Detector.hpp"
0012 #include "Acts/Detector/DetectorVolume.hpp"
0013 #include "Acts/Detector/Portal.hpp"
0014 #include "Acts/Geometry/VolumeBounds.hpp"
0015 #include "Acts/Plugins/ActSVG/DetectorVolumeSvgConverter.hpp"
0016 #include "Acts/Utilities/Enumerate.hpp"
0017
0018 #include <map>
0019
0020 Acts::Svg::ProtoDetector Acts::Svg::DetectorConverter::convert(
0021 const GeometryContext& gctx, const Experimental::Detector& detector,
0022 const DetectorConverter::Options& detectorOptions) {
0023 ProtoDetector pDetector;
0024
0025 const auto volumes = detector.volumes();
0026
0027 std::map<const Experimental::DetectorVolume*, unsigned int> volumeIndices;
0028 for (auto [iv, v] : enumerate(volumes)) {
0029 volumeIndices[v] = iv;
0030 }
0031
0032
0033 unsigned int ip = 0;
0034 std::map<const Experimental::Portal*, unsigned int> portalIndices;
0035 for (const auto& v : volumes) {
0036 for (const auto& p : v->portals()) {
0037 portalIndices[p] = ip++;
0038 }
0039 }
0040
0041 DetectorVolumeConverter::Options volumeOptions =
0042 detectorOptions.volumeOptions;
0043 volumeOptions.portalIndices = portalIndices;
0044 volumeOptions.portalOptions.volumeIndices = volumeIndices;
0045
0046
0047 for (auto [iv, v] : enumerate(volumes)) {
0048 auto [pVolume, pGrid] = convert(gctx, *v, volumeOptions);
0049 pVolume._index = iv;
0050 pDetector._volumes.push_back(pVolume);
0051 }
0052
0053 return pDetector;
0054 }