Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ContinuousProcess.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file ContinuousProcess.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2018-2020 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 
13 
14 namespace ActsFatras {
15 
41 template <typename physics_t, typename input_particle_selector_t,
42  typename output_particle_selector_t,
43  typename child_particle_selector_t = output_particle_selector_t>
46  physics_t physics;
48  input_particle_selector_t selectInputParticle;
50  output_particle_selector_t selectOutputParticle;
52  child_particle_selector_t selectChildParticle;
53 
63  template <typename generator_t>
64  bool operator()(generator_t &generator, const Acts::MaterialSlab &slab,
65  Particle &particle, std::vector<Particle> &generated) const {
66  // not selecting this process is not a break condition
67  if (not selectInputParticle(particle)) {
68  return false;
69  }
70  // modify particle according to the physics process
71  auto children = physics(generator, slab, particle);
72  // move selected child particles to the output container
73  std::copy_if(std::begin(children), std::end(children),
74  std::back_inserter(generated), selectChildParticle);
75  // break condition is defined by whether the output particle is still valid
76  // or not e.g. because it has fallen below a momentum threshold.
77  return not selectOutputParticle(particle);
78  }
79 };
80 
81 } // namespace ActsFatras