![]() |
|
|||
File indexing completed on 2025-09-16 08:14:04
0001 // This file is part of the ACTS project. 0002 // 0003 // Copyright (C) 2016 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 https://mozilla.org/MPL/2.0/. 0008 0009 #pragma once 0010 0011 #include "Acts/Material/MaterialSlab.hpp" 0012 #include "ActsFatras/EventData/Particle.hpp" 0013 #include "ActsFatras/Kernel/InteractionList.hpp" 0014 0015 namespace ActsFatras { 0016 0017 /// A continuous simulation process based on a physics model plus selectors. 0018 /// 0019 /// @tparam physics_t is the physics model type 0020 /// @tparam input_particle_selector_t is the input particle selector 0021 /// @tparam output_particle_selector_t is the output particle selector 0022 /// @tparam child_particle_selector_t is the child particle selector 0023 /// 0024 /// The physics model type **must** provide a call operator with the following 0025 /// signature 0026 /// 0027 /// <Particle Container> 0028 /// operator()( 0029 /// generator_t& generator, 0030 /// const Acts::MaterialSlab& slab, 0031 /// Particle& particle) const 0032 /// 0033 /// The return type can be any `Container` with `Particle` elements. 0034 /// 0035 /// The input selector defines whether the process is applied while the 0036 /// output selector defines a break condition, i.e. whether to continue 0037 /// simulating the particle propagation. The child selector is used to 0038 /// filter the generated child particles. 0039 /// 0040 /// @note The output and child particle selectors are identical unless the 0041 /// child particle selector is explicitly specified. 0042 template <detail::ContinuousProcessConcept physics_t, 0043 typename input_particle_selector_t, 0044 typename output_particle_selector_t, 0045 typename child_particle_selector_t = output_particle_selector_t> 0046 struct ContinuousProcess { 0047 /// The physics interactions implementation. 0048 physics_t physics; 0049 /// Input selection: if this process applies to this particle. 0050 input_particle_selector_t selectInputParticle; 0051 /// Output selection: if the particle is still valid after the interaction. 0052 output_particle_selector_t selectOutputParticle; 0053 /// Child selection: if a generated child particle should be kept. 0054 child_particle_selector_t selectChildParticle; 0055 0056 /// Execute the physics process considering the configured selectors. 0057 /// 0058 /// @param[in] generator is the random number generator 0059 /// @param[in] slab is the passed material 0060 /// @param[in,out] particle is the particle being updated 0061 /// @param[out] generated is the container of generated particles 0062 /// @return Break condition, i.e. whether this process stops the propagation 0063 /// 0064 /// @tparam generator_t must be a RandomNumberEngine 0065 template <typename generator_t> 0066 bool operator()(generator_t &generator, const Acts::MaterialSlab &slab, 0067 Particle &particle, std::vector<Particle> &generated) const { 0068 // not selecting this process is not a break condition 0069 if (!selectInputParticle(particle)) { 0070 return false; 0071 } 0072 // modify particle according to the physics process 0073 auto children = physics(generator, slab, particle); 0074 // move selected child particles to the output container 0075 std::copy_if(std::begin(children), std::end(children), 0076 std::back_inserter(generated), selectChildParticle); 0077 // break condition is defined by whether the output particle is still valid 0078 // or not e.g. because it has fallen below a momentum threshold. 0079 return !selectOutputParticle(particle); 0080 } 0081 }; 0082 0083 } // namespace ActsFatras
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |