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.
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.
void EnableThreadSafety()
Enable support for multi-threading within the ROOT code in particular, enables the global mutex to ma...