Skip to content

Commit f68c7bf

Browse files
committed
DPL: fix support for parent files
1 parent ea35977 commit f68c7bf

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

Framework/AnalysisSupport/src/DataInputDirector.cxx

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,18 @@ bool DataInputDescriptor::readTree(DataAllocator& outputs, header::DataHeader dh
416416
// FIXME: we should distinguish between an actually missing object and one which has a non compatible
417417
// format.
418418
if (!format) {
419+
LOGP(debug, "Could not find tree {}. Trying in parent file.", fullpath.path());
420+
auto parentFile = getParentFile(counter, numTF, treename);
421+
if (parentFile != nullptr) {
422+
int parentNumTF = parentFile->findDFNumber(0, folder.path());
423+
if (parentNumTF == -1) {
424+
auto parentRootFS = std::dynamic_pointer_cast<TFileFileSystem>(parentFile->mCurrentFilesystem);
425+
throw std::runtime_error(fmt::format(R"(DF {} listed in parent file map but not found in the corresponding file "{}")", folder.path(), parentRootFS->GetFile()->GetName()));
426+
}
427+
// first argument is 0 as the parent file object contains only 1 file
428+
return parentFile->readTree(outputs, dh, 0, parentNumTF, treename, totalSizeCompressed, totalSizeUncompressed);
429+
}
430+
auto rootFS = std::dynamic_pointer_cast<TFileFileSystem>(mCurrentFilesystem);
419431
throw std::runtime_error(fmt::format(R"(Couldn't get TTree "{}" from "{}". Please check https://aliceo2group.github.io/analysis-framework/docs/troubleshooting/#tree-not-found for more information.)", fullpath.path(), rootFS->GetFile()->GetName()));
420432
}
421433

@@ -432,22 +444,6 @@ bool DataInputDescriptor::readTree(DataAllocator& outputs, header::DataHeader dh
432444

433445
auto fragment = format->MakeFragment(fullpath, {}, *physicalSchema);
434446

435-
if (!fragment.ok()) {
436-
LOGP(debug, "Could not find tree {}. Trying in parent file.", fullpath.path());
437-
auto parentFile = getParentFile(counter, numTF, treename);
438-
if (parentFile != nullptr) {
439-
int parentNumTF = parentFile->findDFNumber(0, folder.path());
440-
if (parentNumTF == -1) {
441-
auto parentRootFS = std::dynamic_pointer_cast<TFileFileSystem>(parentFile->mCurrentFilesystem);
442-
throw std::runtime_error(fmt::format(R"(DF {} listed in parent file map but not found in the corresponding file "{}")", folder.path(), parentRootFS->GetFile()->GetName()));
443-
}
444-
// first argument is 0 as the parent file object contains only 1 file
445-
return parentFile->readTree(outputs, dh, 0, parentNumTF, treename, totalSizeCompressed, totalSizeUncompressed);
446-
}
447-
auto rootFS = std::dynamic_pointer_cast<TFileFileSystem>(mCurrentFilesystem);
448-
throw std::runtime_error(fmt::format(R"(Couldn't get TTree "{}" from "{}". Please check https://aliceo2group.github.io/analysis-framework/docs/troubleshooting/#tree-not-found for more information.)", fullpath.path(), rootFS->GetFile()->GetName()));
449-
}
450-
451447
// create table output
452448
auto o = Output(dh);
453449

0 commit comments

Comments
 (0)