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