12 const UInt_t nNumbers = 20000000U;
15 const UInt_t nWorkers = 4U;
17 Int_t mt001_fillHistos()
25 auto workItem = [](
UInt_t workerID) {
28 TFile f(
Form(
"myFile_%u.root", workerID),
"RECREATE");
29 TH1F h(
Form(
"myHisto_%u", workerID),
"The Histogram", 64, -4, 4);
30 for (
UInt_t i = 0; i < nNumbers; ++i) {
31 h.
Fill(workerRndm.Gaus());
37 std::vector<std::thread> workers;
41 workers.emplace_back(workItem, workerID);
45 for (
auto && worker : workers) worker.join();
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
Random number generator class based on M.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
tomato 1-D histogram with a float per channel (see TH1 documentation)}
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.