Skip to content

Commit

Permalink
Remove internal usage of deprecated reader / writer
Browse files Browse the repository at this point in the history
  • Loading branch information
tmadlener committed Jan 31, 2024
1 parent ca93c5e commit 9ced502
Show file tree
Hide file tree
Showing 17 changed files with 49 additions and 51 deletions.
4 changes: 2 additions & 2 deletions python/podio/root_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def __init__(self, filenames):
if isinstance(filenames, str):
filenames = (filenames,)

self._reader = podio.ROOTFrameReader()
self._reader = podio.ROOTReader()
self._reader.openFiles(filenames)

super().__init__()
Expand Down Expand Up @@ -78,7 +78,7 @@ def __init__(self, filename):
Args:
filename (str): The name of the output file
"""
self._writer = podio.ROOTFrameWriter(filename)
self._writer = podio.ROOTWriter(filename)
super().__init__()


Expand Down
2 changes: 0 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,8 @@ endif()

SET(root_headers
${PROJECT_SOURCE_DIR}/include/podio/ROOTReader.h
${PROJECT_SOURCE_DIR}/include/podio/ROOTFrameReader.h
${PROJECT_SOURCE_DIR}/include/podio/ROOTLegacyReader.h
${PROJECT_SOURCE_DIR}/include/podio/ROOTWriter.h
${PROJECT_SOURCE_DIR}/include/podio/ROOTFrameWriter.h
)
if(ENABLE_RNTUPLE)
list(APPEND root_headers
Expand Down
4 changes: 2 additions & 2 deletions src/root_selection.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<lcgdict>
<selection>
<class name="podio::ROOTFrameReader"/>
<class name="podio::ROOTReader"/>
<class name="podio::ROOTLegacyReader"/>
<class name="podio::ROOTFrameWriter"/>
<class name="podio::ROOTWriter"/>
<class name="podio::RNTupleReader"/>
<class name="podio::RNTupleWriter"/>
</selection>
Expand Down
8 changes: 4 additions & 4 deletions tests/root_io/read_and_write_associated.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "podio/Frame.h"
#include "podio/ROOTFrameReader.h"
#include "podio/ROOTFrameWriter.h"
#include "podio/ROOTReader.h"
#include "podio/ROOTWriter.h"

#include "datamodel/EventInfoCollection.h"
#include "datamodel/ExampleClusterCollection.h"
Expand All @@ -10,7 +10,7 @@
#include <string>

void writeCollection() {
podio::ROOTFrameWriter writer("associations.root");
podio::ROOTWriter writer("associations.root");

std::cout << "start writting collections...\n";

Expand Down Expand Up @@ -70,7 +70,7 @@ void writeCollection() {

void readCollection() {
// Start reading the input
auto reader = podio::ROOTFrameReader();
auto reader = podio::ROOTReader();
reader.openFile("associations.root");

const auto nEvents = reader.getEntries(podio::Category::Event);
Expand Down
8 changes: 4 additions & 4 deletions tests/root_io/read_and_write_frame_root.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#include "read_and_write_frame.h"

#include "podio/ROOTFrameReader.h"
#include "podio/ROOTFrameWriter.h"
#include "podio/ROOTReader.h"
#include "podio/ROOTWriter.h"

int main() {
return rewrite_frames<podio::ROOTFrameReader, podio::ROOTFrameWriter>("example_frame.root", "rewritten_frame.root") +
read_rewritten_frames<podio::ROOTFrameReader>("rewritten_frame.root");
return rewrite_frames<podio::ROOTReader, podio::ROOTWriter>("example_frame.root", "rewritten_frame.root") +
read_rewritten_frames<podio::ROOTReader>("rewritten_frame.root");
}
6 changes: 3 additions & 3 deletions tests/root_io/read_frame_root.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "read_frame.h"
#include "read_frame_auxiliary.h"

#include "podio/ROOTFrameReader.h"
#include "podio/ROOTReader.h"

#include <iostream>
#include <string>
Expand All @@ -18,6 +18,6 @@ int main(int argc, char* argv[]) {
return 1;
}

return read_frames<podio::ROOTFrameReader>(inputFile, assertBuildVersion) +
test_frame_aux_info<podio::ROOTFrameReader>(inputFile);
return read_frames<podio::ROOTReader>(inputFile, assertBuildVersion) +
test_frame_aux_info<podio::ROOTReader>(inputFile);
}
6 changes: 3 additions & 3 deletions tests/root_io/read_frame_root_multiple.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "read_frame.h"

#include "podio/ROOTFrameReader.h"
#include "podio/ROOTReader.h"

int read_frames(podio::ROOTFrameReader& reader) {
int read_frames(podio::ROOTReader& reader) {
if (reader.currentFileVersion() != podio::version::build_version) {
std::cerr << "The podio build version could not be read back correctly. "
<< "(expected:" << podio::version::build_version << ", actual: " << reader.currentFileVersion() << ")"
Expand Down Expand Up @@ -83,7 +83,7 @@ int read_frames(podio::ROOTFrameReader& reader) {
}

int main() {
auto reader = podio::ROOTFrameReader();
auto reader = podio::ROOTReader();
reader.openFiles({"example_frame.root", "example_frame.root"});
return read_frames(reader);
}
4 changes: 2 additions & 2 deletions tests/root_io/read_python_frame_root.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "read_python_frame.h"

#include "podio/ROOTFrameReader.h"
#include "podio/ROOTReader.h"

int main() {
return read_frame<podio::ROOTFrameReader>("example_frame_with_py.root");
return read_frame<podio::ROOTReader>("example_frame_with_py.root");
}
8 changes: 4 additions & 4 deletions tests/root_io/relation_range.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#include "datamodel/MutableExampleWithVectorMember.h"

#include "podio/Frame.h"
#include "podio/ROOTFrameReader.h"
#include "podio/ROOTFrameWriter.h"
#include "podio/ROOTReader.h"
#include "podio/ROOTWriter.h"

#include <sstream>
#include <stdexcept>
Expand Down Expand Up @@ -182,7 +182,7 @@ void testExampleReferencingType() {
}

void testWithIO() {
podio::ROOTFrameWriter writer("relation_range_io_test.root");
podio::ROOTWriter writer("relation_range_io_test.root");

for (int i = 0; i < 10; ++i) {
auto collection = ExampleMCCollection();
Expand All @@ -194,7 +194,7 @@ void testWithIO() {
}
writer.finish();

podio::ROOTFrameReader reader;
podio::ROOTReader reader;
reader.openFile("relation_range_io_test.root");

for (int i = 0; i < 10; ++i) {
Expand Down
4 changes: 2 additions & 2 deletions tests/root_io/write_frame_root.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "write_frame.h"

#include "podio/ROOTFrameWriter.h"
#include "podio/ROOTWriter.h"

int main(int, char**) {
write_frames<podio::ROOTFrameWriter>("example_frame.root");
write_frames<podio::ROOTWriter>("example_frame.root");
return 0;
}
4 changes: 2 additions & 2 deletions tests/schema_evolution/root_io/read_new_data_root.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "read_new_data.h"

#include "podio/ROOTFrameReader.h"
#include "podio/ROOTReader.h"

int main() {
return read_new_data<podio::ROOTFrameReader>("example_data_old_schema.root");
return read_new_data<podio::ROOTReader>("example_data_old_schema.root");
}
4 changes: 2 additions & 2 deletions tests/schema_evolution/root_io/write_old_data_root.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "schema_evolution/write_old_data.h"

#include "podio/ROOTFrameWriter.h"
#include "podio/ROOTWriter.h"

int main() {
return writeData<podio::ROOTFrameWriter>("example_data_old_schema.root");
return writeData<podio::ROOTWriter>("example_data_old_schema.root");
}
8 changes: 4 additions & 4 deletions tests/sio_io/read_and_write_frame_sio.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#include "read_and_write_frame.h"

#include "podio/SIOFrameReader.h"
#include "podio/SIOFrameWriter.h"
#include "podio/SIOReader.h"
#include "podio/SIOWriter.h"

int main() {
return rewrite_frames<podio::SIOFrameReader, podio::SIOFrameWriter>("example_frame.sio", "rewritten_frame.sio") +
read_rewritten_frames<podio::SIOFrameReader>("rewritten_frame.sio");
return rewrite_frames<podio::SIOReader, podio::SIOWriter>("example_frame.sio", "rewritten_frame.sio") +
read_rewritten_frames<podio::SIOReader>("rewritten_frame.sio");
}
6 changes: 3 additions & 3 deletions tests/sio_io/read_frame_sio.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "read_frame.h"
#include "read_frame_auxiliary.h"

#include "podio/SIOFrameReader.h"
#include "podio/SIOReader.h"

int main(int argc, char* argv[]) {
std::string inputFile = "example_frame.sio";
Expand All @@ -11,6 +11,6 @@ int main(int argc, char* argv[]) {
assertBuildVersion = false;
}

return read_frames<podio::SIOFrameReader>(inputFile, assertBuildVersion) +
test_frame_aux_info<podio::SIOFrameReader>(inputFile);
return read_frames<podio::SIOReader>(inputFile, assertBuildVersion) +
test_frame_aux_info<podio::SIOReader>(inputFile);
}
4 changes: 2 additions & 2 deletions tests/sio_io/read_python_frame_sio.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "read_python_frame.h"

#include "podio/SIOFrameReader.h"
#include "podio/SIOReader.h"

int main() {
return read_frame<podio::SIOFrameReader>("example_frame_with_py.sio");
return read_frame<podio::SIOReader>("example_frame_with_py.sio");
}
4 changes: 2 additions & 2 deletions tests/sio_io/write_frame_sio.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "write_frame.h"

#include "podio/SIOFrameWriter.h"
#include "podio/SIOWriter.h"

int main(int, char**) {
write_frames<podio::SIOFrameWriter>("example_frame.sio");
write_frames<podio::SIOWriter>("example_frame.sio");
return 0;
}
16 changes: 8 additions & 8 deletions tests/unittests/unittest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
// podio specific includes
#include "podio/Frame.h"
#include "podio/GenericParameters.h"
#include "podio/ROOTFrameReader.h"
#include "podio/ROOTFrameWriter.h"
#include "podio/ROOTLegacyReader.h"
#include "podio/ROOTReader.h"
#include "podio/ROOTWriter.h"
#include "podio/podioVersion.h"

#ifndef PODIO_ENABLE_SIO
Expand Down Expand Up @@ -1099,7 +1099,7 @@ TEST_CASE("Missing files (ROOT readers)", "[basics]") {
auto root_legacy_reader = podio::ROOTLegacyReader();
REQUIRE_THROWS_AS(root_legacy_reader.openFile("NonExistentFile.root"), std::runtime_error);

auto root_frame_reader = podio::ROOTFrameReader();
auto root_frame_reader = podio::ROOTReader();
REQUIRE_THROWS_AS(root_frame_reader.openFile("NonExistentFile.root"), std::runtime_error);
}

Expand Down Expand Up @@ -1155,7 +1155,7 @@ TEST_CASE("JSON", "[json]") {

// Write a template function that can be used with different writers in order to
// be able to tag the unittests differently. This is necessary because the
// ROOTFrameWriter fails with ASan, but the ROOTNTuple writer doesn't
// ROOTWriter fails with ASan, but the ROOTNTuple writer doesn't
template <typename WriterT>
void runConsistentFrameTest(const std::string& filename) {
using Catch::Matchers::ContainsSubstring;
Expand Down Expand Up @@ -1225,13 +1225,13 @@ void runCheckConsistencyTest(const std::string& filename) {
REQUIRE_THAT(superfluous, UnorderedEquals<std::string>({"non-existant"}));
}

TEST_CASE("ROOTFrameWriter consistent frame contents", "[ASAN-FAIL][UBSAN-FAIL][THREAD-FAIL][basics][root]") {
TEST_CASE("ROOTWriter consistent frame contents", "[ASAN-FAIL][UBSAN-FAIL][THREAD-FAIL][basics][root]") {
// The UBSAN-FAIL and TSAN-FAIL only happens on clang12 in CI.
runConsistentFrameTest<podio::ROOTFrameWriter>("unittests_frame_consistency.root");
runConsistentFrameTest<podio::ROOTWriter>("unittests_frame_consistency.root");
}

TEST_CASE("ROOTFrameWriter check consistency", "[ASAN-FAIL][UBSAN-FAIL][basics][root]") {
runCheckConsistencyTest<podio::ROOTFrameWriter>("unittests_frame_check_consistency.root");
TEST_CASE("ROOTWriter check consistency", "[ASAN-FAIL][UBSAN-FAIL][basics][root]") {
runCheckConsistencyTest<podio::ROOTWriter>("unittests_frame_check_consistency.root");
}

#if PODIO_ENABLE_RNTUPLE
Expand Down

0 comments on commit 9ced502

Please sign in to comment.