ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
StepperConcept.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file StepperConcept.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 
18 
19 namespace Acts {
20 class Surface;
21 
22 namespace concept {
23  namespace Stepper {
24 
25  template <typename T>
26  using state_t = typename T::State;
27 
28  template <typename T>
29  using jacobian_t = typename T::Jacobian;
30  template <typename T>
31  using covariance_t = typename T::Covariance;
32  template <typename T>
33  using bound_state_t = typename T::BoundState;
34  template <typename T>
35  using curvilinear_state_t = typename T::CurvilinearState;
36  template <typename T>
37  using bfield_t = typename T::BField;
38 
39  METHOD_TRAIT(get_field_t, getField);
40  METHOD_TRAIT(position_t, position);
41  METHOD_TRAIT(direction_t, direction);
42  METHOD_TRAIT(momentum_t, momentum);
43  METHOD_TRAIT(charge_t, charge);
44  METHOD_TRAIT(time_t, time);
45  METHOD_TRAIT(overstep_t, overstepLimit);
46  METHOD_TRAIT(bound_state_method_t, boundState);
47  METHOD_TRAIT(curvilinear_state_method_t, curvilinearState);
48  METHOD_TRAIT(update_t, update);
49  METHOD_TRAIT(covariance_transport_t, covarianceTransport);
50  METHOD_TRAIT(step_t, step);
51  METHOD_TRAIT(update_surface_status_t, updateSurfaceStatus);
52  METHOD_TRAIT(set_step_size_t, setStepSize);
53  METHOD_TRAIT(release_step_size_t, releaseStepSize);
54  METHOD_TRAIT(output_step_size_t, outputStepSize);
55 
56  template <typename T>
57  using cov_transport_t = decltype(std::declval<T>().covTransport);
58  template <typename T>
59  using cov_t = decltype(std::declval<T>().cov);
60  template <typename T>
61  using nav_dir_t = decltype(std::declval<T>().navDir);
62  template <typename T>
63  using path_accumulated_t = decltype(std::declval<T>().pathAccumulated);
64  template <typename T>
65  using step_size_t = decltype(std::declval<T>().stepSize);
66 
67  // clang-format off
68  template <typename S>
69  constexpr bool StepperStateConcept
70  = require<has_member<S, cov_transport_t, bool>,
71  has_member<S, cov_t, BoundSymMatrix>,
72  has_member<S, nav_dir_t, NavigationDirection>,
73  has_member<S, path_accumulated_t, double>,
74  has_member<S, step_size_t, ConstrainedStep>
75  >;
76  // clang-format on
77 
78  // clang-format off
79  template <typename S, typename state = typename S::State>
80  struct StepperConcept {
81  constexpr static bool state_exists = exists<state_t, S>;
82  static_assert(state_exists, "State type not found");
83  constexpr static bool jacobian_exists = exists<jacobian_t, S>;
84  static_assert(jacobian_exists, "Jacobian type not found");
85  constexpr static bool covariance_exists = exists<covariance_t, S>;
86  static_assert(covariance_exists, "Covariance type not found");
87  constexpr static bool bound_state_exists = exists<bound_state_t, S>;
88  static_assert(bound_state_exists, "BoundState type not found");
89  constexpr static bool curvilinear_state_exists = exists<curvilinear_state_t, S>;
90  static_assert(curvilinear_state_exists, "CurvilinearState type not found");
91  constexpr static bool bfield_exists = exists<bfield_t, S>;
92  static_assert(bfield_exists, "BField type not found");
93  constexpr static bool get_field_exists = has_method<const S, Vector3D, get_field_t, state&, const Vector3D&>;
94  static_assert(get_field_exists, "getField method not found");
95  constexpr static bool position_exists = has_method<const S, Vector3D, position_t, const state&>;
96  static_assert(position_exists, "position method not found");
97  constexpr static bool direction_exists = has_method<const S, Vector3D, direction_t, const state&>;
98  static_assert(direction_exists, "direction method not found");
99  constexpr static bool momentum_exists = has_method<const S, double, momentum_t, const state&>;
100  static_assert(momentum_exists, "momentum method not found");
101  constexpr static bool charge_exists = has_method<const S, double, charge_t, const state&>;
102  static_assert(charge_exists, "charge method not found");
103  constexpr static bool time_exists = has_method<const S, double, time_t, const state&>;
104  static_assert(time_exists, "time method not found");
105  constexpr static bool overstep_exists = has_method<const S, double, overstep_t, const state&>;
106  static_assert(overstep_exists, "overstepLimit method not found");
107  constexpr static bool bound_state_method_exists= has_method<const S, typename S::BoundState, bound_state_method_t, state&, const Surface&>;
108  static_assert(bound_state_method_exists, "boundState method not found");
109  constexpr static bool curvilinear_state_method_exists = has_method<const S, typename S::CurvilinearState, curvilinear_state_method_t, state&>;
110  static_assert(curvilinear_state_method_exists, "curvilinearState method not found");
111  constexpr static bool update_method_exists = require<has_method<const S, void, update_t, state&, const BoundParameters&>,
112  has_method<const S, void, update_t, state&, const Vector3D&, const Vector3D&, double, double>>;
113  static_assert(update_method_exists, "update method not found");
114  constexpr static bool covariance_transport_exists = require<has_method<const S, void, covariance_transport_t, state&>,
115  has_method<const S, void, covariance_transport_t, state&, const Surface&>>;
116  static_assert(covariance_transport_exists, "covarianceTransport method not found");
117  constexpr static bool update_surface_exists = has_method<const S, Intersection::Status, update_surface_status_t, state&, const Surface&, const BoundaryCheck&>;
118  static_assert(update_surface_exists, "updateSurfaceStatus method not found");
119  constexpr static bool set_step_size_exists = has_method<const S, void, set_step_size_t, state&, double, ConstrainedStep::Type>;
120  static_assert(set_step_size_exists, "setStepSize method not found");
121  constexpr static bool release_step_size_exists = has_method<const S, void, release_step_size_t, state&>;
122  static_assert(release_step_size_exists, "releaseStepSize method not found");
123  constexpr static bool output_step_size_exists = has_method<const S, std::string, output_step_size_t, const state&>;
124  static_assert(output_step_size_exists, "outputStepSize method not found");
125 
126  constexpr static bool value = require<state_exists,
137  time_exists,
146  };
147  // clang-format on
148  } // namespace Stepper
149 } // namespace concept
150 
151 template <typename stepper, typename state = typename stepper::State>
152 constexpr bool StepperConcept =
154 template <typename stepper>
155 constexpr bool StepperStateConcept =
156  Acts::concept ::Stepper::StepperStateConcept<stepper>;
157 } // namespace Acts