Logo ROOT  
Reference Guide
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 "TChain.h"
22#include "TNotifyLink.h"
23#include "TObjArray.h"
24#include "ROOT/RFriendInfo.hxx"
25
26#include <memory>
27#include <string>
28#include <utility> // std::pair
29#include <vector>
30
31class TTree;
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);
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 = "");
80
81} // namespace TreeUtils
82} // namespace Internal
83} // namespace ROOT
84
85#endif // ROOT_INTERNAL_TREEUTILS_H
#define c(i)
Definition: RSha256.hxx:101
#define ClassDef(name, id)
Definition: Rtypes.h:335
char name[80]
Definition: TGX11.cxx:110
A chain is a collection of files containing TTree objects.
Definition: TChain.h:33
virtual TTree * GetTree() const
Definition: TChain.h:118
void PrependLink(Notifier &notifier)
Definition: TNotifyLink.h:56
An array of TObjects.
Definition: TObjArray.h:31
A TTree represents a columnar dataset.
Definition: TTree.h:79
virtual TObjArray * GetListOfBranches()
Definition: TTree.h:484
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)
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.
ROOT::TreeUtils::RFriendInfo GetFriendInfo(const TTree &tree)
Get and store the names, aliases and file names of the direct friends of the 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.
void ClearMustCleanupBits(TObjArray &arr)
Reset the kMustCleanup bit of a TObjArray of TBranch objects (e.g.
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.
Definition: RFriendInfo.hxx:34