IAP GITLAB

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

do proposal test with dummy interaction

parent 200c193f
No related branches found
No related tags found
1 merge request!430Resolve "Connection between PROPOSAL and hadronic interaction models"
......@@ -6,7 +6,6 @@
* the license.
*/
#include <corsika/modules/PROPOSAL.hpp>
#include <corsika/modules/Sibyll.hpp>
#include <corsika/framework/random/RNGManager.hpp>
#include <SetupTestEnvironment.hpp>
......@@ -25,6 +24,24 @@ using DummyEnvironment = Environment<DummyEnvironmentInterface>;
#include <corsika/media/NuclearComposition.hpp>
#include <corsika/media/UniformMagneticField.hpp>
class DummyHadronicModel {
public:
DummyHadronicModel(){};
template <typename TSecondaryView>
void doInteraction(TSecondaryView& view, Code const, Code const,
FourMomentum const& projectileP4, FourMomentum const& targetP4) {
auto const E = projectileP4.getTimeLikeComponent();
// add 5 pions
auto const& csPrime = view.getProjectile().getMomentum().getCoordinateSystem();
for (int i = 0; i < 5; ++i) {
view.addSecondary(
std::make_tuple(Code::PiPlus, E / 5,
MomentumVector(csPrime, {0_GeV, 0_GeV, 0_GeV}).normalized()));
}
}
};
TEST_CASE("ProposalInterface", "modules") {
logging::set_level(logging::level::info);
......@@ -37,11 +54,11 @@ TEST_CASE("ProposalInterface", "modules") {
Code::Electron, 10_GeV, (DummyEnvironment::BaseNodeType* const)nodePtr, cs);
test::StackView& view = *viewPtr;
RNGManager<>::getInstance().registerRandomStream("sibyll");
RNGManager<>::getInstance().registerRandomStream("proposal");
corsika::sibyll::Interaction hadModel;
corsika::proposal::Interaction emModel(*env, hadModel);
DummyHadronicModel hadModel;
corsika::proposal::InteractionModel emModel(*env, hadModel);
SECTION("InteractionInterface - cross section") {
auto& stack = *stackPtr;
......@@ -59,5 +76,7 @@ TEST_CASE("ProposalInterface", "modules") {
// finish successfully
CHECK(emModel.doHadronicInteraction(view, cs, P4, Code::Oxygen) == ProcessReturn::Ok);
CHECK(stack.getEntries() > 1);
CORSIKA_LOG_INFO("Number of particles produced in hadronic photon interaction: {}",
stack.getEntries());
}
}
\ No newline at end of file
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