#include <iostream>
#include <future>
#include <random>
double wasteCPUTime(std::mt19937 &gen)
{
return std::generate_canonical<double, 100>(gen) + std::generate_canonical<double, 100>(gen) +
std::generate_canonical<double, 100>(gen) + std::generate_canonical<double, 100>(gen) +
std::generate_canonical<double, 100>(gen);
}
using Filler_t = Experimental::RHistConcurrentFiller<Experimental::RH2D, 1024>;
void theTask(Filler_t filler)
{
std::mt19937 gen;
for (int i = 0; i < 3000000; ++i)
filler.Fill({wasteCPUTime(gen), wasteCPUTime(gen)});
}
{
Experimental::RHistConcurrentFillManager<Experimental::RH2D> fillMgr(hist);
std::array<std::thread, 8> threads;
for (auto &thr: threads) {
thr = std::thread(theTask, fillMgr.MakeFiller());
}
for (auto &thr: threads)
thr.join();
}
void concurrentfill()
{
concurrentHistFill(hist);
std::cout << hist.GetEntries() << '\n';
}
RHist< 2, double, RHistStatContent, RHistStatUncertainty > RH2D
Namespace for new ROOT classes and functions.