CORSIKA  @c8_version@
The framework to simulate particle cascades for astroparticle physics
Interaction.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 <tuple>
12 #include <boost/filesystem/path.hpp>
13 
17 #include <corsika/framework/random/RNGManager.hpp>
18 #include <corsika/framework/process/InteractionProcess.hpp>
19 #include <corsika/modules/pythia8/Pythia8.hpp>
20 
21 namespace corsika::pythia8 {
22  class Interaction : public InteractionProcess<Interaction> {
23 
24  public:
26  boost::filesystem::path const& mpiInitFile = corsika_data("Pythia/main184.mpi"),
27  bool const print_listing = false);
28  ~Interaction();
29 
30  bool canInteract(Code const) const;
31 
32  bool isValid(Code const projectileId, Code const targetId,
33  HEPEnergyType const sqrtS) const;
50  std::tuple<CrossSectionType, CrossSectionType> getCrossSectionInelEla(
51  Code const projectile, Code const target, FourMomentum const& projectileP4,
52  FourMomentum const& targetP4) const;
53 
70  Code const projectile, Code const target, FourMomentum const& projectileP4,
71  FourMomentum const& targetP4) const; // non-const for now
72 
77  template <typename TView>
78  void doInteraction(TView& output, Code const projectileId, Code const targetId,
79  FourMomentum const& projectileP4, FourMomentum const& targetP4);
80 
88  double getAverageSubcollisions(Code targetId, CrossSectionType sigTot) const;
89 
90  static std::array constexpr validTargets_{Code::Oxygen, Code::Nitrogen,
91  Code::Argon, Code::Hydrogen,
92  Code::Proton, Code::Neutron};
93 
94  private:
95  default_prng_type& RNG_ = RNGManager<>::getInstance().getRandomStream("pythia");
96  //~ bool const internalDecays_ = true;
97  int count_ = 0;
98  bool const print_listing_ = false;
99  Pythia8::Pythia pythiaMain_;
100  Pythia8::Pythia mutable pythiaColl_; // Pythia's getSigma...() are not marked const...
101  double const probSD_ =
102  0.3; // Fraction of single diffractive events beyond first collision in nucleus.
103  HEPEnergyType const eMaxLab_ = 1e18_eV;
104  HEPEnergyType const eKinMinLab_ = 0.2_GeV;
105  };
106 
107 } // namespace corsika::pythia8
108 
109 #include <corsika/detail/modules/pythia8/Interaction.inl>
CrossSectionType getCrossSection(Code const projectile, Code const target, FourMomentum const &projectileP4, FourMomentum const &targetP4) const
Returns inelastic (production) cross section.
void doInteraction(TView &output, Code const projectileId, Code const targetId, FourMomentum const &projectileP4, FourMomentum const &targetP4)
In this function PYTHIA is called to produce one event.
Import and extend the phys::units package.
double getAverageSubcollisions(Code targetId, CrossSectionType sigTot) const
return average number of sub-collisions in a nucleus, using the parameterizations of Sjöstrand and Ut...
std::tuple< CrossSectionType, CrossSectionType > getCrossSectionInelEla(Code const projectile, Code const target, FourMomentum const &projectileP4, FourMomentum const &targetP4) const
Returns inelastic AND elastic cross sections.
Description of physical four-vectors.
Definition: FourVector.hpp:51
returns the full path of the file filename within the CORSIKA_DATA directory.
Interface to particle properties.
Process describing the interaction of particles.
prng_type & getRandomStream(string_type const &streamName)