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 <ROOT/RStringView.hxx>
22#include <TVirtualIndex.h>
23
24#include <cstdint> // std::int64_t
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<std::int64_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<std::int64_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 std::int64_t nEntries = std::numeric_limits<std::int64_t>::max(), 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<std::int64_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<std::int64_t> &nEntriesVec = {},
92 TVirtualIndex *indexInfo = nullptr);
93};
94
95} // namespace TreeUtils
96} // namespace ROOT
97
98#endif // ROOT_RFRIENDINFO_H
A TTree represents a columnar dataset.
Definition TTree.h:79
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.
void AddFriend(const std::string &treeName, const std::string &fileNameGlob, const std::string &alias="", std::int64_t nEntries=std::numeric_limits< std::int64_t >::max(), TVirtualIndex *indexInfo=nullptr)
Add information of a single friend.
RFriendInfo(RFriendInfo &&)=default
std::vector< std::pair< std::string, std::string > > fFriendNames
Pairs of names and aliases of each friend tree/chain.
std::vector< std::vector< std::int64_t > > fNEntriesPerTreePerFriend
Number of entries contained in each tree of each friend.
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.
std::vector< std::vector< std::string > > fFriendFileNames
Names of the files where each friend is stored.