Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DetectorVolumeSvgConverter.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file DetectorVolumeSvgConverter.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2023 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 
16 #include <actsvg/core.hpp>
17 #include <actsvg/meta.hpp>
18 
19 #include <map>
20 #include <string>
21 #include <tuple>
22 
23 namespace Acts {
24 
25 namespace Experimental {
26 class DetectorVolume;
27 class Portal;
28 } // namespace Experimental
29 
30 namespace Svg {
31 
32 using ProtoVolume = actsvg::proto::volume<std::vector<Vector3>>;
33 
34 namespace DetectorVolumeConverter {
35 
37 struct Options {
39  std::map<const Experimental::Portal*, unsigned int> portalIndices;
44 };
45 
53 std::tuple<ProtoVolume, ProtoIndexedSurfaceGrid> convert(
54  const GeometryContext& gctx, const Experimental::DetectorVolume& dVolume,
55  const Options& volumeOptions);
56 
57 } // namespace DetectorVolumeConverter
58 
59 namespace View {
60 
68 static inline actsvg::svg::object xy(const ProtoVolume& volume,
69  const std::string& identification,
70  bool displayPortals = true) {
71  actsvg::views::x_y xyView;
72  return actsvg::display::volume(identification, volume, xyView,
73  displayPortals);
74 }
75 
83 static inline actsvg::svg::object zr(const ProtoVolume& volume,
84  const std::string& identification,
85  bool displayPortals = true) {
86  actsvg::views::z_r zrView;
87  return actsvg::display::volume(identification, volume, zrView,
88  displayPortals);
89 }
90 
91 } // namespace View
92 
93 } // namespace Svg
94 
95 } // namespace Acts