CORSIKA8  0.0.0
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 
13 #include <corsika/framework/random/RNGManager.hpp>
14 #include <corsika/framework/process/InteractionProcess.hpp>
15 #include <corsika/modules/qgsjetII/ParticleConversion.hpp>
17 
18 #include <boost/filesystem/path.hpp>
19 
20 #include <qgsjet-II-04.hpp>
21 #include <string>
22 
23 namespace corsika::qgsjetII {
24 
25  class Interaction : public corsika::InteractionProcess<Interaction> {
26 
27  public:
28  Interaction(boost::filesystem::path dataPath = corsika_data("QGSJetII"));
29  ~Interaction();
30 
31  bool wasInitialized() { return initialized_; }
32  int getMaxTargetMassNumber() const { return maxMassNumber_; }
33  bool isValidTarget(corsika::Code TargetId) const {
34  return is_nucleus(TargetId) && (get_nucleus_A(TargetId) < maxMassNumber_);
35  }
36 
37  CrossSectionType getCrossSection(const Code, const Code, const HEPEnergyType,
38  const unsigned int Abeam = 0,
39  const unsigned int Atarget = 0) const;
40 
41  template <typename TParticle>
42  GrammageType getInteractionLength(TParticle const&) const;
43 
49  template <typename TSecondaryView>
50  void doInteraction(TSecondaryView&);
51 
52  private:
53  int count_ = 0;
54  bool initialized_ = false;
55  QgsjetIIHadronType alternate_ =
56  QgsjetIIHadronType::PiPlusType; // for pi0, rho0 projectiles
57 
58  corsika::default_prng_type& rng_ =
60  const int maxMassNumber_ = 208;
61  };
62 
63 } // namespace corsika::qgsjetII
64 
65 #include <corsika/detail/modules/qgsjetII/Interaction.inl>
Import and extend the phys::units package.
int constexpr get_nucleus_A(Code const)
returns A for hard-coded nucleus, otherwise 0
void doInteraction(TSecondaryView &)
In this function QGSJETII is called to produce one event.
returns the full path of the file filename within the CORSIKA_DATA directory
bool constexpr is_nucleus(Code const)
true iff the particle is a hard-coded nucleus or Code::Nucleus
Interface to particle properties.
Process describing the interaction of particles.
prng_type & getRandomStream(string_type const &streamName)