Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
mp_parallelHistoFill.C
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_analysis_parallel
3/// \notebook -js
4/// Fill histogram in parallel with a multiprocessing approach
5/// using TProcessExecutor and TExecutor::MapReduce.
6///
7/// \macro_image
8/// \macro_code
9///
10/// \date January 2016
11/// \author Danilo Piparo
12
13const UInt_t poolSize = 4U;
14
16{
17 TH1::AddDirectory(false);
19 auto fillRandomHisto = [](int seed = 0) {
20 TRandom3 rndm(seed);
21 auto h = new TH1F("myHist", "Filled in parallel", 128, -8, 8);
22 for (auto i : ROOT::TSeqI(1000000)) {
23 h->Fill(rndm.Gaus(0, 1));
24 }
25 return h;
26 };
27
28 auto seeds = ROOT::TSeqI(23);
31
32 auto c = new TCanvas();
33 sumRandomHisto->Draw();
34 return 0;
35}
#define c(i)
Definition RSha256.hxx:101
#define h(i)
Definition RSha256.hxx:106
int Int_t
Definition RtypesCore.h:45
unsigned int UInt_t
Definition RtypesCore.h:46
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Merge collection of TObjects.
Definition PoolUtils.h:35
This class provides a simple interface to execute the same task multiple times in parallel,...
The Canvas class.
Definition TCanvas.h:23
1-D histogram with a float per channel (see TH1 documentation)
Definition TH1.h:877
static void AddDirectory(Bool_t add=kTRUE)
Sets the flag controlling the automatic add of histograms in memory.
Definition TH1.cxx:1264
Random number generator class based on M.
Definition TRandom3.h:27
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
TSeq< int > TSeqI
Definition TSeq.hxx:203