Skip to content
Merged
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
24 changes: 15 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ endif(APPLE)

include(GNUInstallDirs)

include(CTest)

find_package(podio 0.15)
if(NOT podio_FOUND)
find_package(podio 1.0 REQUIRED)
Expand Down Expand Up @@ -93,16 +95,20 @@ configure_file(
${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
@ONLY)

find_package(Doxygen COMPONENTS dot)
if(DOXYGEN_FOUND)
add_custom_target(docs ALL
DEPENDS edm4eic.yaml ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Generating API documentation with Doxygen"
option(GENERATE_DOCS "Generate the doxygen base API reference" ON)

if (GENERATE_DOCS)
find_package(Doxygen COMPONENTS dot)
if(DOXYGEN_FOUND)
add_custom_target(docs ALL
DEPENDS edm4eic.yaml ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Generating API documentation with Doxygen"
VERBATIM)
else()
message(STATUS "Doxygen not found; no documentation will be built.")
else()
message(STATUS "Doxygen not found; no documentation will be built.")
endif()
endif()

# -------------------------
Expand Down
51 changes: 4 additions & 47 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ ENDIF()

function(set_test_env _testname)
set_property(TEST ${_testname} APPEND PROPERTY ENVIRONMENT
LD_LIBRARY_PATH=$<TARGET_FILE_DIR:edm4hep>:$<TARGET_FILE_DIR:podio::podio>:$<$<TARGET_EXISTS:edm4hepRDF>:$<TARGET_FILE_DIR:edm4hepRDF>:>$<TARGET_FILE_DIR:ROOT::Core>:$ENV{LD_LIBRARY_PATH}
ROOT_INCLUDE_PATH=${PROJECT_SOURCE_DIR}/edm4hep:${PROJECT_SOURCE_DIR}/utils/include:$ENV{ROOT_INCLUDE_PATH}
LD_LIBRARY_PATH=$<TARGET_FILE_DIR:edm4eic>:$<TARGET_FILE_DIR:EDM4HEP::edm4hep>:$<TARGET_FILE_DIR:podio::podio>:$<$<TARGET_EXISTS:EDM4HEP::edm4hepRDF>:$<TARGET_FILE_DIR:EDM4HEP::edm4hepRDF>:>$<TARGET_FILE_DIR:ROOT::Core>:$ENV{LD_LIBRARY_PATH}
ROOT_INCLUDE_PATH=${PROJECT_SOURCE_DIR}/utils/include:$ENV{ROOT_INCLUDE_PATH}
)
set_tests_properties(${_testname} PROPERTIES
FAIL_REGULAR_EXPRESSION "[^a-z]Error;ERROR;error;Failed"
Expand All @@ -16,58 +16,15 @@ endfunction()

add_executable(write_events write_events.cc)
target_include_directories(write_events PUBLIC ${PROJECT_SOURCE_DIR}/edm4hep )
target_link_libraries(write_events edm4hep podio::podioRootIO)
target_link_libraries(write_events edm4eic EDM4HEP::edm4hep podio::podioRootIO)
add_test(NAME write_events COMMAND write_events)
set_test_env(write_events)

add_executable(read_events read_events.cc)
target_include_directories(read_events PUBLIC ${PROJECT_SOURCE_DIR}/edm4hep )
target_link_libraries(read_events edm4hep podio::podioRootIO)
target_link_libraries(read_events edm4eic EDM4HEP::edm4hep podio::podioRootIO)
add_test(NAME read_events COMMAND read_events)
set_property(TEST read_events PROPERTY
DEPENDS write_events
)
set_test_env(read_events)

IF(TARGET ROOT::ROOTDataFrame)
add_executable(test_rdf test_rdf.cc)
target_include_directories(test_rdf PUBLIC ${PROJECT_SOURCE_DIR}/edm4hep ${PROJECT_SOURCE_DIR}/dataframe )
target_link_libraries(test_rdf edm4hepRDF ROOT::ROOTDataFrame podio::podioRootIO)
add_test(NAME test_rdf COMMAND test_rdf)
set_test_env(test_rdf)
set_property(TEST test_rdf PROPERTY
DEPENDS write_events
)

add_test(NAME py_test_rdf COMMAND python ${CMAKE_CURRENT_LIST_DIR}/test_rdf.py)
set_test_env(py_test_rdf)
get_property(ENVIRONMENT TEST py_test_rdf PROPERTY ENVIRONMENT)
set_property(TEST py_test_rdf PROPERTY ENVIRONMENT
${ENVIRONMENT}
PYTHONPATH=${PROJECT_SOURCE_DIR}/python:$ENV{PYTHONPATH}
)
set_tests_properties(py_test_rdf PROPERTIES DEPENDS write_events)
endif()


find_package(HepMC3)
find_package(HepPDT)

if(HepMC3_FOUND AND HepPDT_FOUND )
add_executable(edm4hep_testhepmc hepmc/edm4hep_testhepmc.cc)
target_include_directories(edm4hep_testhepmc PUBLIC ${HEPMC3_INCLUDE_DIR} ${HEPPDT_INCLUDE_DIR} )
target_link_libraries(edm4hep_testhepmc edm4hep podio::podioRootIO ${HEPPDT_LIBRARIES} ${HEPMC3_LIBRARIES})
add_test(NAME edm4hep_testhepmc COMMAND edm4hep_testhepmc)
set_test_env(edm4hep_testhepmc)
set_property(TEST edm4hep_testhepmc APPEND PROPERTY ENVIRONMENT
ROOT_INCLUDE_PATH=${HEPMC3_INCLUDE_DIR}:$ENV{ROOT_INCLUDE_PATH}
)
endif()

if (nlohmann_json_FOUND)
add_test(NAME convert_events COMMAND edm4hep2json edm4hep_events.root)
set_property(TEST convert_events PROPERTY DEPENDS write_events)
set_test_env(convert_events)
endif()

add_subdirectory(utils)
13 changes: 11 additions & 2 deletions test/read_events.cc
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
// SPDX-License-Identifier: Apache-2.0

#include "read_events.h"
#include "podio/ROOTFrameReader.h"

#include <podio/podioVersion.h>
#if PODIO_BUILD_VERSION >= PODIO_VERSION(0, 99, 0)
#include <podio/ROOTReader.h>
#else
#include <podio/ROOTFrameReader.h>
namespace podio {
using ROOTReader = podio::ROOTFrameReader;
}
#endif

int main() {
read_events<podio::ROOTFrameReader>("edm4eic_events.root");
read_events<podio::ROOTReader>("edm4eic_events.root");

return 0;
}
11 changes: 10 additions & 1 deletion test/read_events.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

// podio specific includes
#include "podio/Frame.h"
#include "podio/podioVersion.h"

// STL
#include <cassert>
Expand All @@ -18,7 +19,11 @@
void processEvent(const podio::Frame& event, bool verboser, unsigned eventNum) {
auto& raw_hits = event.get<edm4eic::RawTrackerHitCollection>("RawTrackerHits");

#if PODIO_BUILD_VERSION >= PODIO_VERSION(1, 6, 0)
if (raw_hits.hasID()) {
#else
if (raw_hits.isValid()) {
#endif

//-------- print particles for debugging:

Expand All @@ -40,7 +45,11 @@ void processEvent(const podio::Frame& event, bool verboser, unsigned eventNum) {
//===============================================================================

const auto& evtType = event.getParameter<std::string>("EventType");
std::cout << "Event Type: " << evtType << std::endl;
#if PODIO_BUILD_VERSION >= PODIO_VERSION(1, 0, 0)
std::cout << "Event Type: " << evtType.value_or("EventType does not exist in Frame as parameter") << std::endl;
#else
std::cout << "Event Type: " << evtType.value() << std::endl;
#endif
}

template <typename ReaderT>
Expand Down
35 changes: 0 additions & 35 deletions test/test_rdf.cc

This file was deleted.

31 changes: 0 additions & 31 deletions test/test_rdf.py

This file was deleted.

15 changes: 12 additions & 3 deletions test/write_events.cc
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
// SPDX-License-Identifier: Apache-2.0

#include "write_events.h"
#include "podio/ROOTFrameWriter.h"

int main(int argc, char* argv[]) {
#include <podio/podioVersion.h>
#if PODIO_BUILD_VERSION >= PODIO_VERSION(0, 99, 0)
#include <podio/ROOTWriter.h>
#else
#include <podio/ROOTFrameWriter.h>
namespace podio {
using ROOTWriter = podio::ROOTFrameWriter;
}
#endif

int main(int argc, char *argv[]) {

write<podio::ROOTFrameWriter>("edm4eic_events.root");
write<podio::ROOTWriter>("edm4eic_events.root");
}
Loading