You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DataInputDescriptor* DataInputDescriptor::getParentFile(int counter, int numTF, std::string treename)
@@ -223,15 +225,17 @@ DataInputDescriptor* DataInputDescriptor::getParentFile(int counter, int numTF,
223
225
}
224
226
auto folderName = (mfilenames[counter]->listOfTimeFrameKeys)[numTF];
225
227
auto parentFileName = (TObjString*)mParentFileMap->GetValue(folderName.c_str());
228
+
// The current DF is not found in the parent map (this should not happen and is a fatal error)
229
+
auto rootFS = std::dynamic_pointer_cast<TFileFileSystem>(mCurrentFilesystem);
226
230
if (!parentFileName) {
227
-
// The current DF is not found in the parent map (this should not happen and is a fatal error)
228
-
throwstd::runtime_error(fmt::format(R"(parent file map exists but does not contain the current DF "{}" in file "{}")", folderName.c_str(), mcurrentFile->GetName()));
231
+
throwstd::runtime_error(fmt::format(R"(parent file map exists but does not contain the current DF "{}" in file "{}")", folderName.c_str(), rootFS->GetFile()->GetName()));
229
232
returnnullptr;
230
233
}
231
234
232
235
if (mParentFile) {
233
236
// Is this still the corresponding to the correct file?
234
-
if (parentFileName->GetString().CompareTo(mParentFile->mcurrentFile->GetName()) == 0) {
237
+
auto parentRootFS = std::dynamic_pointer_cast<TFileFileSystem>(mParentFile->mCurrentFilesystem);
238
+
if (parentFileName->GetString().CompareTo(parentRootFS->GetFile()->GetName()) == 0) {
235
239
returnmParentFile;
236
240
} else {
237
241
mParentFile->closeInputFile();
@@ -241,7 +245,8 @@ DataInputDescriptor* DataInputDescriptor::getParentFile(int counter, int numTF,
241
245
}
242
246
243
247
if (mLevel == mAllowedParentLevel) {
244
-
throwstd::runtime_error(fmt::format(R"(while looking for tree "{}", the parent file was requested but we are already at level {} of maximal allowed level {} for DF "{}" in file "{}")", treename.c_str(), mLevel, mAllowedParentLevel, folderName.c_str(), mcurrentFile->GetName()));
248
+
throwstd::runtime_error(fmt::format(R"(while looking for tree "{}", the parent file was requested but we are already at level {} of maximal allowed level {} for DF "{}" in file "{}")", treename.c_str(), mLevel, mAllowedParentLevel, folderName.c_str(),
249
+
rootFS->GetFile()->GetName()));
245
250
}
246
251
247
252
LOGP(info, "Opening parent file {} for DF {}", parentFileName->GetString().Data(), folderName.c_str());
auto fullpath = fileAndFolder.folderName + "/" + treename;
367
-
auto tree = (TTree*)fileAndFolder.file->Get(fullpath.c_str());
373
+
auto format = std::make_shared<TTreeFileFormat>(totalSizeCompressed, totalSizeUncompressed);
374
+
auto fullpath = arrow::dataset::FileSource{folder.path() + "/" + treename, folder.filesystem()};
375
+
auto schemaOpt = format->Inspect(fullpath);
376
+
auto schema = *schemaOpt;
368
377
369
-
if (!tree) {
370
-
LOGP(debug, "Could not find tree {}. Trying in parent file.", fullpath.c_str());
378
+
auto fragment = format->MakeFragment(fullpath, {}, schema);
379
+
380
+
if (!fragment.ok()) {
381
+
LOGP(debug, "Could not find tree {}. Trying in parent file.", fullpath.path());
371
382
auto parentFile = getParentFile(counter, numTF, treename);
372
383
if (parentFile != nullptr) {
373
-
int parentNumTF = parentFile->findDFNumber(0, fileAndFolder.folderName);
384
+
int parentNumTF = parentFile->findDFNumber(0, folder.path());
374
385
if (parentNumTF == -1) {
375
-
throwstd::runtime_error(fmt::format(R"(DF {} listed in parent file map but not found in the corresponding file "{}")", fileAndFolder.folderName, parentFile->mcurrentFile->GetName()));
386
+
auto parentRootFS = std::dynamic_pointer_cast<TFileFileSystem>(parentFile->mCurrentFilesystem);
387
+
throwstd::runtime_error(fmt::format(R"(DF {} listed in parent file map but not found in the corresponding file "{}")", folder.path(), parentRootFS->GetFile()->GetName()));
376
388
}
377
389
// first argument is 0 as the parent file object contains only 1 file
throwstd::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.)", fileAndFolder.folderName + "/" + treename, fileAndFolder.file->GetName()));
392
+
auto rootFS = std::dynamic_pointer_cast<TFileFileSystem>(mCurrentFilesystem);
393
+
throwstd::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()));
381
394
}
382
395
383
396
// create table output
384
397
auto o = Output(dh);
385
-
auto t2t = outputs.make<TreeToTable>(o);
386
398
387
-
// add branches to read
388
-
// fill the table
389
-
t2t->setLabel(tree->GetName());
390
-
totalSizeCompressed += tree->GetZipBytes();
391
-
totalSizeUncompressed += tree->GetTotBytes();
392
-
t2t->addAllColumns(tree);
393
-
t2t->fill(tree);
394
-
delete tree;
399
+
// FIXME: This should allow me to create a memory pool
0 commit comments