Analysis Software
Documentation for
sPHENIX
simulation software
Home page
Related Pages
Modules
Namespaces
Classes
Files
Examples
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
DetectorSvgConverter.cpp
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file DetectorSvgConverter.cpp
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
#include "
Acts/Plugins/ActSVG/DetectorSvgConverter.hpp
"
10
11
#include "
Acts/Detector/Detector.hpp
"
12
#include "
Acts/Detector/DetectorVolume.hpp
"
13
#include "
Acts/Detector/Portal.hpp
"
14
#include "
Acts/Geometry/VolumeBounds.hpp
"
15
#include "
Acts/Plugins/ActSVG/DetectorVolumeSvgConverter.hpp
"
16
#include "
Acts/Utilities/Enumerate.hpp
"
17
18
#include <map>
19
20
Acts::Svg::ProtoDetector
Acts::Svg::DetectorConverter::convert
(
21
const
GeometryContext
&
gctx
,
const
Experimental::Detector
&
detector
,
22
const
DetectorConverter::Options
& detectorOptions) {
23
ProtoDetector
pDetector;
24
25
const
auto
volumes
= detector.
volumes
();
26
// Create the index map vor volumes
27
std::map<const Experimental::DetectorVolume*, unsigned int> volumeIndices;
28
for
(
auto
[iv,
v
] :
enumerate
(
volumes
)) {
29
volumeIndices[
v
] = iv;
30
}
31
32
// Create the index map for portals
33
unsigned
int
ip = 0;
34
std::map<const Experimental::Portal*, unsigned int> portalIndices;
35
for
(
const
auto
&
v
:
volumes
) {
36
for
(
const
auto
&
p
:
v
->portals()) {
37
portalIndices[
p
] = ip++;
38
}
39
}
40
41
DetectorVolumeConverter::Options
volumeOptions =
42
detectorOptions.
volumeOptions
;
43
volumeOptions.
portalIndices
= portalIndices;
44
volumeOptions.
portalOptions
.
volumeIndices
= volumeIndices;
45
46
// Loop over the list of volumes, remember internal ones
47
for
(
auto
[iv,
v
] :
enumerate
(volumes)) {
48
auto
[pVolume, pGrid] =
convert
(gctx, *
v
, volumeOptions);
49
pVolume._index = iv;
50
pDetector._volumes.push_back(pVolume);
51
}
52
53
return
pDetector;
54
}
acts
blob
sPHENIX
Plugins
ActSVG
src
DetectorSvgConverter.cpp
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:17:41
using
1.8.2 with
sPHENIX GitHub integration