Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
physics_list_implementation.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file physics_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
10 
11 namespace Fatras {
12 
13 namespace detail {
14 
15 namespace {
16 
17 template <typename... processes> struct physics_list_impl;
18 
21 template <typename first, typename... others>
22 struct physics_list_impl<first, others...> {
23  template <typename T, typename generator_t, typename detector_t,
24  typename particle_t>
25  static bool process(const T &process_tuple, generator_t &gen,
26  const detector_t &det, particle_t &in,
27  std::vector<particle_t> &out) {
28  // pick the first process
29  const auto &this_process = std::get<first>(process_tuple);
30  bool this_process_kills = this_process(gen, det, in, out);
31  // recursive call on the remaining ones
32  return (this_process_kills || physics_list_impl<others...>::process(
33  process_tuple, gen, det, in, out));
34  }
35 };
36 
38 template <typename last> struct physics_list_impl<last> {
39  template <typename T, typename generator_t, typename detector_t,
40  typename particle_t>
41  static bool process(const T &process_tuple, generator_t &gen,
42  const detector_t &det, particle_t &in,
43  std::vector<particle_t> &out) {
44  // this is the last process in the tuple
45  const auto &this_process = std::get<last>(process_tuple);
46  return this_process(gen, det, in, out);
47  }
48 };
49 
51 template <> struct physics_list_impl<> {
52  template <typename T, typename generator_t, typename detector_t,
53  typename particle_t>
54 
55  static bool process(const T &, generator_t &, const detector_t &,
56  const particle_t &, std::vector<particle_t> &) {
57  return false;
58  }
59 };
60 
61 } // namespace
62 
63 } // namespace detail
64 
65 } // namespace Fatras