Alphanumerical bin labels won't transfer with TSocket::Send

Hi.

I use TH1::SetBinLabel to create alphanumeric labels for a histogram. While this works within that program, when I try to send it to another client with TSocket::Send, I lose the labels. Is there a workaround for this?

I am attaching the macros that reproduce the problem.

Cheers.

–Christos

PS which root
/afs/cern.ch/cms/external/lcg/external/root/5.12.00/slc3_ia32_gcc323/root/bin/root
hserv2_mod.C (2.06 KB)
hclient_mod.C (1.64 KB)

Hi Christos,

You are not drawing the histogram transfered via the socket but another one.
Simply replace (in hserv2_mod.C) the line

my_h->Draw(); by

h->Draw();

Rene

Ah, yes, good point.

(The reason I do this at the receiving end is that I want to add the histogram that was just received to another one. But I still want to keep the original labels.)

Is there any flag I can check to see if the received histogram is using alphanumeric labels?

–C

I think I found the answer. I want to be checking TAxis::GetLabels();

The following piece of code when I create a new histogram at the receiving end seems to do the trick

	   if(h->GetXaxis()->GetLabels())
	     {
	       for(int i = 1; i != h->GetNbinsX()+1; ++i)
		       my_h->GetXaxis()->SetBinLabel( i, h->GetXaxis()->GetBinLabel(i));
        }

Thanks.