diff --git a/CMakeLists.txt b/CMakeLists.txt index f9af1f2cf..a0148b8a8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,6 +18,8 @@ include(cmake/Key4hepConfig.cmake) # - Use GNU-style hierarchy for installing build products include(GNUInstallDirs) +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") + include(cmake/EDM4HEPBuild.cmake) edm4hep_set_linker_flags() diff --git a/cmake/FindHepMC.cmake b/cmake/FindHepMC.cmake deleted file mode 100644 index 6287d2efd..000000000 --- a/cmake/FindHepMC.cmake +++ /dev/null @@ -1,34 +0,0 @@ -# - Locate HepMC library -# Defines: -# -# HEPMC_FOUND -# HEPMC_INCLUDE_DIR -# HEPMC_INCLUDE_DIRS (not cached) -# HEPMC__LIBRARY -# HEPMC_LIBRARIES (not cached) -# HEPMC_LIBRARY_DIRS (not cached) - -find_path(HEPMC_INCLUDE_DIR HepMC/GenEvent.h) -set(HEPMC_INCLUDE_DIRS ${HEPMC_INCLUDE_DIR}) - -if(NOT HepMC_FIND_COMPONENTS) - set(HepMC_FIND_COMPONENTS HepMC) -endif() -foreach(component ${HepMC_FIND_COMPONENTS}) - find_library(HEPMC_${component}_LIBRARY NAMES HepMC${component} ${component}) - mark_as_advanced(HEPMC_${component}_LIBRARY) - list(APPEND HEPMC_LIBRARIES ${HEPMC_${component}_LIBRARY}) - get_filename_component(_comp_dir ${HEPMC_${component}_LIBRARY} PATH) - list(APPEND HEPMC_LIBRARY_DIRS ${_comp_dir}) -endforeach() -if(HEPMC_LIBRARY_DIRS) - list(REMOVE_DUPLICATES HEPMC_LIBRARY_DIRS) -endif() - -# handle the QUIETLY and REQUIRED arguments and set HEPMC_FOUND to TRUE if -# all listed variables are TRUE -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(HepMC DEFAULT_MSG HEPMC_INCLUDE_DIR HEPMC_LIBRARIES) - -mark_as_advanced(HEPMC_FOUND HEPMC_INCLUDE_DIR) - diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index b45e8f03e..37a18f560 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -104,7 +104,7 @@ IF(TARGET ROOT::ROOTDataFrame) endif() -find_package(HepMC3) +find_package(HepMC3 3.3) find_package(HepPDT) if(HepMC3_FOUND AND HepPDT_FOUND ) diff --git a/test/hepmc/edm4hep_testhepmc.cc b/test/hepmc/edm4hep_testhepmc.cc index 4828cf49b..163bdb9c6 100644 --- a/test/hepmc/edm4hep_testhepmc.cc +++ b/test/hepmc/edm4hep_testhepmc.cc @@ -4,9 +4,7 @@ // and converting it to the edm4hep data model ////////////////////////////////////////////////////////////////////////// -#include -#include -#include +#include "edm4hep/MCParticleCollection.h" #include "HepMC3/GenEvent.h" #include "HepMC3/GenParticle.h" @@ -19,7 +17,9 @@ #include "podio/Frame.h" #include "podio/ROOTWriter.h" -#include "edm4hep/MCParticleCollection.h" +#include +#include +#include using namespace HepMC3; @@ -65,39 +65,39 @@ int main() { // # // First create the event container - auto evt = new GenEvent(); + auto evt = std::make_unique(); // define the units evt->set_units(HepMC3::Units::GEV, HepMC3::Units::MM); // // create vertex 1 and vertex 2, together with their inparticles - GenVertex* v1 = new GenVertex(); + auto v1 = std::make_shared(); evt->add_vertex(v1); - v1->add_particle_in(new GenParticle(FourVector(0, 0, 7000, 7000), 2212, 3)); - GenVertex* v2 = new GenVertex(); + v1->add_particle_in(std::make_shared(FourVector(0, 0, 7000, 7000), 2212, 3)); + auto v2 = std::make_shared(); evt->add_vertex(v2); - v2->add_particle_in(new GenParticle(FourVector(0, 0, -7000, 7000), 2212, 3)); + v2->add_particle_in(std::make_shared(FourVector(0, 0, -7000, 7000), 2212, 3)); // // create the outgoing particles of v1 and v2 - GenParticle* p3 = new GenParticle(FourVector(.750, -1.569, 32.191, 32.238), 1, 3); + auto p3 = std::make_shared(FourVector(.750, -1.569, 32.191, 32.238), 1, 3); v1->add_particle_out(p3); - GenParticle* p4 = new GenParticle(FourVector(-3.047, -19., -54.629, 57.920), -2, 3); + auto p4 = std::make_shared(FourVector(-3.047, -19., -54.629, 57.920), -2, 3); v2->add_particle_out(p4); // // create v3 - GenVertex* v3 = new GenVertex(); + auto v3 = std::make_shared(); evt->add_vertex(v3); v3->add_particle_in(p3); v3->add_particle_in(p4); - v3->add_particle_out(new GenParticle(FourVector(-3.813, 0.113, -1.833, 4.233), 22, 1)); - GenParticle* p5 = new GenParticle(FourVector(1.517, -20.68, -20.605, 85.925), -24, 3); + v3->add_particle_out(std::make_shared(FourVector(-3.813, 0.113, -1.833, 4.233), 22, 1)); + auto p5 = std::make_shared(FourVector(1.517, -20.68, -20.605, 85.925), -24, 3); v3->add_particle_out(p5); // // create v4 - GenVertex* v4 = new GenVertex(FourVector(0.12, -0.3, 0.05, 0.004)); + auto v4 = std::make_shared(FourVector(0.12, -0.3, 0.05, 0.004)); evt->add_vertex(v4); v4->add_particle_in(p5); - v4->add_particle_out(new GenParticle(FourVector(-2.445, 28.816, 6.082, 29.552), 1, 1)); - v4->add_particle_out(new GenParticle(FourVector(3.962, -49.498, -26.687, 56.373), -2, 1)); + v4->add_particle_out(std::make_shared(FourVector(-2.445, 28.816, 6.082, 29.552), 1, 1)); + v4->add_particle_out(std::make_shared(FourVector(3.962, -49.498, -26.687, 56.373), -2, 1)); // // the event is complete, we now print it out to the screen Print::content(*evt);