Skip to content

Commit 23411c1

Browse files
jackal1-66sawenzel
authored andcommitted
Handle list of files in alien paths
1 parent 885e4ea commit 23411c1

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
@@ -531,7 +531,26 @@ std::vector<std::string> GeneratorFromEventPool::setupFileUniverse(std::string c
531531
if (typeString.size() == 0) {
532532
return result;
533533
} else if (typeString.size() == 1 && typeString.front() == std::string("Type: f")) {
534-
// this is a file ... simply use it
534+
// this is a file:
535+
// 1) list of files ==> select one of the lines and use it
536+
// 2) evtpool.root ==> use as it is
537+
if (!checkFileName(path)) {
538+
// Assume it is a text file containing a list of pools
539+
auto tmpPath = (std::filesystem::temp_directory_path() / ("list_" + std::to_string(getpid()) + ".txt")).string();
540+
auto res = TFile::Cp(Form("%s?filetype=raw", path.c_str()), tmpPath.c_str());
541+
if (!res) {
542+
LOG(fatal) << "Failed to copy file from AliEn: " << path;
543+
} else {
544+
auto files = readLines(tmpPath);
545+
if (checkFileUniverse(files)) {
546+
result = files;
547+
} else {
548+
LOG(fatal) << "The list of files in " << path << " is not valid";
549+
}
550+
std::filesystem::remove(tmpPath);
551+
}
552+
return result;
553+
}
535554
result.push_back(mConfig.eventPoolPath);
536555
return result;
537556
} else if (typeString.size() == 1 && typeString.front() == std::string("Type: d")) {

0 commit comments

Comments
 (0)