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 fastMergeServer.C
- Execute in the other windows: root.exe -b -l -q .x treeClient.C (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.
{
Error(
"treeClient",
"Could not establish a connection with the server %s:%d.",
"localhost",9090);
return;
}
Int_t status, version, kind;
sock->
Recv(status, kind);
if (kind != 0 )
{
Error(
"treeClient",
"Unexpected server message: kind=%d status=%d\n",kind,status);
delete sock;
return;
}
sock->
Recv(version, kind);
if (kind != 1 )
{
Fatal(
"treeClient",
"Unexpected server message: kind=%d status=%d\n",kind,status);
} else {
Info(
"treeClient",
"Connected to fastMergeServer version %d\n",version);
}
int idx = status;
if (idx == 0) {
hpx =
new TH1F(
"hpx",
"This is the px distribution",100,-4,4);
} else {
hpx =
new TH2F(
"hpxpy",
"py vs px",40,-4,4,40,-4,4);
}
gRandom->SetSeed();
const int kUPDATE = 1000000;
for (int i = 0; i < 25000000; ) {
gRandom->Rannor(px,py);
if (idx%2 == 0)
else
++i;
if (i && (i%kUPDATE) == 0) {
}
}
if (cmesslen > 0)
printf("Average compression ratio: %g\n", messlen/cmesslen);
}
- Authors
- Fons Rademakers, Philippe Canal
Definition in file treeClient.C.