From e8b94b860a671461b9e9c8c36217bb4b26d22115 Mon Sep 17 00:00:00 2001 From: jmcarcell Date: Tue, 6 Feb 2024 18:23:07 +0100 Subject: [PATCH] Change ROOTFrame{Writer,Reader} to ROOT{Writer,Reader} when possible --- 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..05ce69a2b 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 __has_include("podio/ROOTWriter.h") +#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 __has_include("podio/ROOTWriter.h") + 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..f3b90c750 100644 --- a/test/read_events.cc +++ b/test/read_events.cc @@ -1,8 +1,16 @@ #include "read_events.h" +#if __has_include("podio/ROOTReader.h") +#include "podio/ROOTReader.h" +#else #include "podio/ROOTFrameReader.h" +#endif int main() { +#if __has_include("podio/ROOTReader.h") + 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..5b8c18451 100644 --- a/test/write_events.cc +++ b/test/write_events.cc @@ -1,7 +1,15 @@ #include "write_events.h" +#if __has_include("podio/ROOTWriter.h") +#include "podio/ROOTWriter.h" +#else #include "podio/ROOTFrameWriter.h" +#endif int main(int, char*[]) { +#if __has_include("podio/ROOTWriter.h") + write("edm4hep_events.root"); +#else write("edm4hep_events.root"); +#endif } diff --git a/tools/src/edm4hep2json.cxx b/tools/src/edm4hep2json.cxx index affbf2b4a..530aba28c 100644 --- a/tools/src/edm4hep2json.cxx +++ b/tools/src/edm4hep2json.cxx @@ -5,7 +5,11 @@ #include "TFile.h" // podio +#if __has_include("podio/ROOTReader.h") +#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 __has_include("podio/ROOTReader.h") + 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;