ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
stepper_extension_list_implementation.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file stepper_extension_list_implementation.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2018 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
11 
31 
32 namespace Acts {
33 namespace detail {
35 template <unsigned int N>
37 
42 template <unsigned int N>
44  template <typename propagator_state_t, typename stepper_t, typename... T>
45  static void bid(const std::tuple<T...>& obs_tuple,
46  const propagator_state_t& state, const stepper_t& stepper,
47  std::array<int, sizeof...(T)>& bids) {
48  std::get<N - 1>(bids) = std::get<N - 1>(obs_tuple).bid(state, stepper);
49  stepper_extension_list_impl<N - 1>::bid(obs_tuple, state, stepper, bids);
50  }
51 
55  template <typename propagator_state_t, typename stepper_t, typename... T>
56  static bool k(std::tuple<T...>& obs_tuple, const propagator_state_t& state,
57  const stepper_t& stepper, Vector3D& knew,
58  const Vector3D& bField, std::array<double, 4>& kQoP,
59  const std::array<bool, sizeof...(T)>& validExtensions,
60  const int i = 0, const double h = 0,
61  const Vector3D& kprev = Vector3D()) {
62  // If element is invalid: continue
63  if (!std::get<N - 1>(validExtensions)) {
65  obs_tuple, state, stepper, knew, bField, kQoP, validExtensions, i, h,
66  kprev);
67  }
68 
69  // Continue as long as evaluations are 'true'
70  if (std::get<N - 1>(obs_tuple).k(state, stepper, knew, bField, kQoP, i, h,
71  kprev)) {
73  obs_tuple, state, stepper, knew, bField, kQoP, validExtensions, i, h,
74  kprev);
75  } else {
76  // Break at false
77  return false;
78  }
79  }
80 
84  template <typename propagator_state_t, typename stepper_t, typename... T>
85  static bool finalize(const std::tuple<T...>& obs_tuple,
86  propagator_state_t& state, const stepper_t& stepper,
87  const double h, FreeMatrix& D,
88  const std::array<bool, sizeof...(T)>& validExtensions) {
89  // If element is invalid: continue
90  if (!std::get<N - 1>(validExtensions)) {
92  obs_tuple, state, stepper, h, D, validExtensions);
93  }
94 
95  // Continue as long as evaluations are 'true'
96  if (std::get<N - 1>(obs_tuple).finalize(state, stepper, h, D)) {
98  obs_tuple, state, stepper, h, D, validExtensions);
99  } else {
100  // Break at false
101  return false;
102  }
103  }
104 
108  template <typename propagator_state_t, typename stepper_t, typename... T>
109  static bool finalize(const std::tuple<T...>& obs_tuple,
110  propagator_state_t& state, const stepper_t& stepper,
111  const double h,
112  const std::array<bool, sizeof...(T)>& validExtensions) {
113  // If element is invalid: continue
114  if (!std::get<N - 1>(validExtensions)) {
116  obs_tuple, state, stepper, h, validExtensions);
117  }
118 
119  // Continue as long as evaluations are 'true'
120  if (std::get<N - 1>(obs_tuple).finalize(state, stepper, h)) {
122  obs_tuple, state, stepper, h, validExtensions);
123  } else {
124  // Break at false
125  return false;
126  }
127  }
128 };
129 
131 template <>
134  template <typename propagator_state_t, typename stepper_t, typename... T>
135  static void bid(const std::tuple<T...>& /*unused*/,
136  const propagator_state_t& /*unused*/,
137  const stepper_t& /*unused*/,
138  std::array<int, sizeof...(T)>& /*unused*/) {}
139 
141  template <typename propagator_state_t, typename stepper_t, typename... T>
142  static bool k(std::tuple<T...>& /*unused*/,
143  const propagator_state_t& /*unused*/,
144  const stepper_t& /*unused*/, Vector3D& /*unused*/,
145  const Vector3D& /*unused*/, std::array<double, 4>& /*unused*/,
146  const std::array<bool, sizeof...(T)>& /*unused*/,
147  const int /*unused*/, const double /*unused*/,
148  const Vector3D& /*unused*/) {
149  return true;
150  }
151 
153  template <typename propagator_state_t, typename stepper_t, typename... T>
154  static bool finalize(const std::tuple<T...>& /*unused*/,
155  propagator_state_t& /*unused*/,
156  const stepper_t& /*unused*/, const double /*unused*/,
157  FreeMatrix& /*unused*/,
158  const std::array<bool, sizeof...(T)>& /*unused*/) {
159  return true;
160  }
161 
163  template <typename propagator_state_t, typename stepper_t, typename... T>
164  static bool finalize(const std::tuple<T...>& /*unused*/,
165  propagator_state_t& /*unused*/,
166  const stepper_t& /*unused*/, const double /*unused*/,
167  const std::array<bool, sizeof...(T)>& /*unused*/) {
168  return true;
169  }
170 };
171 
172 } // namespace detail
173 } // namespace Acts