28 void treeClient(Bool_t evol=kFALSE)
30 gBenchmark->Start(
"treeClient");
33 TSocket *sock =
new TSocket(
"localhost", 9090);
34 if (!sock->IsValid()) {
35 Error(
"treeClient",
"Could not establish a connection with the server %s:%d.",
"localhost",9090);
41 Int_t status, version, kind;
42 sock->Recv(status, kind);
45 Error(
"treeClient",
"Unexpected server message: kind=%d status=%d\n",kind,status);
49 sock->Recv(version, kind);
52 Fatal(
"treeClient",
"Unexpected server message: kind=%d status=%d\n",kind,status);
54 Info(
"treeClient",
"Connected to fastMergeServer version %d\n",version);
62 TMemFile *file =
new TMemFile(
"mergedClient.root",
"RECREATE");
66 hpx =
new TH1F(
"hpx",
"This is the px distribution",100,-4,4);
67 hpx->SetFillColor(48);
69 hpx =
new TH2F(
"hpxpy",
"py vs px",40,-4,4,40,-4,4);
72 TTree *tree =
new TTree(
"tree",
"tree");
73 tree->SetAutoFlush(4000000);
74 tree->Branch(
"px",&px);
75 tree->Branch(
"py",&py);
77 TMessage::EnableSchemaEvolutionForAll(evol);
78 TMessage mess(kMESS_OBJECT);
82 const int kUPDATE = 1000000;
83 for (
int i = 0; i < 25000000; ) {
84 gRandom->Rannor(px,py);
91 if (i && (i%kUPDATE) == 0) {
93 mess.Reset(kMESS_ANY);
95 mess.WriteTString(file->GetName());
96 mess.WriteLong64(file->GetEND());
99 messlen += mess.Length();
100 cmesslen += mess.CompLength();
102 file->ResetAfterMerge(0);
106 sock->Send(
"Finished");
109 printf(
"Average compression ratio: %g\n", messlen/cmesslen);
111 gBenchmark->Show(
"hclient");