CORSIKA  @c8_version@
The framework to simulate particle cascades for astroparticle physics
InteractionModel.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 
14 #include <corsika/framework/random/RNGManager.hpp>
15 #include <tuple>
16 
17 namespace corsika::epos {
18 
20 
21  public:
22  InteractionModel(std::string const& dataPath = "",
23  bool const epos_printout_on = false);
25 
38  std::tuple<CrossSectionType, CrossSectionType> calcCrossSectionCoM(
39  Code const corsikaId, int const, int const, Code const targetId, int const,
40  int const, HEPEnergyType const sqrtS) const;
41 
46  std::tuple<CrossSectionType, CrossSectionType> readCrossSectionTableLab(
47  Code const, int const, int const, Code const, HEPEnergyType const) const;
48 
56  std::tuple<CrossSectionType, CrossSectionType> getCrossSectionInelEla(
57  Code const projectileId, Code const targetId, FourMomentum const& projectileP4,
58  FourMomentum const& targetP4) const;
59 
66  bool isValid(Code const projectileId, Code const targetId,
67  HEPEnergyType const sqrtS) const;
68 
78  CrossSectionType getCrossSection(Code const projectileId, Code const targetId,
79  FourMomentum const& projectileP4,
80  FourMomentum const& targetP4) const {
81  return std::get<0>(
82  getCrossSectionInelEla(projectileId, targetId, projectileP4, targetP4));
83  }
84 
88  template <typename TSecondaries>
89  void doInteraction(TSecondaries&, Code const projectileId, Code const targetId,
90  FourMomentum const& projectileP4, FourMomentum const& targetP4);
91 
92  void initializeEventCoM(Code const, int const, int const, Code const, int const,
93  int const, HEPEnergyType const) const;
94  void initializeEventLab(Code const, int const, int const, Code const, int const,
95  int const, HEPEnergyType const) const;
96  void configureParticles(Code const, int const, int const, Code const, int const,
97  int const) const;
98 
99  private:
100  // initialize and setParticlesStable are private since they can only be called once at
101  // the beginning and are already called in the constructor!
102  void initialize() const;
103  void setParticlesStable() const;
104  inline static bool isInitialized_ = false;
105 
106  std::string data_path_;
107  unsigned int count_ = 0;
108  bool epos_listing_;
109 
110  default_prng_type& RNG_ = RNGManager<>::getInstance().getRandomStream("epos");
111  std::shared_ptr<spdlog::logger> logger_ = get_logger("corsika_epos_Interaction");
112  HEPEnergyType const minEnergyCoM_ = 6 * 1e9 * electronvolt;
113  HEPEnergyType const maxEnergyCoM_ = 2.e6 * 1e9 * electronvolt;
114  static Code constexpr maxNucleus_ = Code::Lead;
115  };
116 
117 } // namespace corsika::epos
118 
119 #include <corsika/detail/modules/epos/InteractionModel.inl>
Import and extend the phys::units package.
std::shared_ptr< spdlog::logger > get_logger(std::string const &name, bool const defaultlog=false)
Get a smart pointer to an existing logger.
std::tuple< CrossSectionType, CrossSectionType > getCrossSectionInelEla(Code const projectileId, Code const targetId, FourMomentum const &projectileP4, FourMomentum const &targetP4) const
Returns production and elastic cross section.
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 > calcCrossSectionCoM(Code const corsikaId, int const, int const, Code const targetId, int const, int const, HEPEnergyType const sqrtS) const
Returns production and elastic cross section for hadrons in epos.
Description of physical four-vectors.
Definition: FourVector.hpp:51
Interface to particle properties.
CrossSectionType getCrossSection(Code const projectileId, Code const targetId, FourMomentum const &projectileP4, FourMomentum const &targetP4) const
Get the inelatic/production cross section.
void doInteraction(TSecondaries &, Code const projectileId, Code const targetId, FourMomentum const &projectileP4, FourMomentum const &targetP4)
Calculate one hadron-hadron interaction.
bool isValid(Code const projectileId, Code const targetId, HEPEnergyType const sqrtS) const
Checks validity of projectile, target and energy combination.
General FourVector object.
prng_type & getRandomStream(string_type const &streamName)