Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
InternalTreeUtils.hxx
Go to the documentation of this file.
1/*************************************************************************
2 * Copyright (C) 1995-2021, Rene Brun and Fons Rademakers. *
3 * All rights reserved. *
4 * *
5 * For the licensing terms see $ROOTSYS/LICENSE. *
6 * For the list of contributors see $ROOTSYS/README/CREDITS. *
7 *************************************************************************/
8
9/**
10 \file ROOT/InternalTreeUtils.hxx
11 \author Enric Tejedor Saavedra
12 \author Enrico Guiraud
13 \author Vincenzo Eduardo Padulano
14 \date 2021-03
15*/
16
17#ifndef ROOT_INTERNAL_TREEUTILS_H
18#define ROOT_INTERNAL_TREEUTILS_H
19
20#include "RtypesCore.h"
21#include "TTree.h"
22#include "TChain.h"
23#include "TNotifyLink.h"
24#include "TObjArray.h"
25#include "ROOT/RFriendInfo.hxx"
26
27#include <memory>
28#include <string>
29#include <utility> // std::pair
30#include <vector>
31
32namespace ROOT {
33namespace Internal {
34/**
35\namespace ROOT::Internal::TreeUtils
36\ingroup tree
37\brief Namespace hosting functions and classes to retrieve tree information for internal use.
38*/
39namespace TreeUtils {
40
41std::vector<std::string> GetTopLevelBranchNames(TTree &t);
42std::vector<std::string> GetFileNamesFromTree(const TTree &tree);
43ROOT::TreeUtils::RFriendInfo GetFriendInfo(const TTree &tree, bool retrieveEntries = false);
44std::vector<std::string> GetTreeFullPaths(const TTree &tree);
45
46void ClearMustCleanupBits(TObjArray &arr);
47
49 TChain *fChain = nullptr;
50
51public:
52 bool Notify()
53 {
54 TTree *t = fChain->GetTree();
55 TObjArray *branches = t->GetListOfBranches();
56 ClearMustCleanupBits(*branches);
57 return true;
58 }
59
61};
62
77
78std::unique_ptr<TChain> MakeChainForMT(const std::string &name = "", const std::string &title = "");
79std::vector<std::unique_ptr<TChain>> MakeFriends(const ROOT::TreeUtils::RFriendInfo &finfo);
80
81std::vector<std::string> ExpandGlob(const std::string &glob);
82
83std::pair<std::vector<Long64_t>, Long64_t> GetClustersAndEntries(std::string_view treename, std::string_view path);
84
85std::pair<bool, std::string> TreeUsesIndexedFriends(const TTree &tree);
86
87} // namespace TreeUtils
88} // namespace Internal
89} // namespace ROOT
90
91#endif // ROOT_INTERNAL_TREEUTILS_H
#define c(i)
Definition RSha256.hxx:101
Basic types used by ROOT and required by TInterpreter.
long long Long64_t
Portable signed long integer 8 bytes.
Definition RtypesCore.h:83
#define ClassDefOverride(name, id)
Definition Rtypes.h:348
char name[80]
Definition TGX11.cxx:148
A chain is a collection of files containing TTree objects.
Definition TChain.h:33
An array of TObjects.
Definition TObjArray.h:31
A TTree represents a columnar dataset.
Definition TTree.h:89
virtual TObjArray * GetListOfBranches()
Definition TTree.h:575
std::vector< std::string > GetTreeFullPaths(const TTree &tree)
Retrieve the full path(s) to a TTree or the trees in a TChain.
std::vector< std::string > GetFileNamesFromTree(const TTree &tree)
Get and store the file names associated with the input tree.
Namespace hosting functions and classes to retrieve tree information for internal use.
Definition RTTreeDS.hxx:48
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.
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.
Information about friend trees of a certain TTree or TChain object.