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::epos {
18 
19  class Interaction : public InteractionProcess<Interaction> {
20  std::string data_path_;
21  unsigned int count_ = 0;
22  bool epos_listing_;
23 
24  public:
25  Interaction(std::string const& dataPath = "", bool const epos_printout_on = false);
26  ~Interaction();
27 
32  std::tuple<CrossSectionType, CrossSectionType> calcCrossSectionCoM(
33  Code const, int const, int const, Code const, int const, int const,
34  HEPEnergyType const) const;
35 
38  std::tuple<CrossSectionType, CrossSectionType> readCrossSectionTableLab(
39  Code const, int const, int const, Code const, HEPEnergyType const) const;
40 
44  std::tuple<CrossSectionType, CrossSectionType> getCrossSectionLab(
45  Code const, int const, int const, Code const, int const, int const,
46  HEPEnergyType const) const;
47 
48  template <typename TParticle>
49  GrammageType getInteractionLength(TParticle const&) const;
50 
55  template <typename TSecondaries>
56  void doInteraction(TSecondaries&);
57 
58  bool isValidCoMEnergy(HEPEnergyType const ecm) const {
59  return (minEnergyCoM_ <= ecm) && (ecm <= maxEnergyCoM_);
60  }
61 
64  bool isValidTarget(Code const) const;
65 
66  void initialize() const;
67  void initializeEventCoM(Code const, int const, int const, Code const, int const,
68  int const, HEPEnergyType const) const;
69  void initializeEventLab(Code const, int const, int const, Code const, int const,
70  int const, HEPEnergyType const) const;
71  void configureParticles(Code const, int const, int const, Code const, int const,
72  int const) const;
73  void setParticlesStable() const;
74 
75  private:
76  default_prng_type& RNG_ = RNGManager<>::getInstance().getRandomStream("epos");
77  std::shared_ptr<spdlog::logger> logger_ = get_logger("corsika_epos_Interaction");
78  HEPEnergyType const minEnergyCoM_ = 6 * 1e9 * electronvolt;
79  HEPEnergyType const maxEnergyCoM_ = 2.e6 * 1e9 * electronvolt;
80  int const maxTargetMassNumber_ = 20;
81  int const minNuclearTargetA_ = 4;
82  };
83 
84 } // namespace corsika::epos
85 
86 #include <corsika/detail/modules/epos/Interaction.inl>
Import and extend the phys::units package.
std::tuple< CrossSectionType, CrossSectionType > calcCrossSectionCoM(Code const, int const, int const, Code const, int const, int const, HEPEnergyType const) const
returns production and elastic cross section for hadrons in epos. Inputs are: CorsikaId of beam parti...
std::tuple< CrossSectionType, CrossSectionType > readCrossSectionTableLab(Code const, int const, int const, Code const, HEPEnergyType const) const
returns production and elastic cross section for hadrons in epos by reading pre-calculated tables fro...
std::tuple< CrossSectionType, CrossSectionType > getCrossSectionLab(Code const, int const, int const, Code const, int const, int const, HEPEnergyType const) const
returns production and elastic cross section. Allowed configurations are hadron-nucleon, hadron-nucleus and nucleus-nucleus. Inputs are particle id&#39;s mass and charge numbers and total energy in the lab.
std::shared_ptr< spdlog::logger > get_logger(std::string const &name, bool const defaultlog=false)
Get a smart pointer to an existing logger.
void doInteraction(TSecondaries &)
In this function EPOSLHC is called to produce one event.
bool isValidTarget(Code const) const
eposlhc only accepts nuclei with X<=A<=Y as targets, or protons aka Hydrogen or neutrons (p...
Interface to particle properties.
Process describing the interaction of particles.
prng_type & getRandomStream(string_type const &streamName)