17 const UInt_t nNumbers = 20000000U;
20 const UInt_t nThreads = 4U;
23 const auto workSize = nNumbers / nThreads;
31 Int_t mtbb101_fillNtuples()
41 TFile ofile(
"mp101_singleCore.root",
"RECREATE");
42 TNtuple randomNumbers(
"singleCore",
"Random Numbers",
"r");
44 randomNumbers.Write();
50 auto workItem = [](
UInt_t workerID) {
53 TFile ofile(
Form(
"mp101_multiCore_%u.root", workerID),
"RECREATE");
54 TNtuple workerRandomNumbers(
"multiCore",
"Random Numbers",
"r");
55 fillRandom(workerRandomNumbers, workerRndm, workSize);
56 workerRandomNumbers.Write();
61 ROOT::TThreadExecutor pool(nThreads);
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 fillRandom(std::vector< T > &randomV, const rangeType theRangeType)
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.