ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MeasurementHelpers.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file MeasurementHelpers.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2019 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9 #pragma once
12 
13 #include <variant>
14 
15 namespace Acts {
16 
17 class Surface;
18 
19 namespace MeasurementHelpers {
20 
24 template <typename T>
25 const Surface* getSurface(const T& fittable_measurement) {
26  return std::visit([](const auto& meas) { return &meas.referenceSurface(); },
27  fittable_measurement);
28 }
29 
30 template <typename T>
31 size_t getSize(const T& fittable_measurement) {
32  return std::visit([](const auto& meas) { return meas.size(); },
33  fittable_measurement);
34 }
35 } // namespace MeasurementHelpers
36 
39 
40  bool operator==(const MinimalSourceLink& rhs) const {
41  return meas == rhs.meas;
42  }
43 
44  const Surface& referenceSurface() const {
46  }
47 
49  return *meas;
50  }
51 };
52 
53 inline std::ostream& operator<<(std::ostream& os, const MinimalSourceLink& sl) {
54  os << "SourceLink(" << sl.meas << ")";
55  return os;
56 }
57 
58 static_assert(SourceLinkConcept<MinimalSourceLink>,
59  "MinimalSourceLink does not fulfill SourceLinkConcept");
60 
61 namespace detail {
62 
66 template <size_t I>
78  template <typename L, typename A, typename B>
79  auto static constexpr invoke(A&& param, B&& cov, L&& lambda) {
80  return lambda(param.template head<I>(), cov.template topLeftCorner<I, I>());
81  }
82 };
83 } // namespace detail
84 
98 template <typename L, typename A, typename B>
99 auto visit_measurement(A&& param, B&& cov, size_t dim, L&& lambda) {
101  eBoundParametersSize>(dim, param, cov, lambda);
102 }
103 
104 } // namespace Acts