12 #ifndef ROOT_TBranchIMTHelper
13 #define ROOT_TBranchIMTHelper
26 class TBranchIMTHelper {
29 using TaskGroup_t = ROOT::Experimental::TTaskGroup;
33 template<
typename FN>
void Run(
const FN &lambda) {
35 if (!fGroup) { fGroup.reset(
new TaskGroup_t()); }
37 auto nbytes = lambda();
51 if (fGroup) fGroup->Wait();
55 Long64_t GetNbytes() {
return fBytes; }
56 Long64_t GetNerrors() {
return fNerrors; }
59 std::atomic<Long64_t> fBytes{0};
60 std::atomic<Int_t> fNerrors{0};
62 std::unique_ptr<TaskGroup_t> fGroup;