CORSIKA8  0.0.0
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 
18 namespace corsika {
27  class ParticleCut : public SecondariesProcess<ParticleCut>,
28  public ContinuousProcess<ParticleCut> {
29 
30  public:
36  ParticleCut(HEPEnergyType const eEleCut, HEPEnergyType const ePhoCut,
37  HEPEnergyType const eHadCut, HEPEnergyType const eMuCut, bool const inv);
38 
41  ParticleCut(HEPEnergyType const eHadCut, HEPEnergyType const euCut, bool const inv);
42 
45  ParticleCut(HEPEnergyType const eCut, bool const em, bool const inv);
46 
49  ParticleCut(std::unordered_map<Code const, HEPEnergyType const> const& eCuts,
50  bool const em, bool const inv);
51 
52  template <typename TStackView>
53  void doSecondaries(TStackView&);
54 
55  template <typename TParticle, typename TTrajectory>
56  ProcessReturn doContinuous(
57  TParticle& vParticle, TTrajectory const& vTrajectory,
58  const bool limitFlag = false); // this is not used for ParticleCut
59 
60  template <typename TParticle, typename TTrajectory>
61  LengthType getMaxStepLength(TParticle const&, TTrajectory const&) {
62  return meter * std::numeric_limits<double>::infinity();
63  }
64 
65  void printThresholds();
66  void showResults(); // LCOV_EXCL_LINE
67  void reset();
68 
69  HEPEnergyType getElectronKineticECut() const {
70  return get_kinetic_energy_threshold(Code::Electron);
71  }
72  HEPEnergyType getPhotonKineticECut() const {
73  return get_kinetic_energy_threshold(Code::Photon);
74  }
75  HEPEnergyType getMuonKineticECut() const {
76  return get_kinetic_energy_threshold(Code::MuPlus);
77  }
78  HEPEnergyType getHadronKineticECut() const {
79  return get_kinetic_energy_threshold(Code::Proton);
80  }
82  HEPEnergyType getInvEnergy() const { return energy_invcut_; }
84  HEPEnergyType getTimeCutEnergy() const { return energy_timecut_; }
86  HEPEnergyType getCutEnergy() const { return energy_cut_; }
89  HEPEnergyType getEmEnergy() const { return energy_emcut_; }
91  unsigned int getNumberEmParticles() const { return em_count_; }
93  unsigned int getNumberInvParticles() const { return inv_count_; }
94 
95  private:
96  template <typename TParticle>
97  bool checkCutParticle(TParticle const& p);
98 
99  template <typename TParticle>
100  bool isBelowEnergyCut(TParticle const&) const;
101 
103  bool isInvisible(Code const&) const;
104 
105  private:
106  bool doCutEm_;
107  bool doCutInv_;
108  HEPEnergyType energy_cut_ = 0 * electronvolt;
109  HEPEnergyType energy_timecut_ = 0 * electronvolt;
110  HEPEnergyType energy_emcut_ = 0 * electronvolt;
111  HEPEnergyType energy_invcut_ = 0 * electronvolt;
112  unsigned int em_count_ = 0;
113  unsigned int inv_count_ = 0;
114  unsigned int energy_count_ = 0;
115 
116  HEPEnergyType energy_event_; // per event sum
117  };
118 
119 } // namespace corsika
120 
121 #include <corsika/detail/modules/ParticleCut.inl>
HEPEnergyType getCutEnergy() const
returns total energy of particles that were removed by cut in kinetic energy
Definition: ParticleCut.hpp:86
Import and extend the phys::units package.
unsigned int getNumberInvParticles() const
returns number of invisible particles
Definition: ParticleCut.hpp:93
HEPEnergyType getTimeCutEnergy() const
returns total energy of particles that were removed by cut in time
Definition: ParticleCut.hpp:84
ParticleCut(HEPEnergyType const eEleCut, HEPEnergyType const ePhoCut, HEPEnergyType const eHadCut, HEPEnergyType const eMuCut, bool const inv)
particle cut with kinetic energy thresholds for electrons, photons, hadrons (including nuclei with en...
HEPEnergyType getInvEnergy() const
returns total energy of particles that were removed by cut for invisible particles ...
Definition: ParticleCut.hpp:82
HEPEnergyType getEmEnergy() const
returns total energy of particles that were removed by cut for electromagnetic particles ...
Definition: ParticleCut.hpp:89
Processes with continuous effects along a particle Trajectory.
The cascade namespace assembles all objects needed to simulate full particles cascades.
Processes acting on the secondaries produced by other processes.
simple ParticleCut process.
Definition: ParticleCut.hpp:27
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 "|="
unsigned int getNumberEmParticles() const
returns number of electromagnetic particles
Definition: ParticleCut.hpp:91
Interface to particle properties.
HEPEnergyType constexpr get_kinetic_energy_threshold(Code const)
get kinetic energy threshold below which the particle is discarded, by default set to zero ...