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
SurfaceCandidatesUpdators.hpp
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file SurfaceCandidatesUpdators.hpp
1
// This file is part of the Acts project.
2
//
3
// Copyright (C) 2022 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
11
#include "
Acts/Definitions/Algebra.hpp
"
12
#include "
Acts/Definitions/Common.hpp
"
13
#include "
Acts/Detector/DetectorVolume.hpp
"
14
#include "
Acts/Detector/Portal.hpp
"
15
#include "
Acts/Geometry/GeometryContext.hpp
"
16
#include "
Acts/Navigation/MultiLayerSurfacesUpdator.hpp
"
17
#include "
Acts/Navigation/NavigationState.hpp
"
18
#include "
Acts/Navigation/NavigationStateFillers.hpp
"
19
#include "
Acts/Navigation/NavigationStateUpdators.hpp
"
20
#include "
Acts/Surfaces/Surface.hpp
"
21
22
#include <memory>
23
#include <tuple>
24
25
namespace
Acts {
26
namespace
Experimental {
27
28
struct
AllPortalsImpl
:
public
INavigationDelegate
{
38
inline
void
update
(
const
GeometryContext
&
gctx
,
39
NavigationState
&
nState
)
const
{
40
if
(nState.
currentVolume
==
nullptr
) {
41
throw
std::runtime_error(
42
"AllPortalsImpl: no detector volume set to navigation state."
);
43
}
44
// Retrieval necessary
45
if
(nState.
surfaceCandidates
.empty()) {
46
// Fill internal portals if existing
47
for
(
const
auto
v
: nState.
currentVolume
->
volumes
()) {
48
const
auto
& iPortals =
v
->portals();
49
PortalsFiller::fill
(nState, iPortals);
50
}
51
// Filling the new portal candidates
52
const
auto
& portals = nState.
currentVolume
->
portals
();
53
PortalsFiller::fill
(nState, portals);
54
}
55
// Sort and update
56
updateCandidates
(gctx, nState);
57
}
58
};
59
60
struct
AllPortalsAndSurfacesImpl
:
public
INavigationDelegate
{
70
inline
void
update
(
const
GeometryContext
&
gctx
,
71
NavigationState
&
nState
)
const
{
72
if
(nState.
currentDetector
==
nullptr
) {
73
throw
std::runtime_error(
74
"AllPortalsAndSurfacesImpl: no detector volume set to navigation "
75
"state."
);
76
}
77
// A volume switch has happened, update list of portals & surfaces
78
if
(nState.
surfaceCandidates
.empty()) {
79
// Fill internal portals if existing
80
for
(
const
auto
v
: nState.
currentVolume
->
volumes
()) {
81
const
auto
& iPortals =
v
->portals();
82
PortalsFiller::fill
(nState, iPortals);
83
}
84
// Assign the new volume
85
const
auto
& portals = nState.
currentVolume
->
portals
();
86
const
auto
& surfaces = nState.
currentVolume
->
surfaces
();
87
PortalsFiller::fill
(nState, portals);
88
SurfacesFiller::fill
(nState, surfaces);
89
}
90
// Update internal candidates
91
updateCandidates
(gctx, nState);
92
}
93
};
94
98
inline
static
SurfaceCandidatesUpdator
tryAllPortals
() {
99
auto
ap = std::make_unique<const AllPortalsImpl>();
100
SurfaceCandidatesUpdator
nStateUpdator;
101
nStateUpdator.connect<&
AllPortalsImpl::update
>(
std::move
(ap));
102
return
nStateUpdator;
103
}
104
111
inline
static
SurfaceCandidatesUpdator
tryAllPortalsAndSurfaces
() {
112
auto
aps = std::make_unique<const AllPortalsAndSurfacesImpl>();
113
SurfaceCandidatesUpdator
nStateUpdator;
114
nStateUpdator.connect<&
AllPortalsAndSurfacesImpl::update
>(
std::move
(aps));
115
return
nStateUpdator;
116
}
117
122
struct
AdditionalSurfacesImpl
:
public
INavigationDelegate
{
124
std::vector<const Surface*>
surfaces
= {};
125
131
inline
void
update
([[maybe_unused]]
const
GeometryContext
&
gctx
,
132
NavigationState
&
nState
)
const
{
133
SurfacesFiller::fill
(nState,
surfaces
);
134
}
135
};
136
140
template
<
typename
gr
id
_type>
141
using
IndexedSurfacesImpl
=
142
IndexedUpdatorImpl<grid_type, IndexedSurfacesExtractor, SurfacesFiller>
;
143
147
template
<
typename
gr
id
_type>
148
using
MultiLayerSurfacesImpl
=
149
MultiLayerSurfacesUpdatorImpl<grid_type, PathGridSurfacesGenerator>
;
150
154
template
<
typename
gr
id
_type,
template
<
typename
>
class
indexed_updator>
155
using
IndexedSurfacesAllPortalsImpl
=
156
ChainedUpdatorImpl<AllPortalsImpl, indexed_updator<grid_type>
>;
157
158
}
// namespace Experimental
159
}
// namespace Acts
acts
blob
sPHENIX
Core
include
Acts
Navigation
SurfaceCandidatesUpdators.hpp
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:17:33
using
1.8.2 with
sPHENIX GitHub integration