Skip to content

Commit

Permalink
Change ROOTFrame{Writer,Reader} to ROOT{Writer,Reader} when possible
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcarcell committed Feb 6, 2024
1 parent 9fc0b00 commit b628e08
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/hepmc/edm4hep_testhepmc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions test/read_events.cc
Original file line number Diff line number Diff line change
@@ -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<podio::ROOTReader>("edm4hep_events.root");
#else
read_events<podio::ROOTFrameReader>("edm4hep_events.root");
#endif

return 0;
}
8 changes: 8 additions & 0 deletions test/write_events.cc
Original file line number Diff line number Diff line change
@@ -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<podio::ROOTWriter>("edm4hep_events.root");
#else
write<podio::ROOTFrameWriter>("edm4hep_events.root");
#endif
}
9 changes: 9 additions & 0 deletions tools/src/edm4hep2json.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -131,8 +135,13 @@ int main(int argc, char** argv) {
return read_frames<podio::ROOTLegacyReader>(inFilePath, outFilePath, requestedCollections, requestedEvents,
frameName, nEventsMax, verboser);
} else {
#if PODIO_VERSION_MAJOR > 0 || (PODIO_VERSION_MAJOR == 0 && PODIO_VERSION_MINOR >= 99)
return read_frames<podio::ROOTReader>(inFilePath, outFilePath, requestedCollections, requestedEvents,
frameName, nEventsMax, verboser);
#else
return read_frames<podio::ROOTFrameReader>(inFilePath, outFilePath, requestedCollections, requestedEvents,
frameName, nEventsMax, verboser);
#endif
}

return EXIT_SUCCESS;
Expand Down

0 comments on commit b628e08

Please sign in to comment.