From 84a3dbe168b5cea179c5d9e1a9783ac60a1f83c4 Mon Sep 17 00:00:00 2001 From: Juan Miguel Carceller <22276694+jmcarcell@users.noreply.github.com> Date: Tue, 6 Feb 2024 19:30:01 +0100 Subject: [PATCH] Change ROOTFrame{Writer,Reader} to ROOT{Writer,Reader} (#263) * Change ROOTFrame{Writer,Reader} to ROOT{Writer,Reader} when possible * Fix pre-commit --------- Co-authored-by: jmcarcell --- test/hepmc/edm4hep_testhepmc.cc | 8 ++++++++ test/read_events.cc | 8 ++++++++ test/write_events.cc | 8 ++++++++ tools/src/edm4hep2json.cxx | 9 +++++++++ 4 files changed, 33 insertions(+) diff --git a/test/hepmc/edm4hep_testhepmc.cc b/test/hepmc/edm4hep_testhepmc.cc index a88ec9e15..7fba466e1 100644 --- a/test/hepmc/edm4hep_testhepmc.cc +++ b/test/hepmc/edm4hep_testhepmc.cc @@ -17,7 +17,11 @@ #include "HepPDT/ParticleID.hh" #include "podio/Frame.h" +#if PODIO_VERSION_MAJOR > 0 || (PODIO_VERSION_MAJOR == 0 && PODIO_VERSION_MINOR >= 99) +#include "podio/ROOTWriter.h" +#else #include "podio/ROOTFrameWriter.h" +#endif #include "edm4hep/MCParticleCollection.h" @@ -154,7 +158,11 @@ int main() { auto event = podio::Frame(); event.put(std::move(edm_particle_collection), "TestParticles2"); +#if PODIO_VERSION_MAJOR > 0 || (PODIO_VERSION_MAJOR == 0 && PODIO_VERSION_MINOR >= 99) + auto writer = podio::ROOTWriter("edm4hep_testhepmc.root"); +#else auto writer = podio::ROOTFrameWriter("edm4hep_testhepmc.root"); +#endif writer.writeFrame(event, "events"); // after all events diff --git a/test/read_events.cc b/test/read_events.cc index be6d3e179..9adf18472 100644 --- a/test/read_events.cc +++ b/test/read_events.cc @@ -1,8 +1,16 @@ #include "read_events.h" +#if PODIO_VERSION_MAJOR > 0 || (PODIO_VERSION_MAJOR == 0 && PODIO_VERSION_MINOR >= 99) +#include "podio/ROOTReader.h" +#else #include "podio/ROOTFrameReader.h" +#endif int main() { +#if PODIO_VERSION_MAJOR > 0 || (PODIO_VERSION_MAJOR == 0 && PODIO_VERSION_MINOR >= 99) + read_events("edm4hep_events.root"); +#else read_events("edm4hep_events.root"); +#endif return 0; } diff --git a/test/write_events.cc b/test/write_events.cc index e1bad3800..a9c1dbe06 100644 --- a/test/write_events.cc +++ b/test/write_events.cc @@ -1,7 +1,15 @@ #include "write_events.h" +#if PODIO_VERSION_MAJOR > 0 || (PODIO_VERSION_MAJOR == 0 && PODIO_VERSION_MINOR >= 99) +#include "podio/ROOTWriter.h" +#else #include "podio/ROOTFrameWriter.h" +#endif int main(int, char*[]) { +#if PODIO_VERSION_MAJOR > 0 || (PODIO_VERSION_MAJOR == 0 && PODIO_VERSION_MINOR >= 99) + write("edm4hep_events.root"); +#else write("edm4hep_events.root"); +#endif } diff --git a/tools/src/edm4hep2json.cxx b/tools/src/edm4hep2json.cxx index affbf2b4a..49e3ddfe4 100644 --- a/tools/src/edm4hep2json.cxx +++ b/tools/src/edm4hep2json.cxx @@ -5,7 +5,11 @@ #include "TFile.h" // podio +#if PODIO_VERSION_MAJOR > 0 || (PODIO_VERSION_MAJOR == 0 && PODIO_VERSION_MINOR >= 99) +#include "podio/ROOTReader.h" +#else #include "podio/ROOTFrameReader.h" +#endif #include "podio/ROOTLegacyReader.h" // std @@ -131,8 +135,13 @@ int main(int argc, char** argv) { return read_frames(inFilePath, outFilePath, requestedCollections, requestedEvents, frameName, nEventsMax, verboser); } else { +#if PODIO_VERSION_MAJOR > 0 || (PODIO_VERSION_MAJOR == 0 && PODIO_VERSION_MINOR >= 99) + return read_frames(inFilePath, outFilePath, requestedCollections, requestedEvents, frameName, + nEventsMax, verboser); +#else return read_frames(inFilePath, outFilePath, requestedCollections, requestedEvents, frameName, nEventsMax, verboser); +#endif } return EXIT_SUCCESS;