Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-12 08:18:52

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/Algebra.hpp"
0012 #include "Acts/Definitions/TrackParametrization.hpp"
0013 #include "Acts/EventData/SourceLink.hpp"
0014 #include "Acts/EventData/TrackStatePropMask.hpp"
0015 #include "Acts/EventData/Types.hpp"
0016 #include "Acts/Surfaces/Surface.hpp"
0017 #include "Acts/Utilities/HashedString.hpp"
0018 
0019 #include <any>
0020 
0021 namespace Acts {
0022 
0023 namespace detail {
0024 
0025 using Parameters = Eigen::Map<BoundVector>;
0026 using Covariance = Eigen::Map<BoundMatrix>;
0027 
0028 using ConstParameters = Eigen::Map<const BoundVector>;
0029 using ConstCovariance = Eigen::Map<const BoundMatrix>;
0030 
0031 template <typename R>
0032 concept RangeLike = requires(R r) {
0033   { r.begin() };
0034   { r.end() };
0035 
0036   requires std::forward_iterator<decltype(r.begin())>;
0037   requires std::forward_iterator<decltype(r.end())>;
0038 };
0039 
0040 }  // namespace detail
0041 
0042 template <typename T>
0043 concept CommonMultiTrajectoryBackend =
0044     requires(const T& cv, HashedString key, TrackIndexType istate) {
0045       { cv.calibratedSize_impl(istate) } -> std::same_as<TrackIndexType>;
0046 
0047       { cv.getUncalibratedSourceLink_impl(istate) } -> std::same_as<SourceLink>;
0048 
0049       { cv.referenceSurface_impl(istate) } -> std::same_as<const Surface*>;
0050 
0051       { cv.jacobian_impl(istate) } -> std::same_as<detail::ConstCovariance>;
0052 
0053       { cv.has_impl(key, istate) } -> std::same_as<bool>;
0054 
0055       { cv.size_impl() } -> std::same_as<TrackIndexType>;
0056 
0057       { cv.component_impl(key, istate) } -> std::same_as<std::any>;
0058 
0059       { cv.hasColumn_impl(key) } -> std::same_as<bool>;
0060 
0061       { cv.dynamicKeys_impl() };
0062       requires detail::RangeLike<decltype(cv.dynamicKeys_impl())>;
0063     };
0064 
0065 template <typename T>
0066 concept ConstMultiTrajectoryBackend =
0067     CommonMultiTrajectoryBackend<T> &&
0068     requires(T v, HashedString key, TrackIndexType istate) {
0069       { v.parameters_impl(istate) } -> std::same_as<detail::ConstParameters>;
0070 
0071       { v.covariance_impl(istate) } -> std::same_as<detail::ConstCovariance>;
0072 
0073       { v.jacobian_impl(istate) } -> std::same_as<detail::ConstCovariance>;
0074 
0075       {
0076         v.template calibrated_impl<2>(istate)
0077       } -> std::same_as<Eigen::Map<const Vector2>>;
0078 
0079       {
0080         v.template calibratedCovariance_impl<2>(istate)
0081       } -> std::same_as<Eigen::Map<const SquareMatrix<2>>>;
0082     };
0083 
0084 template <typename T>
0085 concept MutableMultiTrajectoryBackend =
0086     CommonMultiTrajectoryBackend<T> &&
0087     requires(T v, HashedString key, TrackIndexType istate,
0088              TrackStatePropMask mask, std::string col, std::size_t dim,
0089              SourceLink sl, std::shared_ptr<const Surface> surface) {
0090       { v.parameters_impl(istate) } -> std::same_as<detail::Parameters>;
0091 
0092       { v.covariance_impl(istate) } -> std::same_as<detail::Covariance>;
0093 
0094       { v.jacobian_impl(istate) } -> std::same_as<detail::Covariance>;
0095 
0096       {
0097         v.template calibrated_impl<2>(istate)
0098       } -> std::same_as<Eigen::Map<Vector2>>;
0099 
0100       {
0101         v.template calibratedCovariance_impl<2>(istate)
0102       } -> std::same_as<Eigen::Map<SquareMatrix<2>>>;
0103 
0104       { v.addTrackState_impl() } -> std::same_as<TrackIndexType>;
0105 
0106       { v.addTrackStateComponents_impl(istate, mask) };
0107 
0108       { v.shareFrom_impl(istate, istate, mask, mask) };
0109 
0110       { v.unset_impl(mask, istate) };
0111 
0112       { v.clear_impl() };
0113 
0114       // As far as I know there's no good way to assert that there's a generic
0115       // template function
0116       { v.template addColumn_impl<std::uint32_t>(col) };
0117       { v.template addColumn_impl<std::uint64_t>(col) };
0118       { v.template addColumn_impl<std::int32_t>(col) };
0119       { v.template addColumn_impl<std::int64_t>(col) };
0120       { v.template addColumn_impl<float>(col) };
0121       { v.template addColumn_impl<double>(col) };
0122 
0123       { v.allocateCalibrated_impl(istate, Vector<1>{}, SquareMatrix<1>{}) };
0124       // Assuming intermediate values also work
0125       {
0126         v.allocateCalibrated_impl(istate, Vector<eBoundSize>{},
0127                                   SquareMatrix<eBoundSize>{})
0128       };
0129 
0130       { v.setUncalibratedSourceLink_impl(istate, std::move(sl)) };
0131 
0132       { v.setReferenceSurface_impl(istate, surface) };
0133 
0134       { v.copyDynamicFrom_impl(istate, key, std::declval<const std::any&>()) };
0135     };
0136 }  // namespace Acts