ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ParameterConcept.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file ParameterConcept.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
10 
13 
14 namespace Acts {
15 class Surface;
16 
17 namespace concept {
18  namespace Parameter {
19 
21  template <typename T>
22  using covmat_t = typename T::CovMatrix_t;
23 
25  METHOD_TRAIT(reference_surface_t, referenceSurface);
26 
27  template <typename T>
28  using position_returntype_t = decltype(std::declval<T>().position());
29  template <typename T>
30  using momentum_returntype_t = decltype(std::declval<T>().momentum());
31  template <typename T>
32  using charge_returntype_t = decltype(std::declval<T>().charge());
33  template <typename T>
34  using time_returntype_t = decltype(std::declval<T>().time());
35  template <typename T>
36  using covariance_returntype_t = decltype(std::declval<T>().covariance());
37  template <typename T>
38  using parameters_returntype_t = decltype(std::declval<T>().parameters());
39 
41  METHOD_TRAIT(position_t, position);
42  METHOD_TRAIT(momentum_t, momentum);
43  METHOD_TRAIT(charge_t, charge);
44  METHOD_TRAIT(timet, time);
45  METHOD_TRAIT(covariance_t, covariance);
46  METHOD_TRAIT(parameters_t, parameters);
47 
48  template <typename P>
51  constexpr static bool covmat_exists = exists<covmat_t, const P>;
52  static_assert(covmat_exists, "Covariance matrix type not found");
53 
55  constexpr static bool reference_surface_exists =
56  has_method<const P, const Surface&, reference_surface_t>;
57  constexpr static bool surfacebound_position_exists =
58  identical_to<Vector3D, position_returntype_t, const P>;
59  constexpr static bool surfacebound_momentum_exists =
60  identical_to<Vector3D, momentum_returntype_t, const P>;
61  constexpr static bool surfacebound_charge_exists =
62  identical_to<double, charge_returntype_t, const P>;
63  constexpr static bool surfacebound_time_exists =
64  identical_to<double, time_returntype_t, const P>;
65  constexpr static bool surfacebound_covariance_exists =
66  identical_to<const std::optional<BoundSymMatrix>&,
67  covariance_returntype_t, const P>;
68  constexpr static bool surfacebound_parameters_exists =
69  identical_to<BoundVector, parameters_returntype_t, const P>;
70 
72  constexpr static bool boundValue =
77 
79  constexpr static bool free_position_exists =
80  has_method<const P, Vector3D, position_t>;
81  constexpr static bool free_momentum_exists =
82  has_method<const P, Vector3D, momentum_t>;
83  constexpr static bool free_charge_exists =
84  has_method<const P, double, charge_t>;
85  constexpr static bool free_time_exists = has_method<const P, double, timet>;
86  constexpr static bool free_covariance_exists =
87  has_method<const P, const std::optional<FreeSymMatrix>&, covariance_t>;
88  constexpr static bool free_parameters_exists =
89  has_method<const P, FreeVector, parameters_t>;
90 
92  constexpr static bool freeValue =
96 
98  // TODO: The surface getter should be tested but would be useless in this
99  // construction static_assert(reference_surface_exists, "referenceSurface
100  // method not found");
102  "position method not found");
104  "momentum method not found");
106  "charge method not found");
108  "time method not found");
110  "covariance method not found");
112  "parameters method not found");
113 
115  constexpr static bool value =
116  require<covmat_exists, either<boundValue, freeValue>>;
117  };
118  } // namespace Parameter
119 } // namespace concept
120 
121 template <typename parameters_t>
122 constexpr bool ParameterConcept =
124 } // namespace Acts