Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /acts/Examples/Framework/include/ActsExamples/EventData/IndexSourceLink.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 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 https://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 #include "Acts/EventData/SourceLink.hpp"
0012 #include "ActsExamples/EventData/GeometryContainers.hpp"
0013 #include "ActsExamples/EventData/Index.hpp"
0014 
0015 #include <utility>
0016 
0017 namespace Acts {
0018 class Surface;
0019 class TrackingGeometry;
0020 }  // namespace Acts
0021 
0022 namespace ActsExamples {
0023 
0024 struct IndexSourceLinkSurfaceAccessor;
0025 
0026 /// A source link that stores just an index.
0027 ///
0028 /// This is intentionally kept as barebones as possible. The source link
0029 /// is just a reference and will be copied, moved around, etc. often.
0030 /// Keeping it small and separate from the actual, potentially large,
0031 /// measurement data should result in better overall performance.
0032 /// Using an index instead of e.g. a pointer, means source link and
0033 /// measurement are decoupled and the measurement representation can be
0034 /// easily changed without having to also change the source link.
0035 class IndexSourceLink final {
0036  public:
0037   using SurfaceAccessor = IndexSourceLinkSurfaceAccessor;
0038 
0039   /// Construct from geometry identifier and index.
0040   constexpr IndexSourceLink(Acts::GeometryIdentifier gid, Index idx)
0041       : m_geometryId(gid), m_index(idx) {}
0042 
0043   // Construct an invalid source link. Must be default constructible to
0044   /// satisfy SourceLinkConcept.
0045   IndexSourceLink() = default;
0046   IndexSourceLink(const IndexSourceLink&) = default;
0047   IndexSourceLink(IndexSourceLink&&) = default;
0048   IndexSourceLink& operator=(const IndexSourceLink&) = default;
0049   IndexSourceLink& operator=(IndexSourceLink&&) = default;
0050 
0051   /// Access the index.
0052   constexpr Index index() const { return m_index; }
0053 
0054   Acts::GeometryIdentifier geometryId() const { return m_geometryId; }
0055 
0056  private:
0057   Acts::GeometryIdentifier m_geometryId;
0058   Index m_index = 0;
0059 
0060   friend bool operator==(const IndexSourceLink& lhs,
0061                          const IndexSourceLink& rhs) {
0062     return (lhs.geometryId() == rhs.geometryId()) &&
0063            (lhs.m_index == rhs.m_index);
0064   }
0065 };
0066 
0067 struct IndexSourceLinkSurfaceAccessor {
0068   const Acts::TrackingGeometry& geometry;
0069 
0070   // Out of line so this header does not need the TrackingGeometry/Surface
0071   // definitions, which are expensive to compile and not needed by most users.
0072   const Acts::Surface* operator()(const Acts::SourceLink& sourceLink) const;
0073 };
0074 
0075 /// Accessor for the above source link container
0076 ///
0077 /// It wraps up a few lookup methods to be used in the Combinatorial Kalman
0078 /// Filter
0079 struct IndexSourceLinkAccessor : GeometryIdMultisetAccessor<IndexSourceLink> {
0080   using BaseIterator = GeometryIdMultisetAccessor<IndexSourceLink>::Iterator;
0081 
0082   using Iterator = Acts::SourceLinkAdapterIterator<BaseIterator>;
0083 
0084   // get the range of elements with requested geoId
0085   std::pair<Iterator, Iterator> range(const Acts::Surface& surface) const;
0086 };
0087 
0088 }  // namespace ActsExamples