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 e8b94b8
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 __has_include("podio/ROOTWriter.h")
#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 __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
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 __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<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 __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<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 __has_include("podio/ROOTReader.h")
#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 __has_include("podio/ROOTReader.h")
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 e8b94b8

Please sign in to comment.