Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:10:49

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/Definitions/TrackParametrization.hpp"
0012 #include "Acts/EventData/MultiTrajectoryBackendConcept.hpp"
0013 #include "Acts/EventData/ParticleHypothesis.hpp"
0014 #include "Acts/EventData/Types.hpp"
0015 #include "Acts/Surfaces/Surface.hpp"
0016 #include "Acts/Utilities/HashedString.hpp"
0017 
0018 #include <any>
0019 
0020 namespace Acts {
0021 
0022 namespace detail {
0023 using Parameters = Eigen::Map<BoundVector>;
0024 using Covariance = Eigen::Map<BoundMatrix>;
0025 
0026 using ConstParameters = Eigen::Map<const BoundVector>;
0027 using ConstCovariance = Eigen::Map<const BoundMatrix>;
0028 }  // namespace detail
0029 
0030 template <typename T>
0031 concept ConstTrackContainerBackend =
0032     requires(const T& cv, HashedString key, TrackIndexType itrack) {
0033       { cv.size_impl() } -> std::same_as<std::size_t>;
0034 
0035       { cv.component_impl(key, itrack) } -> std::same_as<std::any>;
0036 
0037       { cv.parameters(itrack) } -> std::same_as<detail::ConstParameters>;
0038 
0039       { cv.covariance(itrack) } -> std::same_as<detail::ConstCovariance>;
0040 
0041       { cv.hasColumn_impl(key) } -> std::same_as<bool>;
0042 
0043       { cv.referenceSurface_impl(itrack) } -> std::same_as<const Surface*>;
0044 
0045       {
0046         cv.particleHypothesis_impl(itrack)
0047       } -> std::same_as<ParticleHypothesis>;
0048 
0049       { cv.dynamicKeys_impl() };
0050       requires detail::RangeLike<decltype(cv.dynamicKeys_impl())>;
0051     };
0052 
0053 template <typename T>
0054 concept MutableTrackContainerBackend =
0055     ConstTrackContainerBackend<T> &&
0056     requires(T v, HashedString key, TrackIndexType itrack, std::string col,
0057              const T& other, std::shared_ptr<const Surface> sharedSurface) {
0058       { v.parameters(itrack) } -> std::same_as<detail::Parameters>;
0059 
0060       { v.covariance(itrack) } -> std::same_as<detail::Covariance>;
0061 
0062       { v.addTrack_impl() } -> std::same_as<TrackIndexType>;
0063 
0064       { v.removeTrack_impl(itrack) };
0065 
0066       // As far as I know there's no good way to assert that there's a
0067       // generic template function
0068       { v.template addColumn_impl<std::uint32_t>(col) };
0069       { v.template addColumn_impl<std::uint64_t>(col) };
0070       { v.template addColumn_impl<std::int32_t>(col) };
0071       { v.template addColumn_impl<std::int64_t>(col) };
0072       { v.template addColumn_impl<float>(col) };
0073       { v.template addColumn_impl<double>(col) };
0074 
0075       { v.copyDynamicFrom_impl(itrack, key, std::declval<const std::any&>()) };
0076 
0077       { v.ensureDynamicColumns_impl(other) };
0078 
0079       { v.reserve(itrack) };
0080 
0081       { v.setReferenceSurface_impl(itrack, sharedSurface) };
0082 
0083       {
0084         v.setParticleHypothesis_impl(
0085             itrack, std::declval<const Acts::ParticleHypothesis&>())
0086       };
0087 
0088       { v.clear() };
0089     };
0090 
0091 template <typename T>
0092 struct IsReadOnlyTrackContainer;
0093 
0094 template <typename T>
0095 concept TrackContainerBackend =
0096     ConstTrackContainerBackend<T> &&
0097     (IsReadOnlyTrackContainer<T>::value || MutableTrackContainerBackend<T>);
0098 }  // namespace Acts