Skip to content

Commit

Permalink
refactor(Fatras): Merge continuous and point-like physics lists (#719)
Browse files Browse the repository at this point in the history
Merge the two separate Fatras physics lists types for continuous and point-like interactions into a single type `InteractionList`. The new type is still a dumb container that splits the configured interaction processes into the two possible types internally at compile-time. It provides the same interfaces as the two previously separate physics lists but simplifies handling and configuration by reducing the moving parts in the code. The main interaction logic is still implemented in the simulation actor, but could be moved to the new interaction list in a future PR.

- The new type is named `InteractionList` to clarify that it only supports physics processes for interactions with matter. It is not a general physics list (as in some other simulation packages) and in particular does not handle decays (they are handled in the separate decay module).
- The helper wrapper for continuous processes is renamed to `ContinuousProcess` and its documentation is updated accordingly.
- The standard interaction list is renamed to `StandardChargedElectroMagneticInteractions`.
  • Loading branch information
msmk0 committed Feb 25, 2021
1 parent 46309cd commit b48d30c
Show file tree
Hide file tree
Showing 19 changed files with 767 additions and 708 deletions.
27 changes: 10 additions & 17 deletions Examples/Algorithms/Fatras/src/FatrasAlgorithm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,10 @@
#include "ActsExamples/Framework/BareAlgorithm.hpp"
#include "ActsExamples/Framework/RandomNumbers.hpp"
#include "ActsExamples/Framework/WhiteBoard.hpp"
#include "ActsFatras/Kernel/PhysicsList.hpp"
#include "ActsFatras/Kernel/PointLikePhysicsList.hpp"
#include "ActsFatras/Kernel/Process.hpp"
#include "ActsFatras/Kernel/InteractionList.hpp"
#include "ActsFatras/Kernel/Simulator.hpp"
#include "ActsFatras/Physics/Decay/NoDecay.hpp"
#include "ActsFatras/Physics/EnergyLoss/BetheBloch.hpp"
#include "ActsFatras/Physics/EnergyLoss/BetheHeitler.hpp"
#include "ActsFatras/Physics/Scattering/Highland.hpp"
#include "ActsFatras/Physics/StandardPhysicsLists.hpp"
#include "ActsFatras/Physics/StandardInteractions.hpp"
#include "ActsFatras/Selectors/ChargeSelectors.hpp"
#include "ActsFatras/Selectors/KinematicCasts.hpp"
#include "ActsFatras/Selectors/SelectorHelpers.hpp"
Expand Down Expand Up @@ -86,9 +81,8 @@ struct FatrasAlgorithmSimulationT final
using ChargedSelector =
ActsFatras::CombineAnd<ActsFatras::ChargedSelector, CutPMin>;
using ChargedSimulator = ActsFatras::ParticleSimulator<
ChargedPropagator, ActsFatras::ChargedElectroMagneticPhysicsList,
ActsFatras::PointLikePhysicsList<>, HitSurfaceSelector,
ActsFatras::NoDecay>;
ChargedPropagator, ActsFatras::StandardChargedElectroMagneticInteractions,
HitSurfaceSelector, ActsFatras::NoDecay>;

// typedefs for neutral particle simulation
// propagate neutral particles with just straight lines
Expand All @@ -99,8 +93,7 @@ struct FatrasAlgorithmSimulationT final
ActsFatras::CombineAnd<ActsFatras::NeutralSelector, CutPMin>;
using NeutralSimulator =
ActsFatras::ParticleSimulator<NeutralPropagator,
ActsFatras::PhysicsList<>,
ActsFatras::PointLikePhysicsList<>,
ActsFatras::InteractionList<>,
ActsFatras::NoSurface, ActsFatras::NoDecay>;

// combined simulation type
Expand All @@ -125,18 +118,18 @@ struct FatrasAlgorithmSimulationT final
// minimal p cut on input particles and as is-alive check for interactions
simulation.selectCharged.template get<CutPMin>().valMin = cfg.pMin;
simulation.selectNeutral.template get<CutPMin>().valMin = cfg.pMin;
simulation.charged.continuous =
makeChargedElectroMagneticPhysicsList(cfg.pMin);
simulation.charged.interactions =
makeStandardChargedElectroMagneticInteractions(cfg.pMin);

// processes are enabled by default
if (not cfg.emScattering) {
simulation.charged.continuous.template disable<StandardScattering>();
simulation.charged.interactions.template disable<StandardScattering>();
}
if (not cfg.emEnergyLossIonisation) {
simulation.charged.continuous.template disable<StandardBetheBloch>();
simulation.charged.interactions.template disable<StandardBetheBloch>();
}
if (not cfg.emEnergyLossRadiation) {
simulation.charged.continuous.template disable<StandardBetheHeitler>();
simulation.charged.interactions.template disable<StandardBetheHeitler>();
}

// configure hit surfaces for charged particles
Expand Down
2 changes: 1 addition & 1 deletion Fatras/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ add_library(
src/EventData/Particle.cpp
src/EventData/ProcessType.cpp
src/Kernel/SimulatorError.cpp
src/Physics/StandardPhysicsLists.cpp
src/Physics/StandardInteractions.cpp
src/Physics/EnergyLoss/BetheHeitler.cpp
src/Utilities/LandauDistribution.cpp
src/Utilities/ParticleData.cpp)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,25 @@ struct EveryParticle {
constexpr bool operator()(const Particle &) const { return true; }
};

/// A simulation process based on a physics interaction plus selectors.
/// A continuous simulation process based on a physics model plus selectors.
///
/// @tparam physics_t is the physics interaction type
/// @tparam physics_t is the physics model type
/// @tparam input_particle_selector_t is the input particle selector
/// @tparam output_particle_selector_t is the output particle selector
/// @tparam child_particle_selector_t is the child particle selector
///
/// The input selector defines whether the interaction is applied while the
/// The physics model type **must** provide a call operator with the following
/// signature
///
/// <Particle Container>
/// operator()(
/// generator_t& generator,
/// const Acts::MaterialSlab& slab,
/// Particle& particle) const
///
/// The return type can be any `Container` with `Particle` elements.
///
/// The input selector defines whether the process is applied while the
/// output selector defines a break condition, i.e. whether to continue
/// simulating the particle propagation. The child selector is used to
/// filter the generated child particles.
Expand All @@ -36,7 +47,7 @@ template <typename physics_t,
typename input_particle_selector_t = EveryParticle,
typename output_particle_selector_t = EveryParticle,
typename child_particle_selector_t = output_particle_selector_t>
struct Process {
struct ContinuousProcess {
/// The physics interactions implementation.
physics_t physics;
/// Input selection: if this process applies to this particle.
Expand Down Expand Up @@ -65,7 +76,7 @@ struct Process {
// modify particle according to the physics process
auto children = physics(generator, slab, particle);
// move selected child particles to the output container
std::copy_if(children.begin(), children.end(),
std::copy_if(std::begin(children), std::end(children),
std::back_inserter(generated), selectChildParticle);
// break condition is defined by whether the output particle is still valid
// or not e.g. because it has fallen below a momentum threshold.
Expand Down

0 comments on commit b48d30c

Please sign in to comment.