Skip to content

Commit c7f0638

Browse files
committed
Handle list of files in alien paths
1 parent bd18612 commit c7f0638

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

Generators/src/GeneratorFromFile.cxx

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,26 @@ std::vector<std::string> GeneratorFromEventPool::setupFileUniverse(std::string c
528528
if (typeString.size() == 0) {
529529
return result;
530530
} else if (typeString.size() == 1 && typeString.front() == std::string("Type: f")) {
531-
// this is a file ... simply use it
531+
// this is a file:
532+
// 1) list of files ==> select one of the lines and use it
533+
// 2) evtpool.root ==> use as it is
534+
if (!checkFileName(path)) {
535+
// Assume it is a text file containing a list of pools
536+
auto tmpPath = (std::filesystem::temp_directory_path() / ("list_" + std::to_string(getpid()) + ".txt")).string();
537+
auto res = TFile::Cp(Form("%s?filetype=raw", path.c_str()), tmpPath.c_str());
538+
if (!res) {
539+
LOG(fatal) << "Failed to copy file from AliEn: " << path;
540+
} else {
541+
auto files = readLines(tmpPath);
542+
if (checkFileUniverse(files)) {
543+
result = files;
544+
} else {
545+
LOG(fatal) << "The list of files in " << path << " is not valid";
546+
}
547+
std::filesystem::remove(tmpPath);
548+
}
549+
return result;
550+
}
532551
result.push_back(mConfig.eventPoolPath);
533552
return result;
534553
} else if (typeString.size() == 1 && typeString.front() == std::string("Type: d")) {

0 commit comments

Comments
 (0)