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
IndexSourceLink.hpp
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file IndexSourceLink.hpp
1
// This file is part of the Acts project.
2
//
3
// Copyright (C) 2020 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/EventData/SourceLink.hpp
"
12
#include "
Acts/Geometry/TrackingGeometry.hpp
"
13
#include "
Acts/Surfaces/Surface.hpp
"
14
#include "
ActsExamples/EventData/GeometryContainers.hpp
"
15
#include "
ActsExamples/EventData/Index.hpp
"
16
17
#include <cassert>
18
19
namespace
ActsExamples {
20
30
class
IndexSourceLink
final {
31
public
:
33
constexpr
IndexSourceLink
(
Acts::GeometryIdentifier
gid
,
Index
idx
)
34
:
m_geometryId
(gid),
m_index
(idx) {}
35
36
// Construct an invalid source link. Must be default constructible to
38
IndexSourceLink
() =
default
;
39
IndexSourceLink
(
const
IndexSourceLink
&) =
default
;
40
IndexSourceLink
(
IndexSourceLink
&&) =
default
;
41
IndexSourceLink
&
operator=
(
const
IndexSourceLink
&) =
default
;
42
IndexSourceLink
&
operator=
(
IndexSourceLink
&&) =
default
;
43
45
constexpr
Index
index
()
const
{
return
m_index
; }
46
47
Acts::GeometryIdentifier
geometryId
()
const
{
return
m_geometryId
; }
48
49
struct
SurfaceAccessor
{
50
const
Acts::TrackingGeometry
&
trackingGeometry
;
51
52
const
Acts::Surface
*
operator()
(
const
Acts::SourceLink
& sourceLink)
const
{
53
const
auto
& indexSourceLink = sourceLink.
get
<
IndexSourceLink
>();
54
return
trackingGeometry
.
findSurface
(indexSourceLink.geometryId());
55
}
56
};
57
58
private
:
59
Acts::GeometryIdentifier
m_geometryId
;
60
Index
m_index
= 0;
61
62
friend
bool
operator==
(
const
IndexSourceLink
&
lhs
,
63
const
IndexSourceLink
&
rhs
) {
64
return
(lhs.
geometryId
() == rhs.
geometryId
()) and
65
(lhs.
m_index
== rhs.
m_index
);
66
}
67
friend
bool
operator!=
(
const
IndexSourceLink
&
lhs
,
68
const
IndexSourceLink
&
rhs
) {
69
return
not(lhs == rhs);
70
}
71
};
72
77
using
IndexSourceLinkContainer
=
GeometryIdMultiset<IndexSourceLink>
;
82
struct
IndexSourceLinkAccessor
:
GeometryIdMultisetAccessor
<IndexSourceLink> {
83
using
BaseIterator
=
GeometryIdMultisetAccessor<IndexSourceLink>::Iterator
;
84
85
using
Iterator
=
Acts::SourceLinkAdapterIterator<BaseIterator>
;
86
87
// get the range of elements with requested geoId
88
std::pair<Iterator, Iterator>
range
(
const
Acts::Surface
&
surface
)
const
{
89
assert
(
container
!=
nullptr
);
90
auto
[
begin
,
end
] =
container
->equal_range(surface.
geometryId
());
91
return
{
Iterator
{
begin
},
Iterator
{
end
}};
92
}
93
};
94
}
// namespace ActsExamples
acts
blob
sPHENIX
Examples
Framework
include
ActsExamples
EventData
IndexSourceLink.hpp
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:17:38
using
1.8.2 with
sPHENIX GitHub integration