diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index b239e31bf..3701f6a37 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -103,7 +103,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);