Client program which creates and fills 2 histograms and a TTree.
Every 1000000 fills the histograms and TTree is send to the server which displays the histogram.
To run this demo do the following:
- Open at least 2 windows
- Start ROOT in the first windows
- Execute in the first window: .x parallelMergeServer.C
- Execute in the other windows: root.exe -b -q .x 'parallelMergeClient.C("<socket path printed by server>")' (You can put it in the background if wanted). If you want to run the hserv.C on a different host, just change "localhost" in the TSocket ctor below to the desired hostname.
#include <string>
void parallelMergeClient(const std::string &socketPath)
{
if (idx%2 == 0) {
hpx =
new TH1F(
"hpx",
"This is the px distribution",100,-4,4);
hpx->SetFillColor(48);
} else {
hpx =
new TH2F(
"hpxpy",
"py vs px",40,-4,4,40,-4,4);
}
for (int i = 0; i < 25000000; ) {
if (idx%2 == 0)
hpx->Fill(px);
else
hpx->Fill(px,py);
++i;
}
}
delete file;
}
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
float Float_t
Float 4 bytes (float).
externTBenchmark * gBenchmark
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
1-D histogram with a float per channel (see TH1 documentation)
TH1 is the base class of all histogram classes in ROOT.
2-D histogram with a float per channel (see TH1 documentation)
Int_t GetServerIdx() const
Int_t Write(const char *name=nullptr, Int_t opt=0, Int_t bufsize=0) override
Write memory objects to this file and upload them to the parallel merge server.
Bool_t UploadAndReset()
Upload the current file data to the merging server.
A TTree represents a columnar dataset.
virtual Int_t Fill()
Fill all branches.
TBranch * Branch(const char *name, T *obj, Int_t bufsize=32000, Int_t splitlevel=99)
Add a new branch, and infer the data type from the type of obj being passed.
virtual void SetAutoFlush(Long64_t autof=-30000000)
This function may be called at the start of a program to change the default value for fAutoFlush.
- Authors
- Fons Rademakers, Philippe Canal
Definition in file parallelMergeClient.C.