Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions Framework/Utils/test/test_RootTreeReader.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ using namespace o2::framework;
LOG(ERROR) << R"(Test condition ")" #condition R"(" failed)"; \
}

constexpr int kTreeSize = 10; // elements in the test tree
const int gTreeSize = 10; // elements in the test tree
DataProcessorSpec getSourceSpec()
{
auto initFct = [](InitContext& ic) {
Expand All @@ -48,7 +48,7 @@ DataProcessorSpec getSourceSpec()
std::vector<o2::test::Polymorphic> valarray;
auto* branch = testTree->Branch("dataarray", &valarray);

for (int entry = 0; entry < kTreeSize; entry++) {
for (int entry = 0; entry < gTreeSize; entry++) {
valarray.clear();
for (int idx = 0; idx < entry + 1; ++idx) {
valarray.emplace_back((entry * 10) + idx);
Expand All @@ -68,6 +68,9 @@ DataProcessorSpec getSourceSpec()
RootTreeReader::PublishingMode::Single);

auto processingFct = [reader](ProcessingContext& pc) {
if (reader->getCount() >= gTreeSize) {
return;
}
if (reader->getCount() == 0) {
// add two additional headers on the stack in the first entry
o2::header::NameHeader<16> auxHeader("extended_info");
Expand All @@ -77,8 +80,9 @@ DataProcessorSpec getSourceSpec()
// test signature without headers for the rest of the entries
(++(*reader))(pc);
}
if ((reader->getCount() + 1) >= kTreeSize) {
if ((reader->getCount()) >= gTreeSize) {
pc.services().get<ControlService>().endOfStream();
pc.services().get<ControlService>().readyToQuit(QuitRequest::Me);
}
};

Expand Down Expand Up @@ -119,10 +123,7 @@ DataProcessorSpec getSinkSpec()
LOG(INFO) << data[idx].get();
ASSERT_ERROR(data[idx].get() == 10 * counter + idx);
}
if (++counter >= kTreeSize) {
pc.services().get<ControlService>().endOfStream();
pc.services().get<ControlService>().readyToQuit(QuitRequest::Me);
}
++counter;
};

return DataProcessorSpec{"sink", // name of the processor
Expand Down
6 changes: 4 additions & 2 deletions Framework/Utils/test/test_RootTreeWriterWorkflow.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,17 @@ DataProcessorSpec getSourceSpec()
auto processingFct = [counter](ProcessingContext& pc) {
if (*counter >= sTreeSize) {
// don't publish more
pc.services().get<ControlService>().endOfStream();
pc.services().get<ControlService>().readyToQuit(QuitRequest::Me);
return;
}
o2::test::Polymorphic a(*counter);
pc.outputs().snapshot(OutputRef{"output"}, a);
int& metadata = pc.outputs().make<int>(Output{"TST", "METADATA", 0, Lifetime::Timeframe});
metadata = *counter;
*counter = *counter + 1;
if (*counter >= sTreeSize) {
pc.services().get<ControlService>().endOfStream();
pc.services().get<ControlService>().readyToQuit(QuitRequest::Me);
}
};

return processingFct;
Expand Down