Fill histogram in parallel with a multiprocessing approach using TProcessExecutor and TExecutor::MapReduce.
Int_t mp_parallelHistoFill()
{
auto fillRandomHisto = [](int seed = 0) {
auto h =
new TH1F(
"myHist",
"Filled in parallel", 128, -8, 8);
h->Fill(rndm.Gaus(0, 1));
}
};
auto sumRandomHisto = pool.MapReduce(fillRandomHisto, seeds, redfunc);
sumRandomHisto->Draw();
return 0;
}
int Int_t
Signed integer 4 bytes (int).
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
Merge collection of TObjects.
This class provides a simple interface to execute the same task multiple times in parallel,...
TDirectory::TContext keeps track and restore the current directory.
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 mp_parallelHistoFill.C.