12 #ifndef ROOT_TTreeProcessorMT
13 #define ROOT_TTreeProcessorMT
50 using NameAlias = std::pair<std::string, std::string>;
53 std::vector<Internal::NameAlias> fFriendNames;
56 std::vector<std::vector<std::string>> fFriendFileNames;
61 using TreeReaderEntryListPair = std::pair<std::unique_ptr<TTreeReader>, std::unique_ptr<TEntryList>>;
65 std::vector<std::unique_ptr<TChain>> fFriends;
66 std::unique_ptr<TChain> fChain;
68 void MakeChain(
const std::string &treeName,
const std::vector<std::string> &fileNames,
const FriendInfo &friendInfo,
69 const std::vector<Long64_t> &nEntries,
const std::vector<std::vector<Long64_t>> &friendEntries);
70 TreeReaderEntryListPair MakeReaderWithEntryList(TEntryList &globalList, Long64_t start, Long64_t end);
71 std::unique_ptr<TTreeReader> MakeReader(Long64_t start, Long64_t end);
74 TTreeView() =
default;
76 TTreeView(
const TTreeView &) {}
77 TreeReaderEntryListPair GetTreeReader(Long64_t start, Long64_t end,
const std::string &treeName,
78 const std::vector<std::string> &fileNames,
const FriendInfo &friendInfo,
79 TEntryList entryList,
const std::vector<Long64_t> &nEntries,
80 const std::vector<std::vector<Long64_t>> &friendEntries);
84 class TTreeProcessorMT {
86 const std::vector<std::string> fFileNames;
87 const std::string fTreeName;
89 const TEntryList fEntryList;
90 const Internal::FriendInfo fFriendInfo;
92 ROOT::TThreadedObject<ROOT::Internal::TTreeView> fTreeView;
94 Internal::FriendInfo GetFriendInfo(TTree &tree);
95 std::string FindTreeName();
96 static unsigned int fgMaxTasksPerFilePerWorker;
99 TTreeProcessorMT(std::string_view filename, std::string_view treename =
"");
100 TTreeProcessorMT(
const std::vector<std::string_view> &filenames, std::string_view treename =
"");
101 TTreeProcessorMT(TTree &tree,
const TEntryList &entries);
102 TTreeProcessorMT(TTree &tree);
104 void Process(std::function<
void(TTreeReader &)> func);
105 static void SetMaxTasksPerFilePerWorker(
unsigned int m);
106 static unsigned int GetMaxTasksPerFilePerWorker();
111 #endif // defined TTreeProcessorMT