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/physics_list_implementation.hpp"
0016 #include "Fatras/Kernel/detail/process_signature_check.hpp"
0017 
0018 namespace Fatras {
0019 
0020 /// This is the PhysicsList struct that is used for fast simulation
0021 ///
0022 /// Users can add a variable list of processes in order to drive the
0023 /// physics simulation
0024 ///
0025 /// The dependency on generator, detector and particle are templated
0026 template <typename... processes>
0027 struct PhysicsList : private Acts::detail::Extendable<processes...> {
0028 private:
0029   using Acts::detail::Extendable<processes...>::tuple;
0030 
0031 public:
0032   using Acts::detail::Extendable<processes...>::get;
0033 
0034   /// Call operator that broadcasts the call to the tuple()
0035   /// members of the list
0036   ///
0037   /// @tparam generator_t is the random number generator type
0038   /// @tparam detector_t is the detector information type used
0039   /// @tparam particle_t is the particle type used in simulation
0040   ///
0041   /// @param[in] gen is the generator object
0042   /// @param[in] det is the necessary detector information
0043   /// @param[in] in is the ingoing particle (can be modified)
0044   /// @param[in,out] out are the (eventually) outgoing particles
0045   ///
0046   /// @return indicator which would trigger an abort
0047   template <typename generator_t, typename detector_t, typename particle_t>
0048   bool operator()(generator_t &gen, const detector_t &det, particle_t &in,
0049                   std::vector<particle_t> &out) const {
0050     // clang-format off
0051     static_assert(Acts::detail::all_of_v<detail::process_signature_check_v<processes, generator_t, detector_t, particle_t>...>,
0052                   "not all processes support the specified interface");
0053     // clang-format on
0054 
0055     // create an emtpy particle vector
0056     typedef detail::physics_list_impl<processes...> impl;
0057     return impl::process(tuple(), gen, det, in, out);
0058   }
0059 };
0060 
0061 } // namespace Fatras