64 {
65 auto reader = ReaderT();
66 try {
67 reader.openFile(filename);
68 } catch (const std::runtime_error& e) {
69 std::cout << "File could not be opened, aborting." << std::endl;
70 return 1;
71 }
72
73 if (reader.currentFileVersion() != podio::version::build_version) {
74 std::cerr << "The podio build version could not be read back correctly. "
75 << "(expected:" << podio::version::build_version << ", actual: " << reader.currentFileVersion() << ")"
76 << std::endl;
77 return 1;
78 }
79
80 if (reader.getEntries("events") != 10) {
81 std::cerr << "Could not read back the number of events correctly. "
82 << "(expected:" << 10 << ", actual: " << reader.getEntries("events") << ")" << std::endl;
83 return 1;
84 }
85
86 if (reader.getEntries("events") != reader.getEntries("other_events")) {
87 std::cerr << "Could not read back the number of events correctly. "
88 << "(expected:" << 10 << ", actual: " << reader.getEntries("other_events") << ")" << std::endl;
89 return 1;
90 }
91
92
93
94 for (size_t i = 0; i < reader.getEntries("events"); ++i) {
95 auto frame =
podio::Frame(reader.readNextEntry(
"events"));
96 if (frame.get("emptySubsetColl") == nullptr) {
97 std::cerr << "Could not retrieve an empty subset collection" << std::endl;
98 return 1;
99 }
100 if (frame.get("emptyCollection") == nullptr) {
101 std::cerr << "Could not retrieve an empty collection" << std::endl;
102 return 1;
103 }
104
106
107 auto otherFrame =
podio::Frame(reader.readNextEntry(
"other_events"));
108 processEvent(otherFrame, i + 100, reader.currentFileVersion());
109
111 }
112
113 if (reader.readNextEntry("events")) {
114 std::cerr << "Trying to read more frame data than is present should return a nullptr" << std::endl;
115 return 1;
116 }
117
118 std::cout << "========================================================\n" << std::endl;
119 if (reader.readNextEntry("not_present")) {
120 std::cerr << "Trying to read non-existant frame data should return a nullptr" << std::endl;
121 return 1;
122 }
123
124
125 {
126 auto frame =
podio::Frame(reader.readEntry(
"events", 4));
128
129 auto nextFrame =
podio::Frame(reader.readNextEntry(
"events"));
130 processEvent(nextFrame, 5, reader.currentFileVersion());
131
132 auto otherFrame =
podio::Frame(reader.readEntry(
"other_events", 4));
133 processEvent(otherFrame, 4 + 100, reader.currentFileVersion());
135
136
137 auto previousFrame =
podio::Frame(reader.readEntry(
"other_events", 2));
138 processEvent(previousFrame, 2 + 100, reader.currentFileVersion());
140
141
142 if (reader.readEntry("events", 10)) {
143 std::cerr << "Trying to read a specific entry that does not exist should return a nullptr" << std::endl;
144 return 1;
145 }
146 }
147
148 return 0;
149}
void processExtensions(const podio::Frame &event, int iEvent, podio::version::Version)
void processEvent(StoreT &store, int eventNum, podio::version::Version fileVersion)