Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:10:43

0001 /*************************************************************************
0002  * Copyright (C) 1995-2022, Rene Brun and Fons Rademakers.               *
0003  * All rights reserved.                                                  *
0004  *                                                                       *
0005  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0006  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0007  *************************************************************************/
0008 
0009 /**
0010  \file ROOT/RFriendInfo.hxx
0011  \ingroup tree
0012  \author Ivan Kabadzhov
0013  \author Enrico Guiraud
0014  \author Vincenzo Eduardo Padulano
0015  \date 2022-10
0016 */
0017 
0018 #ifndef ROOT_RFRIENDINFO_H
0019 #define ROOT_RFRIENDINFO_H
0020 
0021 #include <string_view>
0022 #include <Rtypes.h> // Long64_t
0023 #include <TVirtualIndex.h>
0024 #include <TTree.h>
0025 
0026 #include <limits>
0027 #include <memory>
0028 #include <string>
0029 #include <utility> // std::pair
0030 #include <vector>
0031 
0032 class TTree;
0033 
0034 namespace ROOT {
0035 namespace TreeUtils {
0036 
0037 /**
0038 \struct ROOT::TreeUtils::RFriendInfo
0039 \brief Information about friend trees of a certain TTree or TChain object.
0040 \ingroup tree
0041 */
0042 struct RFriendInfo {
0043 
0044    /**
0045     * Pairs of names and aliases of each friend tree/chain.
0046     */
0047    std::vector<std::pair<std::string, std::string>> fFriendNames;
0048    /**
0049    Names of the files where each friend is stored. fFriendFileNames[i] is the
0050    list of files for friend with name fFriendNames[i].
0051    */
0052    std::vector<std::vector<std::string>> fFriendFileNames;
0053    /**
0054       Names of the subtrees of a friend TChain. fFriendChainSubNames[i] is the
0055       list of names of the trees that make a friend TChain whose information is
0056       stored at fFriendNames[i] and fFriendFileNames[i]. If instead the friend
0057       tree at position `i` is a TTree, fFriendChainSubNames[i] will be an empty
0058       vector.
0059    */
0060    std::vector<std::vector<std::string>> fFriendChainSubNames;
0061    /**
0062     * Number of entries contained in each tree of each friend. The outer
0063     * dimension of the vector tracks the n-th friend tree/chain, the inner
0064     * dimension tracks the number of entries of each tree in the current friend.
0065     */
0066    std::vector<std::vector<Long64_t>> fNEntriesPerTreePerFriend;
0067 
0068    /**
0069       Information on the friend's TTreeIndexes.
0070    */
0071    std::vector<std::unique_ptr<TVirtualIndex>> fTreeIndexInfos;
0072 
0073    RFriendInfo() = default;
0074    RFriendInfo(const RFriendInfo &);
0075    RFriendInfo &operator=(const RFriendInfo &);
0076    RFriendInfo(RFriendInfo &&) = default;
0077    RFriendInfo &operator=(RFriendInfo &&) = default;
0078    RFriendInfo(std::vector<std::pair<std::string, std::string>> friendNames,
0079                std::vector<std::vector<std::string>> friendFileNames,
0080                std::vector<std::vector<std::string>> friendChainSubNames,
0081                std::vector<std::vector<Long64_t>> nEntriesPerTreePerFriend,
0082                std::vector<std::unique_ptr<TVirtualIndex>> treeIndexInfos);
0083 
0084    void AddFriend(const std::string &treeName, const std::string &fileNameGlob, const std::string &alias = "",
0085                   Long64_t nEntries = TTree::kMaxEntries, TVirtualIndex *indexInfo = nullptr);
0086 
0087    void AddFriend(const std::string &treeName, const std::vector<std::string> &fileNameGlobs,
0088                   const std::string &alias = "", const std::vector<Long64_t> &nEntriesVec = {},
0089                   TVirtualIndex *indexInfo = nullptr);
0090 
0091    void AddFriend(const std::vector<std::pair<std::string, std::string>> &treeAndFileNameGlobs,
0092                   const std::string &alias = "", const std::vector<Long64_t> &nEntriesVec = {},
0093                   TVirtualIndex *indexInfo = nullptr);
0094 };
0095 
0096 } // namespace TreeUtils
0097 } // namespace ROOT
0098 
0099 #endif // ROOT_RFRIENDINFO_H