![]() |
|
|||
File indexing completed on 2025-09-17 08:03:24
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 #include <limits> 0016 0017 namespace ActsFatras { 0018 0019 /// A point like simulation process based on a physics model plus selectors. 0020 /// 0021 /// @tparam physics_t is the physics model type 0022 /// @tparam input_particle_selector_t is the input particle selector 0023 /// @tparam output_particle_selector_t is the output particle selector 0024 /// @tparam child_particle_selector_t is the child particle selector 0025 /// 0026 /// The physics model type **must** provide a call operator with the following 0027 /// two member functions 0028 /// 0029 /// // generate X0/L0 limits 0030 /// template <typename generator_t> 0031 /// std::pair<Scalar, Scalar> 0032 /// generatePathLimits( 0033 /// generator& rng, 0034 /// const Particle& particle) const 0035 /// 0036 /// // run the process simulation 0037 /// template <typename generator_t> 0038 /// bool 0039 /// run( 0040 /// generator_t& rng, 0041 /// Particle& particle, 0042 /// std::vector<Particle>& generatedParticles) const 0043 /// 0044 /// The return type of generatePathLimits() can be any `Container` with 0045 /// `Particle` elements. 0046 /// 0047 /// The input selector defines whether the process is applied while the 0048 /// output selector defines a break condition, i.e. whether to continue 0049 /// simulating the particle propagation. The child selector is used to 0050 /// filter the generated child particles. 0051 /// 0052 /// @note The output and child particle selectors are identical unless the 0053 /// child particle selector is explicitly specified. 0054 template <detail::PointLikeProcessConcept physics_t, 0055 typename input_particle_selector_t, 0056 typename output_particle_selector_t, 0057 typename child_particle_selector_t = output_particle_selector_t> 0058 struct PointLikeProcess { 0059 /// The physics interactions implementation. 0060 physics_t physics; 0061 /// Input selection: if this process applies to this particle. 0062 input_particle_selector_t selectInputParticle; 0063 /// Output selection: if the particle is still valid after the interaction. 0064 output_particle_selector_t selectOutputParticle; 0065 /// Child selection: if a generated child particle should be kept. 0066 child_particle_selector_t selectChildParticle; 0067 0068 template <class generator_t> 0069 std::pair<double, double> generatePathLimits(generator_t& generator, 0070 const Particle& particle) const { 0071 return physics.generatePathLimits(generator, particle); 0072 } 0073 0074 template <class generator_t> 0075 bool run(generator_t& rng, Particle& particle, 0076 std::vector<Particle>& generatedParticles) const { 0077 if (!selectInputParticle(particle)) { 0078 return false; 0079 } 0080 0081 std::vector<Particle> children; 0082 physics.run(rng, particle, children); 0083 0084 std::copy_if(std::begin(children), std::end(children), 0085 std::back_inserter(generatedParticles), selectChildParticle); 0086 0087 return !selectOutputParticle(particle); 0088 } 0089 }; 0090 0091 } // 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 |
![]() ![]() |