IAP GITLAB

Skip to content
Snippets Groups Projects
Commit 99ebd188 authored by Maximilian Reininghaus's avatar Maximilian Reininghaus :vulcan:
Browse files

started implementing sibyll::InteractionModel

parent e72a10db
No related branches found
No related tags found
No related merge requests found
#include <corsika/framework/core/ParticleProperties.hpp>
#include <corsika/framework/core/PhysicalUnits.hpp>
#include <corsika/framework/geometry/FourVector.hpp>
#include <corsika/modules/sibyll/HadronInteractionModel.hpp>
#include <corsika/modules/sibyll/NuclearInteractionModel.hpp>
namespace corsika::sibyll {
template <typename TEnvironment>
InteractionModel<TEnvironment>::InteractionModel(TEnvironment const& environment)
: hadronSibyll_{}
, nuclearSibyll_{hadronSibyll_, environment} {}
template <typename TEnvironment>
HadronInteractionModel& InteractionModel<TEnvironment>::getHadronInteractionModel() {
return hadronSibyll_;
}
template <typename TEnvironment>
typename InteractionModel<TEnvironment>::nuclear_model_type&
InteractionModel<TEnvironment>::getNuclearInteractionModel() {
return nuclearSibyll_;
}
template <typename TEnvironment>
CrossSectionType InteractionModel<TEnvironment>::getCrossSection(
Code projCode, Code targetCode, FourMomentum const& proj4mom,
FourMomentum const& target4mom) const {
if (is_nucleus(projCode))
return getNuclearInteractionModel().getCrossSection(projCode, targetCode, proj4mom,
target4mom);
else
return getHadronInteractionModel().getCrossSection(projCode, targetCode, proj4mom,
target4mom);
}
template <typename TEnvironment>
template <typename TSecondaries>
void InteractionModel<TEnvironment>::doInteraction(TSecondaries& view, Code projCode,
Code targetCode,
FourMomentum const& proj4mom,
FourMomentum const& target4mom) {
if (is_nucleus(projCode))
return getNuclearInteractionModel().doInteraction(view, projCode, targetCode,
proj4mom, target4mom);
else
return getHadronInteractionModel().doInteraction(view, projCode, targetCode,
proj4mom, target4mom);
}
} // namespace corsika::sibyll
......@@ -13,6 +13,8 @@
#include <corsika/modules/sibyll/Decay.hpp>
#include <corsika/modules/sibyll/NuclearInteractionModel.hpp>
#include <corsika/modules/sibyll/InteractionModel.hpp>
#include <corsika/framework/process/InteractionProcess.hpp>
/**
......@@ -29,7 +31,9 @@ namespace corsika::sibyll {
* The sibyll::InteractionModel is wrapped as an InteractionProcess here in order
* to provide all the functions for ProcessSequence.
*/
class Interaction : public HadronInteractionModel, public InteractionProcess<Interaction> {};
template <typename TEnvironment>
class Interaction : public InteractionModel<TEnvironment>,
public InteractionProcess<Interaction<TEnvironment>> {};
/**
* @brief sibyll::NuclearInteraction is the process for ProcessSequence.
......
#include <corsika/framework/core/ParticleProperties.hpp>
#include <corsika/framework/core/PhysicalUnits.hpp>
#include <corsika/framework/geometry/FourVector.hpp>
#include <corsika/modules/sibyll/HadronInteractionModel.hpp>
#include <corsika/modules/sibyll/NuclearInteractionModel.hpp>
namespace corsika::sibyll {
template <typename TEnvironment>
class InteractionModel {
public:
using nuclear_model_type =
NuclearInteractionModel<TEnvironment, HadronInteractionModel>;
InteractionModel(TEnvironment const&);
CrossSectionType getCrossSection(Code, Code, FourMomentum const&,
FourMomentum const&) const;
template <typename TSecondaries>
void doInteraction(TSecondaries&, Code, Code, FourMomentum const&,
FourMomentum const&);
HadronInteractionModel& getHadronInteractionModel();
nuclear_model_type& getNuclearInteractionModel();
private:
HadronInteractionModel hadronSibyll_;
nuclear_model_type nuclearSibyll_;
};
} // namespace corsika::sibyll
#include <corsika/detail/modules/sibyll/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