Client program which creates and fills a histogram.
Every 1000 fills the histogram is send to the server which displays the histogram.
To run this demo do the following:
- Open three windows
- Start ROOT in all three windows
- Execute in the first window: .x hserv.C (or hserv2.C)
- Execute in the second and third windows: .x hclient.C If you want to run the hserv.C on a different host, just change "localhost" in the TSocket ctor below to the desired hostname.
The script argument "evol" can be used when using a modified version of the script where the clients and server are on systems with different versions of ROOT. When evol is set to kTRUE the socket will support automatic schema evolution between the client and the server.
{
char str[32];
int idx = !strcmp(str, "go 0") ? 0 : 1;
if (idx == 1)
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);
}
for (int i = 0; i < 25000; i++) {
if (idx == 0)
else
mess.Reset();
mess.WriteObject(hpx);
messlen += mess.Length();
cmesslen += mess.CompLength();
}
}
if (cmesslen > 0)
printf("Average compression ratio: %g\n", messlen/cmesslen);
}
R__EXTERN TBenchmark * gBenchmark
R__EXTERN TRandom * gRandom
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
virtual void Start(const char *name)
Starts Benchmark with the specified name.
virtual void Show(const char *name)
Stops Benchmark name and Prints results.
1-D histogram with a float per channel (see TH1 documentation)
TH1 is the base class of all histogram classes in ROOT.
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
2-D histogram with a float per channel (see TH1 documentation)
static void EnableSchemaEvolutionForAll(Bool_t enable=kTRUE)
Static function enabling or disabling the automatic schema evolution.
virtual void SetSeed(ULong_t seed=0)
Set the random generator seed.
virtual void Rannor(Float_t &a, Float_t &b)
Return 2 numbers distributed following a gaussian with mean=0 and sigma=1.
void SetCompressionLevel(Int_t level=ROOT::RCompressionSetting::ELevel::kUseMin)
See comments for function SetCompressionSettings.
virtual Int_t Recv(TMessage *&mess)
Receive a TMessage object.
virtual void Close(Option_t *opt="")
Close the socket.
virtual Int_t Send(const TMessage &mess)
Send a TMessage object.
- Author
- Fons Rademakers
Definition in file hclient.C.