20const UInt_t nNumbers = 20000000U;
26const auto workSize = nNumbers / nWorkers;
32 ntuple.Fill(rndm.
Gaus());
35Int_t mt101_fillNtuples()
45 TFile ofile(
"mt101_singleCore.root",
"RECREATE");
46 TNtuple randomNumbers(
"singleCore",
"Random Numbers",
"r");
47 fillRandom(randomNumbers, rndm, nNumbers);
48 randomNumbers.Write();
58 auto workItem = [](
UInt_t workerID) {
61 TFile ofile(
Form(
"mt101_multiCore_%u.root", workerID),
"RECREATE");
62 TNtuple workerRandomNumbers(
"multiCore",
"Random Numbers",
"r");
63 fillRandom(workerRandomNumbers, workerRndm, workSize);
64 workerRandomNumbers.Write();
69 std::vector<std::thread> workers;
72 for (
auto workerID :
ROOT::
TSeqI(nWorkers)) {
73 workers.emplace_back(workItem, workerID);
77 for (
auto &&worker : workers)
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
A simple TTree restricted to a list of float variables only.
Random number generator class based on M.
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...