CORSIKA  @c8_version@
The framework to simulate particle cascades for astroparticle physics
InteractionLengthModifier.hpp
1 /*
2  * (c) Copyright 2021 CORSIKA Project, corsika-project@lists.kit.edu
3  *
4  * This software is distributed under the terms of the GNU General Public
5  * Licence version 3 (GPL Version 3). See file LICENSE for a full version of
6  * the license.
7  */
8 
9 #pragma once
10 
11 #include <functional>
12 
15 #include <corsika/framework/process/InteractionProcess.hpp>
16 
17 namespace corsika {
25  template <class TUnderlyingProcess>
27  : public InteractionProcess<InteractionLengthModifier<TUnderlyingProcess>> {
28 
30  static auto constexpr non_modifying_functor = [](GrammageType original, corsika::Code,
31  HEPEnergyType) { return original; };
32 
33  public:
37 
42  InteractionLengthModifier(TUnderlyingProcess&& process,
43  std::function<functor_signature> modifier);
44 
46  template <typename TSecondaryView>
47  void doInteraction(TSecondaryView& view);
48 
50  template <typename TParticle>
51  GrammageType getInteractionLength(TParticle const& particle);
52 
54  TUnderlyingProcess const& getProcess() const;
55  TUnderlyingProcess& getProcess();
56 
57  private:
58  TUnderlyingProcess process_;
59  std::function<functor_signature> const modifier_{non_modifying_functor};
60  };
61 
63 
64 } // namespace corsika
65 
66 #include <corsika/detail/framework/process/InteractionLengthModifier.inl>
GrammageType getInteractionLength(TParticle const &particle)
! returns underlying process getInteractionLength modified
GrammageType(GrammageType, corsika::Code, HEPEnergyType) functor_signature
The signature of the modifying functor. Arguments are original int. length, PID, energy.
Import and extend the phys::units package.
`, since they are used everywhere as integral part of the framework.
InteractionLengthModifier(TUnderlyingProcess &&process, std::function< functor_signature > modifier)
Create wrapper around InteractionProcess.
TUnderlyingProcess const & getProcess() const
! obtain reference to wrapped process
Interface to particle properties.
void doInteraction(TSecondaryView &view)
wrapper around internal process doInteraction
Process describing the interaction of particles.