76 std::unordered_set<std::string>
bNamesSet;
77 std::vector<std::string>
bNames;
94 if (
auto chain =
dynamic_cast<const TChain *
>(&tree)) {
97 throw std::runtime_error(
"Could not retrieve a list of files from the input TChain.");
103 throw std::runtime_error(
"The list of files associated with the input TChain is empty.");
109 const TFile *
f = tree.GetCurrentFile();
111 throw std::runtime_error(
"The input TTree is not linked to any file, "
112 "in-memory-only trees are not supported.");
172 const auto *
friends = tree.GetListOfFriends();
176 std::vector<std::pair<std::string, std::string>>
friendNames;
180 std::vector<std::unique_ptr<TVirtualIndex>>
treeIndexes;
228 throw std::runtime_error(
"A TChain in the list of friends does not contain any file. "
229 "Friends with no associated files are not supported.");
254 throw std::runtime_error(std::string(
"GetFriendInfo: Could not open file \"") +
thisFileName +
"\"");
257 throw std::runtime_error(std::string(
"GetFriendInfo: Could not retrieve TTree \"") +
thisTreeName +
274 const auto *
f =
frTree->GetCurrentFile();
276 throw std::runtime_error(
"A TTree in the list of friends is not linked to any file. "
277 "Friends with no associated files are not supported.");
307 if (
auto chain =
dynamic_cast<const TChain *
>(&tree)) {
310 throw std::runtime_error(
"The input TChain does not contain any file.");
320 if (
const auto *
treeDir = tree.GetDirectory()) {
326 return {tree.GetName()};
336 return {tree.GetName()};
376 std::vector<std::unique_ptr<TChain>>
friends;
380 for (std::size_t i = 0
u; i <
nFriends; ++i) {
436 std::string remainder;
497 throw std::runtime_error(
"ExpandGlob: could not open directory '" +
dirname +
"'.");
521 std::vector<std::string>
ret;
522 ret.reserve(
l.GetEntries());
523 for (
const auto *
tobjstr : ROOT::RangeStaticCast<const TObjString *>(
l)) {
541 std::unique_ptr<TFile>
inFile{
TFile::Open(path.data(),
"READ_WITHOUT_GLOBALREGISTRATION")};
543 throw std::invalid_argument(
"GetClustersAndEntries: could not open file \"" + std::string(path) +
"\".");
546 throw std::invalid_argument(
"GetClustersAndEntries: could not find tree \"" + std::string(
treename) +
547 "\" in file \"" + std::string(path) +
"\".");
549 auto nEntries{tree->GetEntriesFast()};
551 auto clusterIt{tree->GetClusterIterator(0)};
559 return std::make_pair(std::move(boundaries), std::move(
nEntries));
572 auto *
frTree = fr->GetTree();
573 if (
frTree->GetTreeIndex())
574 return {
true,
frTree->GetName()};
static void GetTopLevelBranchNamesImpl(TTree &t, std::unordered_set< std::string > &bNamesReg, std::vector< std::string > &bNames, std::unordered_set< TTree * > &analysedTrees, const std::string friendName="")
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
R__EXTERN TSystem * gSystem
A chain is a collection of files containing TTree objects.
@ kWithoutGlobalRegistration
TDirectory::TContext keeps track and restore the current directory.
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
A TFriendElement TF describes a TTree object TF in a file.
Collectable string class.
Mother of all ROOT objects.
@ kMustCleanup
if object destructor must call RecursiveRemove()
Regular expression class.
A TSystemFile describes an operating system file.
virtual Bool_t IsDirectory(const char *dir=nullptr) const
Check if object is a directory.
virtual Bool_t ExpandPathName(TString &path)
Expand a pathname getting rid of special shell characters like ~.
virtual void FreeDirectory(void *dirp)
Free a directory.
virtual void * OpenDirectory(const char *name)
Open a directory. Returns 0 if directory does not exist.
virtual const char * GetDirEntry(void *dirp)
Get a directory entry. Returns 0 if no more entries.
virtual const char * UnixPathName(const char *unixpathname)
Convert from a local pathname to a Unix pathname.
virtual const char * WorkingDirectory()
Return working directory.
A TTree represents a columnar dataset.
virtual TObjArray * GetListOfBranches()
virtual TList * GetListOfFriends() const
static constexpr Long64_t kMaxEntries
Abstract interface for Tree Index.
Different standalone functions to work with trees and tuples, not reqiuired to be a member of any cla...
std::vector< std::string > GetTreeFullPaths(const TTree &tree)
std::vector< std::string > GetTopLevelBranchNames(TTree &t)
Get all the top-level branches names, including the ones of the friend trees.
std::unique_ptr< TChain > MakeChainForMT(const std::string &name="", const std::string &title="")
Create a TChain object with options that avoid common causes of thread contention.
std::pair< bool, std::string > TreeUsesIndexedFriends(const TTree &tree)
Check whether the input tree is using any TTreeIndex.
std::vector< std::unique_ptr< TChain > > MakeFriends(const ROOT::TreeUtils::RFriendInfo &finfo)
Create friends from the main TTree.
void RecursiveGlob(TList &out, const std::string &glob)
Recursively expand the glob to take care of potential wildcard specials for subdirectories in the glo...
ROOT::TreeUtils::RFriendInfo GetFriendInfo(const TTree &tree, bool retrieveEntries=false)
std::vector< std::string > ExpandGlob(const std::string &glob)
Expands input glob into a collection of full paths to files.
std::pair< std::vector< Long64_t >, Long64_t > GetClustersAndEntries(std::string_view treename, std::string_view path)
Returns the cluster boundaries and number of entries of the input tree.
void ClearMustCleanupBits(TObjArray &arr)
Reset the kMustCleanup bit of a TObjArray of TBranch objects (e.g.
std::vector< std::string > GetFileNamesFromTree(const TTree &tree)
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
Information about friend trees of a certain TTree or TChain object.