Fill histograms in parallel and write them on file with a multithreaded approach using TThreadExecutor and TExecutor::Map.
const UInt_t nNumbers = 20000000U;
{
auto workItem = [](
UInt_t workerID) {
TFile f(
Form(
"myFile_mtbb001_%u.root", workerID),
"RECREATE");
TH1F h(
Form(
"myHisto_%u", workerID),
"The Histogram", 64, -4, 4);
for (
UInt_t i = 0; i < nNumbers; ++i) {
h.Fill(workerRndm.Gaus());
}
return 0;
};
return 0;
}
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.
This class provides a simple interface to execute the same task multiple times in parallel threads,...
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.
- Date
- January 2016
- Author
- Danilo Piparo
Definition in file mtbb_fillHistos.C.