Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-22 09:19:36

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/ParticleHypothesis.hpp"
0013 #include "Acts/EventData/Types.hpp"
0014 #include "Acts/Surfaces/Surface.hpp"
0015 #include "Acts/Utilities/HashedString.hpp"
0016 
0017 #include <concepts>
0018 
0019 namespace Acts {
0020 
0021 namespace detail_tpc {
0022 using ParametersMap = Eigen::Map<BoundVector>;
0023 using ConstParametersMap = Eigen::Map<const BoundVector>;
0024 using CovarianceMap = Eigen::Map<BoundSquareMatrix>;
0025 using ConstCovarianceMap = Eigen::Map<const BoundSquareMatrix>;
0026 
0027 constexpr HashedString kConceptKey = hashString("TrackProxyConceptKey");
0028 }  // namespace detail_tpc
0029 
0030 template <typename T>
0031 concept TrackProxyConcept = requires(const T& cv, HashedString key) {
0032   { T::ReadOnly } -> std::same_as<const bool&>;
0033 
0034   { cv.index() } -> std::same_as<TrackIndexType>;
0035   { cv.tipIndex() } -> std::convertible_to<TrackIndexType>;
0036   { cv.stemIndex() } -> std::convertible_to<TrackIndexType>;
0037 
0038   { cv.referenceSurface() } -> std::same_as<const Surface&>;
0039   { cv.hasReferenceSurface() } -> std::same_as<bool>;
0040 
0041   { cv.parameters() } -> std::same_as<detail_tpc::ConstParametersMap>;
0042   { cv.covariance() } -> std::same_as<detail_tpc::ConstCovarianceMap>;
0043 
0044   { cv.particleHypothesis() } -> std::same_as<ParticleHypothesis>;
0045 
0046   { cv.theta() } -> std::same_as<double>;
0047   { cv.phi() } -> std::same_as<double>;
0048   { cv.qOverP() } -> std::same_as<double>;
0049   { cv.absoluteMomentum() } -> std::same_as<double>;
0050   { cv.transverseMomentum() } -> std::same_as<double>;
0051   { cv.charge() } -> std::same_as<double>;
0052 
0053   { cv.nMeasurements() } -> std::convertible_to<unsigned int>;
0054   { cv.nHoles() } -> std::convertible_to<unsigned int>;
0055   { cv.nOutliers() } -> std::convertible_to<unsigned int>;
0056   { cv.nSharedHits() } -> std::convertible_to<unsigned int>;
0057   { cv.chi2() } -> std::convertible_to<float>;
0058   { cv.nDoF() } -> std::convertible_to<unsigned int>;
0059 
0060   { cv.nTrackStates() } -> std::same_as<unsigned int>;
0061 
0062   { cv.hasColumn(key) } -> std::same_as<bool>;
0063   { cv.hasColumn(detail_tpc::kConceptKey) } -> std::same_as<bool>;
0064 
0065   { cv.template component<int>(key) } -> std::same_as<const int&>;
0066   {
0067     cv.template component<int, detail_tpc::kConceptKey>()
0068   } -> std::same_as<const int&>;
0069 };
0070 
0071 template <typename T>
0072 concept ConstTrackProxyConcept = TrackProxyConcept<T>;
0073 
0074 template <typename T>
0075 concept MutableTrackProxyConcept =
0076     TrackProxyConcept<T> && requires(T v, HashedString key) {
0077       { v.tipIndex() } -> std::same_as<TrackIndexType&>;
0078       { v.stemIndex() } -> std::same_as<TrackIndexType&>;
0079 
0080       { v.parameters() } -> std::same_as<detail_tpc::ParametersMap>;
0081       { v.covariance() } -> std::same_as<detail_tpc::CovarianceMap>;
0082 
0083       { v.nMeasurements() } -> std::same_as<unsigned int&>;
0084       { v.nHoles() } -> std::same_as<unsigned int&>;
0085       { v.nOutliers() } -> std::same_as<unsigned int&>;
0086       { v.nSharedHits() } -> std::same_as<unsigned int&>;
0087       { v.chi2() } -> std::same_as<float&>;
0088       { v.nDoF() } -> std::same_as<unsigned int&>;
0089 
0090       { v.template component<int>(key) } -> std::same_as<int&>;
0091       {
0092         v.template component<int, detail_tpc::kConceptKey>()
0093       } -> std::same_as<int&>;
0094     };
0095 
0096 }  // namespace Acts