IAP GITLAB

Skip to content
Snippets Groups Projects
Commit 200c193f authored by Felix Riehn's avatar Felix Riehn Committed by Maximilian Reininghaus
Browse files

added template parameter for hadronic model to proposal, split proposal process from interaction

parent 27b0548c
No related branches found
No related tags found
1 merge request!430Resolve "Connection between PROPOSAL and hadronic interaction models"
......@@ -11,7 +11,7 @@
#include <corsika/media/IMediumModel.hpp>
#include <corsika/modules/proposal/ContinuousProcess.hpp>
#include <corsika/modules/proposal/Interaction.hpp>
#include <corsika/modules/proposal/InteractionModel.hpp>
#include <corsika/framework/core/PhysicalUnits.hpp>
#include <corsika/framework/utility/COMBoost.hpp>
#include <corsika/framework/core/Logging.hpp>
......
......@@ -18,13 +18,16 @@
namespace corsika::proposal {
template <typename THadronicModel>
template <typename TEnvironment>
inline Interaction::Interaction(TEnvironment const& _env,
corsika::sibyll::Interaction& hadint)
inline InteractionModel<THadronicModel>::InteractionModel(TEnvironment const& _env,
THadronicModel& hadint)
: ProposalProcessBase(_env)
, hadronicInteraction_(hadint) {}
inline void Interaction::buildCalculator(Code code, NuclearComposition const& comp) {
template <typename THadronicModel>
inline void InteractionModel<THadronicModel>::buildCalculator(
Code code, NuclearComposition const& comp) {
// search crosssection builder for given particle
auto p_cross = cross.find(code);
if (p_cross == cross.end())
......@@ -48,10 +51,10 @@ namespace corsika::proposal {
PROPOSAL::make_interaction(c, true));
}
template <typename THadronicModel>
template <typename TStackView>
inline ProcessReturn Interaction::doInteraction(TStackView& view,
Code const projectileId,
FourMomentum const& projectileP4) {
inline ProcessReturn InteractionModel<THadronicModel>::doInteraction(
TStackView& view, Code const projectileId, FourMomentum const& projectileP4) {
auto const projectile = view.getProjectile();
......@@ -126,10 +129,11 @@ namespace corsika::proposal {
return ProcessReturn::Ok;
}
template <typename THadronicModel>
template <typename TStackView>
inline ProcessReturn Interaction::doHadronicInteraction(
inline ProcessReturn InteractionModel<THadronicModel>::doHadronicInteraction(
TStackView& view, CoordinateSystemPtr const& labCS,
FourMomentum const& projectileP4, Code const targetId) {
FourMomentum const& projectileP4, Code const& targetId) {
CORSIKA_LOG_INFO(
"HE photo-hadronic interaction! calling hadronic interaction model..");
......@@ -170,14 +174,15 @@ namespace corsika::proposal {
HEPEnergyType const Ekin = sqrt(p3lab.getSquaredNorm() + mass * mass) - mass;
view.addSecondary(std::make_tuple(pid, Ekin, p3lab.normalized()));
}
// throw std::runtime_error("photo-hadronic interaction!");
CORSIKA_LOG_INFO("number of particles produced: {}", view.getEntries());
return ProcessReturn::Ok;
}
template <typename THadronicModel>
template <typename TParticle>
inline CrossSectionType Interaction::getCrossSection(TParticle const& projectile,
Code const projectileId,
FourMomentum const& projectileP4) {
inline CrossSectionType InteractionModel<THadronicModel>::getCrossSection(
TParticle const& projectile, Code const projectileId,
FourMomentum const& projectileP4) {
// ==============================================
// this block better diappears. RU 26.10.2021
......
......@@ -8,5 +8,17 @@
#pragma once
#include <corsika/modules/proposal/Interaction.hpp>
#include <corsika/modules/proposal/InteractionModel.hpp>
#include <corsika/modules/proposal/ContinuousProcess.hpp>
namespace corsika::proposal {
template <typename THadronicModel>
class Interaction : public InteractionModel<THadronicModel>,
public InteractionProcess<Interaction<THadronicModel>> {
public:
template <typename TEnvironment>
Interaction(TEnvironment const& env, THadronicModel& model)
: InteractionModel<THadronicModel>(env, model) {}
};
} // namespace corsika::proposal
......@@ -16,7 +16,6 @@
#include <corsika/framework/geometry/FourVector.hpp>
#include <corsika/framework/random/RNGManager.hpp>
#include <corsika/framework/random/UniformRealDistribution.hpp>
#include <corsika/modules/Sibyll.hpp>
#include <corsika/modules/proposal/ProposalProcessBase.hpp>
namespace corsika::proposal {
......@@ -25,10 +24,16 @@ namespace corsika::proposal {
//! Electro-magnetic and photon stochastic losses produced by proposal. It makes
//! use of interpolation tables which are runtime intensive calculation, but can be
//! reused by setting the \param PROPOSAL::InterpolationDef::path_to_tables variable.
//! @tparam THadronModel
//! Hadroninc interactions of photons with nuclei are included. The cross section is
//! calculated by PROPOSAL. For the production of hadronic secondaries an external model
//! is needed that implements the doInteraction(TSecondaries& view, Code const
//! projectile, Code const target,FourMomentum const& projectileP4, FourMomentum const&
//! targetP4) routine.
//! @tparam THadronicModel
//!
class Interaction : public InteractionProcess<Interaction>, ProposalProcessBase {
template <class THadronicModel>
class InteractionModel : public ProposalProcessBase {
enum { eSECONDARIES, eINTERACTION };
using calculator_t = std::tuple<std::unique_ptr<PROPOSAL::SecondariesCalculator>,
......@@ -48,7 +53,7 @@ namespace corsika::proposal {
//! compositions and stochastic description limited by the particle cut.
//!
template <typename TEnvironment>
Interaction(TEnvironment const& env, corsika::sibyll::Interaction&);
InteractionModel(TEnvironment const& env, THadronicModel&);
//!
//! Calculate the rates for the different targets and interactions. Sample a
......@@ -66,7 +71,7 @@ namespace corsika::proposal {
template <typename TSecondaryView>
ProcessReturn doHadronicInteraction(TSecondaryView&, CoordinateSystemPtr const&,
FourMomentum const& projectileP4,
Code const targetId);
Code const& targetId);
//!
//! Calculates and returns the cross section.
......@@ -76,10 +81,11 @@ namespace corsika::proposal {
FourMomentum const& projectileP4);
private:
corsika::sibyll::Interaction& hadronicInteraction_;
THadronicModel& hadronicInteraction_;
static HEPEnergyType constexpr heHadronicModelThresholdLab_ =
80. * 1e9 * electronvolt;
};
} // namespace corsika::proposal
#include <corsika/detail/modules/proposal/Interaction.inl>
#include <corsika/detail/modules/proposal/InteractionModel.inl>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment