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.
{
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->SetFillColor(48);
} else {
}
for (int i = 0; i < 25000000; ) {
if (idx%2 == 0)
hpx->Fill(px);
else
hpx->Fill(px,py);
++i;
mess.WriteInt(idx);
mess.WriteTString(file->
GetName());
mess.WriteLong64(file->
GetEND());
messlen += mess.Length();
cmesslen += mess.CompLength();
hpx->Reset();
}
}
if (cmesslen > 0)
printf("Average compression ratio: %g\n", messlen/cmesslen);
}
int Int_t
Signed integer 4 bytes (int).
bool Bool_t
Boolean (0=false, 1=true) (bool).
float Float_t
Float 4 bytes (float).
externTBenchmark * gBenchmark
Error("WriteTObject","The current directory (%s) is not associated with a file. The object (%s) has not been written.", GetName(), objname)
void Info(const char *location, const char *msgfmt,...)
Use this function for informational messages.
void Fatal(const char *location, const char *msgfmt,...)
Use this function in case of a fatal error. It will abort the program.
Int_t Write(const char *name=nullptr, Int_t opt=0, Int_t bufsize=0) override
Write memory objects to this file.
virtual Long64_t GetEND() const
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)
A TMemFile is like a normal TFile except that it reads and writes only from memory.
virtual Long64_t CopyTo(void *to, Long64_t maxsize) const
Copy the binary representation of the TMemFile into the memory area starting at 'to' and of length at...
void ResetAfterMerge(TFileMergeInfo *) override
Wipe all the data from the permanent buffer but keep, the in-memory object alive.
static void EnableSchemaEvolutionForAll(Bool_t enable=kTRUE)
Static function enabling or disabling the automatic schema evolution.
const char * GetName() const override
Returns name of object.
This class implements client sockets.
virtual Int_t Recv(TMessage *&mess)
Receive a TMessage object.
virtual void Close(Option_t *opt="")
Close the socket.
virtual Bool_t IsValid() const
virtual Int_t Send(const TMessage &mess)
Send a TMessage object.
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.