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 "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
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
63class RNoCleanupNotifier : public TNotifyLink<RNoCleanupNotifierHelper> {
65
66public:
68
70 {
72 this->PrependLink(c);
73 }
74
76};
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
83} // namespace TreeUtils
84} // namespace Internal
85} // namespace ROOT
86
87#endif // ROOT_INTERNAL_TREEUTILS_H
#define c(i)
Definition RSha256.hxx:101
#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::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.
void ClearMustCleanupBits(TObjArray &arr)
Reset the kMustCleanup bit of a TObjArray of TBranch objects (e.g.
std::vector< std::string > GetFileNamesFromTree(const TTree &tree)
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.
Definition tree.py:1
Information about friend trees of a certain TTree or TChain object.