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
Neighbour.hpp
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file Neighbour.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
11
#include "
Acts/Seeding/SpacePointGrid.hpp
"
12
13
namespace
Acts {
14
29
30
template
<
typename
external_spacepo
int
_t>
31
struct
Neighbour
{
33
Neighbour
() =
delete
;
34
39
Neighbour
(
Acts::SpacePointGrid<external_spacepoint_t>
&&
grid
, std::size_t
idx
,
40
const
float
lowerBound) =
delete
;
41
46
Neighbour
(
const
Acts::SpacePointGrid<external_spacepoint_t>
&
grid
,
47
std::size_t idx,
const
float
lowerBound);
48
50
std::size_t
index
;
53
typename
Acts::SpacePointGrid
<
54
external_spacepoint_t>::value_type::const_iterator
itr
;
55
};
56
57
template
<
typename
external_spacepo
int
_t>
58
Neighbour<external_spacepoint_t>::Neighbour
(
59
const
Acts::SpacePointGrid<external_spacepoint_t>
&
grid
, std::size_t
idx
,
60
const
float
lowerBound)
61
:
index
(idx) {
63
const
auto
& collection = grid.
at
(idx);
66
if
(collection.size() == 0) {
67
itr
= collection.begin();
68
return
;
69
}
70
73
if
(collection.front()->radius() > lowerBound) {
74
itr
= collection.begin();
75
}
80
else
if
(collection.back()->radius() < lowerBound) {
81
itr
= collection.end();
82
}
85
else
{
86
itr
= std::lower_bound(collection.begin(), collection.end(), lowerBound,
87
[](
const
auto
& sp,
const
float
target
) ->
bool
{
88
return
sp->radius() <
target
;
89
});
90
}
91
}
92
93
}
// namespace Acts
acts
blob
sPHENIX
Core
include
Acts
Seeding
Neighbour.hpp
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:17:34
using
1.8.2 with
sPHENIX GitHub integration