Skip to content

Commit

Permalink
tests: add MUSUN example to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ManuelHu committed Jan 29, 2025
1 parent 3f91a8c commit 9186f46
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 5 deletions.
11 changes: 11 additions & 0 deletions examples/05-MUSUN/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,14 @@ endif()

add_executable(05-MUSUN main.cc HPGeTestStand.hh HPGeTestStand.cc)
target_link_libraries(05-MUSUN PUBLIC RMG::remage)

# collect auxiliary files
file(
GLOB _aux
RELATIVE ${PROJECT_SOURCE_DIR}
*.csv *.mac)

# copy them to the build area
foreach(_file ${_aux})
configure_file(${PROJECT_SOURCE_DIR}/${_file} ${PROJECT_BINARY_DIR}/${_file} COPYONLY)
endforeach()
4 changes: 3 additions & 1 deletion examples/05-MUSUN/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ int main(int argc, char** argv) {
manager.SetUserInit(new HPGeTestStand());
manager.SetNumberOfThreads(2);
manager.EnablePersistency();
manager.SetOutputOverwriteFiles(true);
manager.GetDetectorConstruction()->RegisterDetector(kGermanium, "HPGe1", 0);
manager.GetDetectorConstruction()->RegisterDetector(kGermanium, "HPGe2", 1);
manager.GetDetectorConstruction()->RegisterDetector(kGermanium, "HPGe3", 2);
Expand All @@ -22,5 +23,6 @@ int main(int argc, char** argv) {
manager.Initialize();
manager.Run();

return 0;
if (manager.HadError()) return 1;
return manager.HadWarning() ? 2 : 0;
}
6 changes: 2 additions & 4 deletions examples/05-MUSUN/run.mac
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@

/RMG/Output/FileName output.root



/RMG/Generator/Confine UnConfined
/RMG/Generator/Select MUSUNCosmicMuons

/RMG/Generator/MUSUNCosmicMuons/SetMUSUNFile MUSUN_10k_events.csv
/RMG/Generator/MUSUNCosmicMuons/SetMUSUNFile MUSUN_100_events.csv

/run/beamOn 1000
/run/beamOn 100
4 changes: 4 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ add_subdirectory(internals)
add_subdirectory(output)
add_subdirectory(python)
add_subdirectory(vertex)

if(RMG_BUILD_EXAMPLES)
add_subdirectory(examples)
endif()
5 changes: 5 additions & 0 deletions tests/examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
add_test(
NAME examples/05-MUSUN
WORKING_DIRECTORY $<TARGET_FILE_DIR:05-MUSUN>
COMMAND 05-MUSUN run.mac)
set_tests_properties(examples/05-MUSUN PROPERTIES LABELS extra)

0 comments on commit 9186f46

Please sign in to comment.