20const UInt_t nNumbers = 20000000U;
26const auto workSize = nNumbers / nWorkers;
35Int_t mt101_fillNtuples()
45 TFile ofile(
"mp101_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;
73 workers.emplace_back(workItem, workerID);
77 for (
auto &&worker : workers)
char * Form(const char *fmt,...)
A pseudo container class which is a generator of indices.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
A simple TTree restricted to a list of float variables only.
virtual Int_t Fill()
Fill a Ntuple with current values in fArgs.
Random number generator class based on M.
virtual Double_t Gaus(Double_t mean=0, Double_t sigma=1)
Samples a random number from the standard Normal (Gaussian) Distribution with the given mean and sigm...
void EnableThreadSafety()
Enables the global mutex to make ROOT thread safe/aware.