Don’t understand how that could work.
Another idea is to split the tree, for example into 20 different files, something like this (untested):
auto tree = getOriginalTree();
vector<TFile*> clonedFiles;
vector<TTree*> clonedTrees;
for (size_t i = 0; i < 20; ++i) {
clonedFiles.push_back(TFile::Open(("/tmp/split_" + to_string(i) + ".root").c_str(), "recreate"));
clonedTrees.push_back(tree->CloneTree(0));
}
auto entries = tree->GetEntries();
std::mt19937 mt(random_device{}());
std::uniform_int_distribution<size_t> dist(0, clonedTrees.size()-1);
for (Long64_t i = 0; i < entries; ++i) {
tree->GetEntry(i);
clonedTrees[dist(mt)]->Fill();
}
for (auto f : clonedFiles) {
f->Write();
delete f;
}
Then shuffle the 20 files individually (still use LoadBaskets, but now they might be small enough to fit in the cache) and then hadd them together.
No idea how much faster/slower this might be