Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-11-15 10:02:37

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 2020 CERN for the benefit of the Acts project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 #include "JugReco/GeometryContainers.hpp"
0012 #include "JugReco/Index.hpp"
0013 
0014 #include <cassert>
0015 
0016 namespace Jug {
0017 
0018   /// A source link that stores just an index.
0019   ///
0020   /// This is intentionally kept as barebones as possible. The source link
0021   /// is just a reference and will be copied, moved around, etc. often.
0022   /// Keeping it small and separate from the actual, potentially large,
0023   /// measurement data should result in better overall performance.
0024   /// Using an index instead of e.g. a pointer, means source link and
0025   /// measurement are decoupled and the measurement represenation can be
0026   /// easily changed without having to also change the source link.
0027   class IndexSourceLink final {
0028   public:
0029     /// Construct from geometry identifier and index.
0030     constexpr IndexSourceLink(Acts::GeometryIdentifier gid, Index idx) : m_geometryId(gid), m_index(idx) {}
0031 
0032     // Construct an invalid source link. Must be default constructible to
0033     /// satisfy SourceLinkConcept.
0034     IndexSourceLink()                       = default;
0035     IndexSourceLink(const IndexSourceLink&) = default;
0036     IndexSourceLink(IndexSourceLink&&)      = default;
0037     IndexSourceLink& operator=(const IndexSourceLink&) = default;
0038     IndexSourceLink& operator=(IndexSourceLink&&) = default;
0039 
0040     /// Access the geometry identifier.
0041     constexpr Acts::GeometryIdentifier geometryId() const { return m_geometryId; }
0042     /// Access the index.
0043     constexpr Index index() const { return m_index; }
0044 
0045   public:
0046     Acts::GeometryIdentifier m_geometryId;
0047     Index                    m_index;
0048 
0049     friend constexpr bool operator==(const IndexSourceLink& lhs, const IndexSourceLink& rhs)
0050     {
0051       return (lhs.m_geometryId == rhs.m_geometryId) and (lhs.m_index == rhs.m_index);
0052     }
0053     friend constexpr bool operator!=(const IndexSourceLink& lhs, const IndexSourceLink& rhs) { return not(lhs == rhs); }
0054   };
0055 
0056   /// Container of index source links.
0057   ///
0058   /// Since the source links provide a `.geometryId()` accessor, they can be
0059   /// stored in an ordered geometry container.
0060   using IndexSourceLinkContainer = GeometryIdMultiset<IndexSourceLink>;
0061 
0062   /// Accessor for the above source link container
0063///
0064/// It wraps up a few lookup methods to be used in the Combinatorial Kalman
0065/// Filter
0066   using IndexSourceLinkAccessor = GeometryIdMultisetAccessor<IndexSourceLink>;
0067 
0068 } // namespace Jug