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
DetectorVolumeUpdators.hpp
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file DetectorVolumeUpdators.hpp
1
// This file is part of the Acts project.
2
//
3
// Copyright (C) 2022-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
11
#include "
Acts/Geometry/GeometryContext.hpp
"
12
#include "
Acts/Navigation/NavigationDelegates.hpp
"
13
#include "
Acts/Navigation/NavigationState.hpp
"
14
#include "
Acts/Navigation/NavigationStateFillers.hpp
"
15
#include "
Acts/Navigation/NavigationStateUpdators.hpp
"
16
#include "
Acts/Utilities/detail/Axis.hpp
"
17
#include "
Acts/Utilities/detail/Grid.hpp
"
18
19
#include <stdexcept>
20
21
namespace
Acts {
22
namespace
Experimental {
23
24
class
DetectorVolume;
25
29
struct
EndOfWorldImpl
:
public
INavigationDelegate
{
33
inline
void
update
(
const
GeometryContext
&
/*ignored*/
,
34
NavigationState
&
nState
)
const
{
35
nState.
currentVolume
=
nullptr
;
36
}
37
};
38
42
struct
SingleDetectorVolumeImpl
:
public
INavigationDelegate
{
43
const
DetectorVolume
*
dVolume
=
nullptr
;
44
47
SingleDetectorVolumeImpl
(
const
DetectorVolume
* sVolume) noexcept(
false
)
48
:
dVolume
(sVolume) {
49
if
(sVolume ==
nullptr
) {
50
throw
std::invalid_argument(
51
"DetectorVolumeUpdators: nullptr provided, use EndOfWorld instead."
);
52
}
53
}
54
55
SingleDetectorVolumeImpl
() =
delete
;
56
61
inline
void
update
(
const
GeometryContext
&
/*ignored*/
,
62
NavigationState
&
nState
)
const
{
63
nState.
currentVolume
=
dVolume
;
64
}
65
};
66
67
using
SingleIndex
= std::size_t;
68
69
using
VariableBoundAxis
=
70
Acts::detail::Axis<Acts::detail::AxisType::Variable,
71
Acts::detail::AxisBoundaryType::Bound>;
72
using
VariableBoundIndexGrid1
=
73
Acts::detail::Grid<SingleIndex, VariableBoundAxis>
;
74
80
struct
DetectorVolumesCollection
{
82
std::vector<const DetectorVolume*>
dVolumes
= {};
83
90
inline
const
DetectorVolume
*
extract
(
const
GeometryContext
&
/*gctx*/
,
91
const
NavigationState
&
/*nState*/
,
92
const
SingleIndex
&
index
)
const
{
93
return
dVolumes
[
index
];
94
}
95
};
96
101
struct
BoundVolumesGrid1Impl
:
public
INavigationDelegate
{
102
using
IndexedUpdator
=
103
IndexedUpdatorImpl
<
VariableBoundIndexGrid1
,
DetectorVolumesCollection
,
104
DetectorVolumeFiller
>;
105
// The indexed updator
106
IndexedUpdator
indexedUpdator
;
107
114
BoundVolumesGrid1Impl
(
115
const
std::vector<ActsScalar>& gBoundaries,
BinningValue
bValue,
116
const
std::vector<const DetectorVolume*>& cVolumes,
117
const
Transform3
&
bTransform
= Transform3::Identity()) noexcept(
false
)
118
:
indexedUpdator
(
IndexedUpdator
(
VariableBoundIndexGrid1
(std::
make_tuple
(
119
VariableBoundAxis
(gBoundaries))),
120
{bValue},
bTransform
)) {
121
indexedUpdator
.
extractor
.
dVolumes
= cVolumes;
122
123
if
(gBoundaries.size() != cVolumes.size() + 1
u
) {
124
throw
std::invalid_argument(
125
"DetectorVolumeUpdators: mismatching boundaries and volume numbers"
);
126
}
127
// Initialize the grid entries
128
for
(std::size_t
ib
= 1
u
;
ib
< gBoundaries.size(); ++
ib
) {
129
indexedUpdator
.
grid
.
at
(
ib
) =
ib
- 1;
130
}
131
}
132
// Deleted default constructor
133
BoundVolumesGrid1Impl
() =
delete
;
134
139
inline
void
update
(
const
GeometryContext
&
gctx
,
140
NavigationState
&
nState
)
const
{
141
indexedUpdator
.
update
(gctx, nState);
142
}
143
};
144
145
}
// namespace Experimental
146
}
// namespace Acts
acts
blob
sPHENIX
Core
include
Acts
Navigation
DetectorVolumeUpdators.hpp
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:17:33
using
1.8.2 with
sPHENIX GitHub integration