15void df013_InspectAnalysis()
19 const auto nSlots = 0 == poolSize ? 1 : poolSize;
23 const auto nEvents = nSlots * 10000ull;
28 auto heavyWork = [&
r]() {
29 for (
volatile int i = 0; i < 1000000; ++i)
36 auto df =
d.Define(
"x", heavyWork);
41 auto h = df.Histo1D<
double>({
"browserHisto",
"", 100, -2., 2.},
"x");
52 auto dfDirectory =
new TMemFile(
"RDFResults",
"RECREATE");
53 auto browser =
new TBrowser(
"b", dfDirectory);
55 auto browserPad =
gPad;
64 h.OnPartialResult(
h.kOnce, [dfDirectory](
TH1D &h_) { dfDirectory->Add(&h_); });
71 h.OnPartialResult(50, [&browserPad](
TH1D &hist) {
90 std::string progressBar;
93 const auto everyN = nSlots == 8 ? 1000 : 100ull * nSlots;
94 const auto barWidth = nEvents / everyN;
95 h.OnPartialResultSlot(everyN, [&barWidth, &progressBar, &barMutex](
unsigned int ,
TH1D & ) {
96 std::lock_guard<std::mutex>
l(barMutex);
97 progressBar.push_back(
'#');
99 std::cout <<
"\r[" << std::left << std::setw(barWidth) << progressBar <<
']' << std::flush;
108 std::cout <<
"Analysis running..." << std::endl;
110 std::cout <<
"\nDone!" << std::endl;
114 dfDirectory->Clear();
115 auto clone =
static_cast<TH1D *
>(
h->Clone());
117 dfDirectory->Add(clone);
R__EXTERN TSystem * gSystem
ROOT's RDataFrame offers a high level interface for analyses of data stored in TTrees,...
Using a TBrowser one can browse all ROOT objects.
1-D histogram with a double per channel (see TH1 documentation)}
virtual void SetDirectory(TDirectory *dir)
By default when an histogram is created, it is added to the list of histogram objects in the current ...
virtual void Draw(Option_t *option="")
Draw this histogram with options.
A TMemFile is like a normal TFile except that it reads and writes only from memory.
This is the base class for the ROOT Random number generators.
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
void EnableImplicitMT(UInt_t numthreads=0)
Enable ROOT's implicit multi-threading for all objects and methods that provide an internal paralleli...
UInt_t GetThreadPoolSize()
Returns the size of ROOT's thread pool.