Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
*.dat
optimizer/Tests/*.exe
build
data
CMakeCache.txt
CMakeFiles
cmake_install.cmake
Expand Down
16 changes: 8 additions & 8 deletions unit_tests/Physics/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ message(STATUS "Adding unit tests found in ${_relPath}")
add_opalx_test(TestLinearCompton USE_GTEST_MAIN)

# TestLinearComptonSpectrum disabled: CAIN reference CSV files missing from data/
# add_opalx_test(TestLinearComptonSpectrum USE_GTEST_MAIN NO_MPI)
add_opalx_test(TestLinearComptonSpectrum USE_GTEST_MAIN NO_MPI)

add_executable(LinearComptonSpectrumBenchmark LinearComptonSpectrumBenchmark.cpp)
target_link_libraries(LinearComptonSpectrumBenchmark PRIVATE opalx)
target_include_directories(LinearComptonSpectrumBenchmark PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
# target_compile_definitions(TestLinearComptonSpectrum PRIVATE
# OPALX_TEST_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}"
# OPALX_LINEAR_COMPTON_BENCHMARK="$<TARGET_FILE:LinearComptonSpectrumBenchmark>"
# )
target_compile_definitions(TestLinearComptonSpectrum PRIVATE
OPALX_TEST_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}"
OPALX_LINEAR_COMPTON_BENCHMARK="$<TARGET_FILE:LinearComptonSpectrumBenchmark>"
)

add_opalx_test(TestLinearBreitWheeler USE_GTEST_MAIN)

Expand All @@ -26,6 +26,6 @@ add_opalx_test(TestPionDecaySpectrum USE_GTEST_MAIN)
add_executable(LinearBreitWheelerBenchmark LinearBreitWheelerBenchmark.cpp)
target_link_libraries(LinearBreitWheelerBenchmark PRIVATE opalx)
target_include_directories(LinearBreitWheelerBenchmark PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
#target_compile_definitions(TestLinearBreitWheelerSpectrum PRIVATE
# OPALX_TEST_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}"
#)
target_compile_definitions(TestLinearBreitWheelerSpectrum PRIVATE
OPALX_TEST_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}"
)
7 changes: 5 additions & 2 deletions unit_tests/Physics/TestLinearBreitWheelerSpectrum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
#include "Utilities/Options.h"
#include "gtest/gtest.h"

#include <cstddef>
#include <filesystem>
#include <stdexcept>
#include <vector>

namespace {
std::filesystem::path referenceElectronEnergyPath() {
Expand Down Expand Up @@ -232,7 +235,7 @@ TEST(TestLinearBreitWheelerSpectrum, ElectronJointSpectrumMatchesCainReference)
const int previousSeed = Options::seed;
Options::seed = 13579;

LinearBreitWheelerBenchmark::JointHistogramConfig config;
auto config = fastJointHistogramConfig();
const auto opalx = LinearBreitWheelerBenchmark::sampleJointHistogram(
config, LinearBreitWheelerBenchmark::FinalState::Electron, 250000);
const auto cain =
Expand All @@ -259,7 +262,7 @@ TEST(TestLinearBreitWheelerSpectrum, PositronJointSpectrumMatchesCainReference)
const int previousSeed = Options::seed;
Options::seed = 13579;

LinearBreitWheelerBenchmark::JointHistogramConfig config;
auto config = fastJointHistogramConfig();
const auto opalx = LinearBreitWheelerBenchmark::sampleJointHistogram(
config, LinearBreitWheelerBenchmark::FinalState::Positron, 250000);
const auto cain =
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# center_GeV,density_per_GeV,count
0.0031250000000000002,0,0
0.0093750000000000014,0,0
0.015625,0,0
0.021875000000000002,0,0
0.028125000000000001,0,0
0.034375000000000003,0,0
0.040625000000000001,0,0
0.046875,0,0
0.053125000000000006,0,0
0.059375000000000004,1.5809723679611178,112.45382331433876
0.065625000000000003,4.1273172437923042,293.57414051088477
0.071875000000000008,4.2252535851704289,300.54030655690593
0.078125,4.0293809024141796,286.60797446486362
0.084375000000000006,3.749562784190966,266.70464290480317
0.090625000000000011,3.4977264777900765,248.79164450074896
0.096875000000000003,3.4557537600565955,245.80614476673998
0.10312500000000001,3.1479538300110694,223.91248005067411
0.109375,3.0779993004552679,218.93664716065913
0.11562500000000001,3.0640083945441079,217.94148058265614
0.12187500000000001,2.5183630640088568,179.12998404053937
0.12812500000000002,2.7142357467651008,193.06231613258129
0.13437499999999999,2.6442812172092993,188.08648324256632
0.140625,2.4064358167195743,171.16865141651542
0.14687500000000001,2.2245540398744907,158.23148590247649
0.15312500000000001,2.4064358167195743,171.16865141651542
0.15937500000000002,2.3924449108084143,170.17348483851242
0.16562500000000002,2.3364812871637732,166.19281852650045
0.171875,2.4204267226307348,172.16381799451841
0.17812500000000001,2.0286813571182467,144.29915381043458
0.18437500000000001,2.1965722280521702,156.2411527464705
0.19062500000000002,2.1406086044075292,152.26048643445853
0.19687500000000002,2.0706540748517277,147.28465354444356
0.203125,2.1685904162298497,154.25081959046452
0.20937500000000001,2.1406086044075292,152.26048643445853
0.21562500000000001,2.1545995103186892,153.25565301246152
0.22187500000000002,1.8887722980066439,134.34748803040463
0.22812500000000002,1.8048268625396824,128.37648856238667
0.234375,2.0986358866740482,149.27498670044955
0.24062500000000001,1.6089541797834384,114.44415647034475
0.24687500000000001,1.7908359566285221,127.38132198438367
0.25312499999999999,1.8188177684508426,129.37165514038966
0.25937500000000002,1.8467995802731632,131.36198829639565
0.265625,1.9307450157401249,137.33298776441362
0.27187500000000003,1.8328086743620029,130.36682171839266
0.27812500000000001,1.7908359566285221,127.38132198438367
0.28437499999999999,2.0986358866740482,149.27498670044955
0.29062500000000002,2.0006995452959262,142.30882065442859
0.296875,2.1266176984963687,151.26531985645553
0.30312500000000003,2.0986358866740482,149.27498670044955
0.30937500000000001,2.0706540748517277,147.28465354444356
0.31562500000000004,2.2945085694302922,163.20731879249146
0.32187500000000002,2.1685904162298497,154.25081959046452
0.328125,2.3224903812526128,165.19765194849745
0.33437500000000003,1.9867086393847659,141.31365407642559
0.34062500000000001,2.3084994753414523,164.20248537049446
0.34687500000000004,2.2665267576079717,161.21698563648548
0.35312500000000002,2.2105631339633307,157.2363193244735
0.359375,2.2525358516968113,160.22181905848248
0.36562500000000003,2.4763903462753758,176.14448430653039
0.37187500000000001,2.4903812521865363,177.13965088453338
0.37812500000000004,3.0220356768106269,214.95598084864716
0.38437500000000002,2.5883175935646583,184.10581693055434
0.390625,3.1619447359222295,224.9076466286771
0.39687500000000003,2.9520811472548254,209.98014795863219
0.40312500000000001,3.525708289612397,250.78197765675495
0.40937500000000004,3.5956628191681985,255.75781054676992
0.41562500000000002,3.8195173137467693,271.68047579481828
0.421875,3.749562784190966,266.70464290480317
0.42812500000000003,4.0713536201476614,289.59347419887268
0.43437500000000001,4.770898915705696,339.35180309902381
0.44062500000000004,2.2385449457856512,159.22665248047949
0.44687500000000002,0,0
0.453125,0,0
0.45937500000000003,0,0
0.46562500000000001,0,0
0.47187500000000004,0,0
0.47812500000000002,0,0
0.484375,0,0
0.49062500000000003,0,0
0.49687500000000001,0,0
Loading