15const UInt_t nNumbers = 20000000U;
28 auto workItem = [](
UInt_t workerID) {
31 TFile f(
Form(
"myFile_mt001_%u.root", workerID),
"RECREATE");
32 TH1F h(
Form(
"myHisto_%u", workerID),
"The Histogram", 64, -4, 4);
33 for (
UInt_t i = 0; i < nNumbers; ++i) {
34 h.Fill(workerRndm.Gaus());
40 std::vector<std::thread> workers;
44 workers.emplace_back(workItem, workerID);
48 for (
auto &&worker : workers)
int Int_t
Signed integer 4 bytes (int).
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
A file, usually with extension .root, that stores data and code in the form of serialized objects in ...
1-D histogram with a float per channel (see TH1 documentation)
Random number generator class based on M.
void EnableThreadSafety()
Enable support for multi-threading within the ROOT code in particular, enables the global mutex to ma...