Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RFriendInfo.hxx
Go to the documentation of this file.
1/*************************************************************************
2 * Copyright (C) 1995-2022, 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/RFriendInfo.hxx
11 \ingroup tree
12 \author Ivan Kabadzhov
13 \author Enrico Guiraud
14 \author Vincenzo Eduardo Padulano
15 \date 2022-10
16*/
17
18#ifndef ROOT_RFRIENDINFO_H
19#define ROOT_RFRIENDINFO_H
20
21#include <string_view>
22#include <Rtypes.h> // Long64_t
23#include <TVirtualIndex.h>
24#include <TTree.h>
25
26#include <limits>
27#include <memory>
28#include <string>
29#include <utility> // std::pair
30#include <vector>
31
32class TTree;
33
34namespace ROOT {
35namespace TreeUtils {
36
37/**
38\struct ROOT::TreeUtils::RFriendInfo
39\brief Information about friend trees of a certain TTree or TChain object.
40\ingroup tree
41*/
43
44 /**
45 * Pairs of names and aliases of each friend tree/chain.
46 */
47 std::vector<std::pair<std::string, std::string>> fFriendNames;
48 /**
49 Names of the files where each friend is stored. fFriendFileNames[i] is the
50 list of files for friend with name fFriendNames[i].
51 */
52 std::vector<std::vector<std::string>> fFriendFileNames;
53 /**
54 Names of the subtrees of a friend TChain. fFriendChainSubNames[i] is the
55 list of names of the trees that make a friend TChain whose information is
56 stored at fFriendNames[i] and fFriendFileNames[i]. If instead the friend
57 tree at position `i` is a TTree, fFriendChainSubNames[i] will be an empty
58 vector.
59 */
60 std::vector<std::vector<std::string>> fFriendChainSubNames;
61 /**
62 * Number of entries contained in each tree of each friend. The outer
63 * dimension of the vector tracks the n-th friend tree/chain, the inner
64 * dimension tracks the number of entries of each tree in the current friend.
65 */
66 std::vector<std::vector<Long64_t>> fNEntriesPerTreePerFriend;
67
68 /**
69 Information on the friend's TTreeIndexes.
70 */
71 std::vector<std::unique_ptr<TVirtualIndex>> fTreeIndexInfos;
72
73 RFriendInfo() = default;
74 RFriendInfo(const RFriendInfo &);
76 RFriendInfo(RFriendInfo &&) = default;
78 RFriendInfo(std::vector<std::pair<std::string, std::string>> friendNames,
79 std::vector<std::vector<std::string>> friendFileNames,
80 std::vector<std::vector<std::string>> friendChainSubNames,
81 std::vector<std::vector<Long64_t>> nEntriesPerTreePerFriend,
82 std::vector<std::unique_ptr<TVirtualIndex>> treeIndexInfos);
83
84 void AddFriend(const std::string &treeName, const std::string &fileNameGlob, const std::string &alias = "",
85 Long64_t nEntries = TTree::kMaxEntries, TVirtualIndex *indexInfo = nullptr);
86
87 void AddFriend(const std::string &treeName, const std::vector<std::string> &fileNameGlobs,
88 const std::string &alias = "", const std::vector<Long64_t> &nEntriesVec = {},
89 TVirtualIndex *indexInfo = nullptr);
90
91 void AddFriend(const std::vector<std::pair<std::string, std::string>> &treeAndFileNameGlobs,
92 const std::string &alias = "", const std::vector<Long64_t> &nEntriesVec = {},
93 TVirtualIndex *indexInfo = nullptr);
94};
95
96} // namespace TreeUtils
97} // namespace ROOT
98
99#endif // ROOT_RFRIENDINFO_H
long long Long64_t
Definition RtypesCore.h:80
A TTree represents a columnar dataset.
Definition TTree.h:79
static constexpr Long64_t kMaxEntries
Definition TTree.h:229
Abstract interface for Tree Index.
Different standalone functions to work with trees and tuples, not reqiuired to be a member of any cla...
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.
Information about friend trees of a certain TTree or TChain object.
RFriendInfo(RFriendInfo &&)=default
std::vector< std::pair< std::string, std::string > > fFriendNames
Pairs of names and aliases of each friend tree/chain.
RFriendInfo & operator=(RFriendInfo &&)=default
RFriendInfo & operator=(const RFriendInfo &)
std::vector< std::vector< std::string > > fFriendChainSubNames
Names of the subtrees of a friend TChain.
std::vector< std::unique_ptr< TVirtualIndex > > fTreeIndexInfos
Information on the friend's TTreeIndexes.
void AddFriend(const std::string &treeName, const std::string &fileNameGlob, const std::string &alias="", Long64_t nEntries=TTree::kMaxEntries, TVirtualIndex *indexInfo=nullptr)
Add information of a single friend.
std::vector< std::vector< std::string > > fFriendFileNames
Names of the files where each friend is stored.
std::vector< std::vector< Long64_t > > fNEntriesPerTreePerFriend
Number of entries contained in each tree of each friend.