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 \ingroup tree
12 \author Enric Tejedor Saavedra
13 \author Enrico Guiraud
14 \author Vincenzo Eduardo Padulano
15 \date 2021-03
16*/
17
18#ifndef ROOT_INTERNAL_TREEUTILS_H
19#define ROOT_INTERNAL_TREEUTILS_H
20
21#include "RtypesCore.h"
22#include "TTree.h"
23#include "TChain.h"
24#include "TNotifyLink.h"
25#include "TObjArray.h"
26#include "ROOT/RFriendInfo.hxx"
27
28#include <memory>
29#include <string>
30#include <utility> // std::pair
31#include <vector>
32
33namespace ROOT {
34namespace Internal {
35/**
36\namespace ROOT::Internal::TreeUtils
37\ingroup tree
38\brief Namespace hosting functions and classes to retrieve tree information for internal use.
39*/
40namespace TreeUtils {
41
42std::vector<std::string> GetTopLevelBranchNames(TTree &t);
43std::vector<std::string> GetFileNamesFromTree(const TTree &tree);
44ROOT::TreeUtils::RFriendInfo GetFriendInfo(const TTree &tree, bool retrieveEntries = false);
45std::vector<std::string> GetTreeFullPaths(const TTree &tree);
46
48
50 TChain *fChain = nullptr;
51
52public:
53 bool Notify()
54 {
55 TTree *t = fChain->GetTree();
56 TObjArray *branches = t->GetListOfBranches();
57 ClearMustCleanupBits(*branches);
58 return true;
59 }
60
62};
63
64class RNoCleanupNotifier : public TNotifyLink<RNoCleanupNotifierHelper> {
66
67public:
69
71 {
73 this->PrependLink(c);
74 }
75
77};
78
79std::unique_ptr<TChain> MakeChainForMT(const std::string &name = "", const std::string &title = "");
80std::vector<std::unique_ptr<TChain>> MakeFriends(const ROOT::TreeUtils::RFriendInfo &finfo);
81
82std::vector<std::string> ExpandGlob(const std::string &glob);
83
84std::pair<std::vector<Long64_t>, Long64_t> GetClustersAndEntries(std::string_view treename, std::string_view path);
85
86std::pair<bool, std::string> TreeUsesIndexedFriends(const TTree &tree);
87
88} // namespace TreeUtils
89} // namespace Internal
90} // namespace ROOT
91
92#endif // ROOT_INTERNAL_TREEUTILS_H
#define c(i)
Definition RSha256.hxx:101
long long Long64_t
Definition RtypesCore.h:80
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
char name[80]
Definition TGX11.cxx:110
A chain is a collection of files containing TTree objects.
Definition TChain.h:33
TTree * GetTree() const override
Definition TChain.h:119
void PrependLink(Chain &chain)
Set this link as the head of the chain's list of notify subscribers.
Definition TNotifyLink.h:82
An array of TObjects.
Definition TObjArray.h:31
A TTree represents a columnar dataset.
Definition TTree.h:79
virtual TObjArray * GetListOfBranches()
Definition TTree.h:488
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.
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.