CORSIKA  @c8_version@
The framework to simulate particle cascades for astroparticle physics
ParticleCut.hpp
1 /*
2  * (c) Copyright 2020 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 <unordered_map>
12 
15 #include <corsika/framework/process/SecondariesProcess.hpp>
16 #include <corsika/framework/process/ContinuousProcess.hpp>
17 #include <corsika/framework/core/Step.hpp>
18 
19 #include <corsika/modules/writers/WriterOff.hpp>
20 
21 namespace corsika {
32  template <typename TOutput = WriterOff>
33  class ParticleCut : public SecondariesProcess<ParticleCut<TOutput>>,
34  public ContinuousProcess<ParticleCut<TOutput>>,
35  public TOutput {
36 
37  public:
45  template <typename... TArgs>
46  ParticleCut(HEPEnergyType const eEleCut, HEPEnergyType const ePhoCut,
47  HEPEnergyType const eHadCut, HEPEnergyType const eMuCut, bool const inv,
48  TArgs&&... args);
49 
55  template <typename... TArgs>
56  ParticleCut(HEPEnergyType const eCut, bool const inv, TArgs&&... OutputArgs);
57 
64  template <typename... TArgs>
65  ParticleCut(std::unordered_map<Code const, HEPEnergyType const> const& eCuts,
66  bool const inv, TArgs&&... outputArgs);
67 
73  template <typename TStackView>
74  void doSecondaries(TStackView&);
75 
84  template <typename TParticle>
87  const bool limitFlag = false); // this is not used for ParticleCut
88 
96  template <typename TParticle, typename TTrajectory>
97  LengthType getMaxStepLength(TParticle const&, TTrajectory const&) {
98  return meter * std::numeric_limits<double>::infinity();
99  }
100 
101  void printThresholds() const;
102 
103  HEPEnergyType getElectronKineticECut() const { return cut_electrons_; }
104  HEPEnergyType getPhotonKineticECut() const { return cut_photons_; }
105  HEPEnergyType getMuonKineticECut() const { return cut_muons_; }
106  HEPEnergyType getHadronKineticECut() const { return cut_hadrons_; }
107 
109  YAML::Node getConfig() const override;
110 
111  private:
112  bool checkCutParticle(Code const, HEPEnergyType const, TimeType const) const;
113 
114  bool isBelowEnergyCut(Code const, HEPEnergyType const) const;
115 
116  private:
117  HEPEnergyType cut_electrons_;
118  HEPEnergyType cut_photons_;
119  HEPEnergyType cut_muons_;
120  HEPEnergyType cut_hadrons_;
121  bool doCutInv_;
122  std::unordered_map<Code const, HEPEnergyType const> cuts_;
123  }; // namespace corsika
124 
125 } // namespace corsika
126 
127 #include <corsika/detail/modules/ParticleCut.inl>
Import and extend the phys::units package.
void doSecondaries(TStackView &)
Cut particles which are secondaries from discrete processes.
ParticleCut(HEPEnergyType const eEleCut, HEPEnergyType const ePhoCut, HEPEnergyType const eHadCut, HEPEnergyType const eMuCut, bool const inv, TArgs &&... args)
particle cut with kinetic energy thresholds for electrons, photons, hadrons (including nuclei with en...
Processes with continuous effects along a particle Trajectory.
`, since they are used everywhere as integral part of the framework.
Processes acting on the secondaries produced by other processes.
ParticleCut process to kill particles.
Definition: ParticleCut.hpp:33
ProcessReturn doContinuous(Step< TParticle > &, const bool limitFlag=false)
Cut particles during continuous processes (energy losses etc).
ProcessReturn
since in a process sequence many status updates can accumulate for a single particle, this enum should define only bit-flags that can be accumulated easily with "|="
LengthType getMaxStepLength(TParticle const &, TTrajectory const &)
Limit on continuous step length imposed by ParticleCut: none.
Definition: ParticleCut.hpp:97
Interface to particle properties.
YAML::Node getConfig() const override
get configuration of this node, for output