13void mt103_fillNtupleFromMultipleThreads()
22 const size_t nEntries = 65535;
25 const size_t nWorkers = 4;
28 const size_t nEventsPerWorker = nEntries / nWorkers;
31 auto fileName =
"mt103_fillNtupleFromMultipleThreads.root";
38 auto work_function = [&](
int seed) {
39 auto f = merger.GetFile();
40 TNtuple ntrand(
"ntrand",
"Random Numbers",
"r");
44 ntrand.Fill(rnd.
Gaus());
49 std::vector<std::thread> workers;
52 workers.emplace_back(work_function, i + 1);
55 for (
auto &&worker : workers)
TBufferMerger is a class to facilitate writing data in parallel from multiple threads,...
A simple TTree restricted to a list of float variables only.
This is the base class for the ROOT Random number generators.
Double_t Gaus(Double_t x, Double_t mean, Double_t sigma)
Gauss.
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
void EnableThreadSafety()
Enable support for multi-threading within the ROOT code in particular, enables the global mutex to ma...