Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ROOT::Internal::TreeUtils Namespace Reference

Namespace hosting functions and classes to retrieve tree information for internal use. More...

Classes

class  RNoCleanupNotifier
 
class  RNoCleanupNotifierHelper
 

Functions

void ClearMustCleanupBits (TObjArray &branches)
 Reset the kMustCleanup bit of a TObjArray of TBranch objects (e.g.
 
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_tGetClustersAndEntries (std::string_view treename, std::string_view path)
 Returns the cluster boundaries and number of entries of the input tree.
 
std::vector< std::string > GetFileNamesFromTree (const TTree &tree)
 
ROOT::TreeUtils::RFriendInfo GetFriendInfo (const TTree &tree, bool retrieveEntries=false)
 
std::vector< std::string > GetTopLevelBranchNames (TTree &t)
 Get all the top-level branches names, including the ones of the friend trees.
 
std::vector< std::string > GetTreeFullPaths (const TTree &tree)
 
std::unique_ptr< TChainMakeChainForMT (const std::string &name, const std::string &title)
 Create a TChain object with options that avoid common causes of thread contention.
 
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 glob.
 
std::pair< bool, std::string > TreeUsesIndexedFriends (const TTree &tree)
 Check whether the input tree is using any TTreeIndex.
 

Detailed Description

Namespace hosting functions and classes to retrieve tree information for internal use.

Function Documentation

◆ ClearMustCleanupBits()

void ROOT::Internal::TreeUtils::ClearMustCleanupBits ( TObjArray branches)

Reset the kMustCleanup bit of a TObjArray of TBranch objects (e.g.

returned by TTree::GetListOfBranches).

In some rare cases, all branches in a TTree can have their kMustCleanup bit set, which causes a large amount of contention at teardown due to concurrent calls to RecursiveRemove (which needs to take the global lock). This helper function checks the first branch of the array and if it has the kMustCleanup bit set, it resets it for all branches in the array, recursively going through sub-branches and leaves.

Definition at line 345 of file InternalTreeUtils.cxx.

◆ ExpandGlob()

std::vector< std::string > ROOT::Internal::TreeUtils::ExpandGlob ( const std::string &  glob)

Expands input glob into a collection of full paths to files.

Parameters
[in]globThe glob to expand.
Exceptions
std::runtime_errorIf the directory parts of the glob refer to a path that cannot be opened.
Returns
A vector of strings, the fully expanded paths to the files referred to by the glob.

The glob is expanded recursively, but subdirectories are only expanded when it is explicitly included in the pattern. For example, "dir/*" will only list the files in the subdirectories of "dir", but "dir/*&zwj;/*" will list the files in the subsubdirectories of "dir".

Definition at line 512 of file InternalTreeUtils.cxx.

◆ GetClustersAndEntries()

std::pair< std::vector< Long64_t >, Long64_t > ROOT::Internal::TreeUtils::GetClustersAndEntries ( std::string_view  treename,
std::string_view  path 
)

Returns the cluster boundaries and number of entries of the input tree.

Parameters
[in]treenameName of the tree.
[in]filenamePath to the file.
Returns
a pair (cluster_boundaries, n_entries). The vector of cluster of cluster boundaries contains the beginning entry of the first cluster up to the ending entry of the last cluster, e.g. for a tree with 3 clusters of 10 entries each, this will return [0, 10, 20, 30]

Definition at line 537 of file InternalTreeUtils.cxx.

◆ GetFileNamesFromTree()

std::vector< std::string > ROOT::Internal::TreeUtils::GetFileNamesFromTree ( const TTree tree)

Definition at line 89 of file InternalTreeUtils.cxx.

◆ GetFriendInfo()

ROOT::TreeUtils::RFriendInfo ROOT::Internal::TreeUtils::GetFriendInfo ( const TTree tree,
bool  retrieveEntries = false 
)

Definition at line 164 of file InternalTreeUtils.cxx.

◆ GetTopLevelBranchNames()

std::vector< std::string > ROOT::Internal::TreeUtils::GetTopLevelBranchNames ( TTree t)

Get all the top-level branches names, including the ones of the friend trees.

Definition at line 74 of file InternalTreeUtils.cxx.

◆ GetTreeFullPaths()

std::vector< std::string > ROOT::Internal::TreeUtils::GetTreeFullPaths ( const TTree tree)

Definition at line 304 of file InternalTreeUtils.cxx.

◆ MakeChainForMT()

std::unique_ptr< TChain > ROOT::Internal::TreeUtils::MakeChainForMT ( const std::string &  name,
const std::string &  title 
)

Create a TChain object with options that avoid common causes of thread contention.

In particular, set its kWithoutGlobalRegistration mode and reset its kMustCleanup bit.

Definition at line 365 of file InternalTreeUtils.cxx.

◆ MakeFriends()

std::vector< std::unique_ptr< TChain > > ROOT::Internal::TreeUtils::MakeFriends ( const ROOT::TreeUtils::RFriendInfo finfo)

Create friends from the main TTree.

Definition at line 374 of file InternalTreeUtils.cxx.

◆ RecursiveGlob()

void ROOT::Internal::TreeUtils::RecursiveGlob ( TList out,
const std::string &  glob 
)

Recursively expand the glob to take care of potential wildcard specials for subdirectories in the glob.

Parameters
[in]lThe list of full paths to files.
[in]globThe glob to expand.
Exceptions
std::runtime_errorIf the directory parts of the glob refer to a path that cannot be opened.

If the glob contains a wildcard special for subdirectories, the three parts of the glob (directory, subdirectoryglob, remainder) are separated. Otherwise the glob is expanded to (directory, fileglob). The directory is first expanded via TSystem::ExpandPathName then opened via TSystem::OpenDirectory. If the directory can be opened, then current glob is used as regex expression (via TRegexp) to find subdirectories or store those files in the directory that match the regex.

Definition at line 431 of file InternalTreeUtils.cxx.

◆ TreeUsesIndexedFriends()

std::pair< bool, std::string > ROOT::Internal::TreeUtils::TreeUsesIndexedFriends ( const TTree tree)

Check whether the input tree is using any TTreeIndex.

Parameters
[in]treeThe input TTree/TChain.
Returns
A pair. The first item is a boolean telling whether the tree is using an index. The second item is a string with the name of the first friend tree found with a connected index.

Definition at line 567 of file InternalTreeUtils.cxx.