IAP GITLAB

Skip to content
Snippets Groups Projects
Commit 796ea87f authored by ralfulrich's avatar ralfulrich Committed by Ralf Ulrich
Browse files

improved conex test

parent 3d076b70
No related branches found
No related tags found
No related merge requests found
......@@ -56,6 +56,12 @@ CORSIKA_ADD_TEST(testCONEXSourceCut SOURCES
${MODEL_HEADERS}
)
#
target_compile_definitions (
testCONEXSourceCut
PRIVATE
REFDATADIR="${CMAKE_CURRENT_SOURCE_DIR}"
)
#
target_link_libraries (
testCONEXSourceCut
ProcessCONEXSourceCut
......
15 # log10(eprima/eV)
60 # theta
1e+30 # X1 (first interaction)
1093.9 # Nmax
475.585 # X0
50.3301 # P1
-0.00584492 # P2
3.55546e-06 # P3
4.49378e-05 # chi^2 / sqrt(Nmax)
880.549 # Xmax
-0 # phi
-1 # inelasticity 1st int.
100000 # ???
This diff is collapsed.
......@@ -35,6 +35,8 @@ using namespace corsika::environment;
using namespace corsika::geometry;
using namespace corsika::units::si;
const std::string refDataDir = std::string(REFDATADIR); // from cmake
template <typename T>
using MExtraEnvirnoment =
environment::MediumPropertyModel<environment::UniformMagneticField<T>>;
......@@ -108,6 +110,41 @@ TEST_CASE("CONEXSourceCut") {
conex.addParticle(particles::Code::Proton, Eem, 0_eV, emPosition, momentum.normalized(),
0_s);
// supperimpose a photon
auto const momentumPhoton = showerAxis.GetDirection() * 1_TeV;
conex.addParticle(particles::Code::Gamma, 1_TeV, 0_eV, emPosition,
momentumPhoton.normalized(), 0_s);
conex.SolveCE();
}
#include <algorithm>
#include <iterator>
#include <string>
#include <fstream>
TEST_CASE("ConexOutput", "[output validation]") {
auto file = GENERATE(as<std::string>{}, "conex_fit", "conex_output");
SECTION(std::string("check saved data, ") + file + ".txt") {
// compare to binary reference data
std::ifstream file1(file + ".txt");
std::ifstream file1ref(refDataDir + "/" + file + "_REF.txt");
std::istreambuf_iterator<char> begin1(file1);
std::istreambuf_iterator<char> begin1ref(file1ref);
std::istreambuf_iterator<char> end;
while (begin1 != end && begin1ref != end) {
CHECK(*begin1 == *begin1ref);
++begin1;
++begin1ref;
}
CHECK(begin1 == end);
CHECK(begin1ref == end);
file1.close();
file1ref.close();
}
}
......@@ -49,12 +49,13 @@ CORSIKA_ADD_TEST(testInteractionCounter SOURCES
testInteractionCounter.cc
${MODEL_HEADERS}
)
#
target_compile_definitions (
testInteractionCounter
PRIVATE
REFDATADIR="${CMAKE_CURRENT_SOURCE_DIR}"
)
#
target_link_libraries (
testInteractionCounter
ProcessInteractionCounter
......
......@@ -27,7 +27,7 @@ using namespace corsika::process::interaction_counter;
using namespace corsika::units;
using namespace corsika::units::si;
const std::string refDataDir = std::string(REFDATADIR);
const std::string refDataDir = std::string(REFDATADIR); // from cmake
struct DummyProcess {
template <typename TParticle>
......
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