Juggler
Juggling algorithms and event processing using gaudi framework
IndexSourceLink.hpp
Go to the documentation of this file.
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 
12 #include "JugReco/Index.hpp"
13 
14 #include <cassert>
15 
16 namespace Jug {
17 
18  /// A source link that stores just an index.
19  ///
20  /// This is intentionally kept as barebones as possible. The source link
21  /// is just a reference and will be copied, moved around, etc. often.
22  /// Keeping it small and separate from the actual, potentially large,
23  /// measurement data should result in better overall performance.
24  /// Using an index instead of e.g. a pointer, means source link and
25  /// measurement are decoupled and the measurement represenation can be
26  /// easily changed without having to also change the source link.
27  class IndexSourceLink final {
28  public:
29  /// Construct from geometry identifier and index.
30  constexpr IndexSourceLink(Acts::GeometryIdentifier gid, Index idx) : m_geometryId(gid), m_index(idx) {}
31 
32  // Construct an invalid source link. Must be default constructible to
33  /// satisfy SourceLinkConcept.
34  IndexSourceLink() = default;
35  IndexSourceLink(const IndexSourceLink&) = default;
39 
40  /// Access the geometry identifier.
41  constexpr Acts::GeometryIdentifier geometryId() const { return m_geometryId; }
42  /// Access the index.
43  constexpr Index index() const { return m_index; }
44 
45  public:
46  Acts::GeometryIdentifier m_geometryId;
48 
49  friend constexpr bool operator==(const IndexSourceLink& lhs, const IndexSourceLink& rhs)
50  {
51  return (lhs.m_geometryId == rhs.m_geometryId) and (lhs.m_index == rhs.m_index);
52  }
53  friend constexpr bool operator!=(const IndexSourceLink& lhs, const IndexSourceLink& rhs) { return not(lhs == rhs); }
54  };
55 
56  /// Container of index source links.
57  ///
58  /// Since the source links provide a `.geometryId()` accessor, they can be
59  /// stored in an ordered geometry container.
61 
62  /// Accessor for the above source link container
63 ///
64 /// It wraps up a few lookup methods to be used in the Combinatorial Kalman
65 /// Filter
67 
68 } // namespace Jug
Jug::GeometryIdMultiset
boost::container::flat_multiset< T, detail::CompareGeometryId > GeometryIdMultiset
Definition: GeometryContainers.hpp:71
Jug::Index
uint32_t Index
Definition: Index.hpp:21
Index.hpp
Jug
Definition: DD4hepBField.h:22
Jug::IndexSourceLinkContainer
GeometryIdMultiset< IndexSourceLink > IndexSourceLinkContainer
Definition: IndexSourceLink.hpp:60
GeometryContainers.hpp
Jug::GeometryIdMultisetAccessor
Definition: GeometryContainers.hpp:172