13const UInt_t nNumbers = 20000000U;
18Int_t mt001_fillHistos()
26 auto workItem = [](
UInt_t workerID) {
29 TFile f(
Form(
"myFile_mt001_%u.root", workerID),
"RECREATE");
30 TH1F h(
Form(
"myHisto_%u", workerID),
"The Histogram", 64, -4, 4);
31 for (
UInt_t i = 0; i < nNumbers; ++i) {
32 h.Fill(workerRndm.Gaus());
38 std::vector<std::thread> workers;
41 for (
auto workerID :
ROOT::
TSeqI(nWorkers)) {
42 workers.emplace_back(workItem, workerID);
46 for (
auto &&worker : workers)
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
1-D histogram with a float per channel (see TH1 documentation)}
Random number generator class based on M.
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...