Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:09:08

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 2018 CERN for the benefit of the Acts project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 #include "Acts/Utilities/detail/Extendable.hpp"
0012 #include "Acts/Utilities/detail/MPL/all_of.hpp"
0013 #include "Acts/Utilities/detail/MPL/has_duplicates.hpp"
0014 #include "Acts/Utilities/detail/MPL/type_collector.hpp"
0015 #include "Fatras/Kernel/detail/selector_list_implementation.hpp"
0016 #include "Fatras/Kernel/detail/selector_signature_check.hpp"
0017 
0018 namespace Fatras {
0019 
0020 /// @brief This is the SelectorList struct that is used for fast simulation
0021 ///
0022 /// Users can add a variable list of selectors in order to drive the
0023 /// physics simulation. Selectors can access particle information and
0024 /// detector information to decide whether a process is to take place
0025 template <bool inclusive, typename... selectors>
0026 struct SelectorListAXOR : private Acts::detail::Extendable<selectors...> {
0027 private:
0028   static_assert(not Acts::detail::has_duplicates_v<selectors...>,
0029                 "same selector type specified several times");
0030 
0031   using Acts::detail::Extendable<selectors...>::tuple;
0032 
0033 public:
0034   using Acts::detail::Extendable<selectors...>::get;
0035 
0036   /// Call operator that is that broadcasts the call to the tuple()
0037   ///
0038   /// @tparam detector_t is the detector type used in simulation
0039   /// @tparam particle_t is the particle type used in simulation
0040   /// @tparam inclusive steers || (true) or && (false) combination
0041   ///
0042   /// @param[in] detector the current detector/material information
0043   /// @param[in] particle to be checked for further processing
0044   ///
0045   /// @return indicator if the particle is accepted
0046   template <typename detector_t, typename particle_t>
0047   bool operator()(const detector_t &detector,
0048                   const particle_t &particle) const {
0049     // clang-format off
0050     static_assert(Acts::detail::all_of_v<detail::selector_list_signature_check_v<selectors, detector_t, particle_t>...>,
0051                   "not all particle selectors support the specified interface");
0052     // clang-format on
0053 
0054     // create an emtpy particle vector
0055     typedef detail::selector_list_impl<selectors...> impl;
0056     return impl::select(tuple(), detector, particle, inclusive);
0057   }
0058 };
0059 
0060 template <typename... selectors>
0061 using SelectorListOR = SelectorListAXOR<true, selectors...>;
0062 
0063 template <typename... selectors>
0064 using SelectorListAND = SelectorListAXOR<false, selectors...>;
0065 
0066 } // namespace Fatras