19 const UInt_t nNumbers = 20000000U;
22 const UInt_t nWorkers = 4U;
25 const auto workSize = nNumbers / nWorkers;
33 Int_t mt101_fillNtuples()
43 TFile ofile(
"mp101_singleCore.root",
"RECREATE");
44 TNtuple randomNumbers(
"singleCore",
"Random Numbers",
"r");
45 fillRandom(randomNumbers, rndm, nNumbers);
46 randomNumbers.Write();
56 auto workItem = [](
UInt_t workerID) {
59 TFile ofile(
Form(
"mt101_multiCore_%u.root", workerID),
"RECREATE");
60 TNtuple workerRandomNumbers(
"multiCore",
"Random Numbers",
"r");
61 fillRandom(workerRandomNumbers, workerRndm, workSize);
62 workerRandomNumbers.Write();
67 std::vector<std::thread> workers;
71 workers.emplace_back(workItem, workerID);
75 for (
auto && worker : workers) worker.join();
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...
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.
char * Form(const char *fmt,...)
void EnableThreadSafety()
Enables the global mutex to make ROOT thread safe/aware.
A pseudo container class which is a generator of indices.
virtual Int_t Fill()
Fill a Ntuple with current values in fArgs.