CORSIKA8  0.0.0
The framework to simulate particle cascades for astroparticle physics
Interaction.hpp
1 /*
2  * (c) Copyright 2018 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 
13 #include <corsika/framework/random/RNGManager.hpp>
14 #include <corsika/framework/process/InteractionProcess.hpp>
15 #include <tuple>
16 
17 namespace corsika::sibyll {
18 
19  class Interaction : public InteractionProcess<Interaction> {
20 
21  public:
22  Interaction(bool const sibyll_printout_on = false);
23  ~Interaction();
24 
25  bool isValidCoMEnergy(HEPEnergyType const ecm) const {
26  return (minEnergyCoM_ <= ecm) && (ecm <= maxEnergyCoM_);
27  }
30  bool isValidTarget(Code const TargetId) const {
31  return (is_nucleus(TargetId) && (get_nucleus_A(TargetId) >= minNuclearTargetA_) &&
32  (get_nucleus_A(TargetId) < maxTargetMassNumber_)) ||
33  (TargetId == Code::Proton || TargetId == Code::Hydrogen ||
34  TargetId == Code::Neutron);
35  }
36 
40  std::tuple<CrossSectionType, CrossSectionType> getCrossSection(
41  Code const, Code const, HEPEnergyType const) const;
42 
43  template <typename TParticle>
44  GrammageType getInteractionLength(TParticle const&) const;
45 
51  template <typename TSecondaries>
52  void doInteraction(TSecondaries&);
53 
54  private:
55  int getMaxTargetMassNumber() const { return maxTargetMassNumber_; }
56  HEPEnergyType getMinEnergyCoM() const { return minEnergyCoM_; }
57  HEPEnergyType getMaxEnergyCoM() const { return maxEnergyCoM_; }
58 
59  default_prng_type& RNG_ = RNGManager<>::getInstance().getRandomStream("sibyll");
60  const HEPEnergyType minEnergyCoM_ = 10. * 1e9 * electronvolt;
61  const HEPEnergyType maxEnergyCoM_ = 1.e6 * 1e9 * electronvolt;
62  const int maxTargetMassNumber_ = 18;
63  const int minNuclearTargetA_ = 4;
64 
65  // data members
66  int count_ = 0;
67  int nucCount_ = 0;
68  bool sibyll_listing_;
69  };
70 
71 } // namespace corsika::sibyll
72 
73 #include <corsika/detail/modules/sibyll/Interaction.inl>
Import and extend the phys::units package.
int constexpr get_nucleus_A(Code const)
returns A for hard-coded nucleus, otherwise 0
bool isValidTarget(Code const TargetId) const
sibyll only accepts nuclei with 4<=A<=18 as targets, or protons aka Hydrogen or neutrons (p...
Definition: Interaction.hpp:30
void doInteraction(TSecondaries &)
In this function SIBYLL is called to produce one event.
bool constexpr is_nucleus(Code const)
true iff the particle is a hard-coded nucleus or Code::Nucleus
Interface to particle properties.
std::tuple< CrossSectionType, CrossSectionType > getCrossSection(Code const, Code const, HEPEnergyType const) const
returns production and elastic cross section for hadrons in sibyll. Inputs are: CorsikaId of beam par...
Process describing the interaction of particles.
prng_type & getRandomStream(string_type const &streamName)