trout
Phlex-based reconstruction framework for the SHiP experiment.
Loading...
Searching...
No Matches
IndexSourceLink.hpp
Go to the documentation of this file.
1// This file is part of the ACTS project.
2//
3// Copyright (C) 2016 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 https://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"
15#include "Index.hpp"
16
17#include <cassert>
18
19namespace SHiP::trout {
20
22
32class IndexSourceLink final {
33 public:
35
37 constexpr IndexSourceLink(Acts::GeometryIdentifier gid, ActsExamples::Index idx)
38 : m_geometryId(gid), m_index(idx) {}
39
40 // Construct an invalid source link. Must be default constructible to
42 IndexSourceLink() = default;
47
49 constexpr ActsExamples::Index index() const { return m_index; }
50
51 Acts::GeometryIdentifier geometryId() const { return m_geometryId; }
52
53 private:
54 Acts::GeometryIdentifier m_geometryId;
55 ActsExamples::Index m_index = 0;
56
57 friend bool operator==(const IndexSourceLink& lhs, const IndexSourceLink& rhs) {
58 return (lhs.geometryId() == rhs.geometryId()) && (lhs.m_index == rhs.m_index);
59 }
60};
61
63 const Acts::TrackingGeometry& geometry;
64
65 const Acts::Surface* operator()(const Acts::SourceLink& sourceLink) const {
66 const auto& indexSourceLink = sourceLink.get<IndexSourceLink>();
67 return geometry.findSurface(indexSourceLink.geometryId());
68 }
69};
70
77
78 using Iterator = Acts::SourceLinkAdapterIterator<BaseIterator>;
79
80 // get the range of elements with requested geoId
81 std::pair<Iterator, Iterator> range(const Acts::Surface& surface) const {
82 assert(container != nullptr);
83 auto [begin, end] = container->equal_range(surface.geometryId());
84 return {Iterator{begin}, Iterator{end}};
85 }
86};
87
88} // namespace SHiP::trout
std::uint32_t Index
Index type to reference elements in a container.
Definition Index.hpp:22
Definition fit_seed.cpp:16
The accessor for the GeometryIdMultiset container.
Definition GeometryContainers.hpp:142
typename GeometryIdMultiset< T >::const_iterator Iterator
Definition GeometryContainers.hpp:146
const Container * container
Definition GeometryContainers.hpp:149
Accessor for the above source link container.
Definition IndexSourceLink.hpp:75
Acts::SourceLinkAdapterIterator< BaseIterator > Iterator
Definition IndexSourceLink.hpp:78
ActsExamples::GeometryIdMultisetAccessor< IndexSourceLink >::Iterator BaseIterator
Definition IndexSourceLink.hpp:76
std::pair< Iterator, Iterator > range(const Acts::Surface &surface) const
Definition IndexSourceLink.hpp:81
Definition IndexSourceLink.hpp:62
const Acts::Surface * operator()(const Acts::SourceLink &sourceLink) const
Definition IndexSourceLink.hpp:65
const Acts::TrackingGeometry & geometry
Definition IndexSourceLink.hpp:63