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());
371
+
auto format = std::make_shared<TTreeFileFormat>(totalSizeCompressed, totalSizeUncompressed);
372
+
auto fullpath = arrow::dataset::FileSource{folder.path() + "/" + treename, folder.filesystem()};
373
+
auto schemaOpt = format->Inspect(fullpath);
374
+
auto schema = *schemaOpt;
368
375
369
-
if (!tree) {
370
-
LOGP(debug, "Could not find tree {}. Trying in parent file.", fullpath.c_str());
376
+
auto fragment = format->MakeFragment(fullpath, {}, schema);
377
+
378
+
if (!fragment.ok()) {
379
+
LOGP(debug, "Could not find tree {}. Trying in parent file.", fullpath.path());
371
380
auto parentFile = getParentFile(counter, numTF, treename);
372
381
if (parentFile != nullptr) {
373
-
int parentNumTF = parentFile->findDFNumber(0, fileAndFolder.folderName);
382
+
int parentNumTF = parentFile->findDFNumber(0, folder.path());
374
383
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()));
384
+
auto parentRootFS = std::dynamic_pointer_cast<TFileFileSystem>(parentFile->mCurrentFilesystem);
385
+
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
386
}
377
387
// 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()));
390
+
auto rootFS = std::dynamic_pointer_cast<TFileFileSystem>(mCurrentFilesystem);
391
+
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
392
}
382
393
383
394
// create table output
384
395
auto o = Output(dh);
385
-
auto t2t = outputs.make<TreeToTable>(o);
386
396
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;
397
+
// FIXME: This should allow me to create a memory pool
0 commit comments