Re: Probably doing something wrong, but ...

Rene Brun (Rene.Brun@cern.ch)
Mon, 03 Mar 1997 14:56:00 +0100


Chris Green wrote:
>
> Hi,
>
> Can someone tell me what's wrong with this:
>
> TH2F *h1 = new TH2F("hf1","Total Cross-sections at 161 GeV",71,19.5,90.5,71,19.5,90.5);
> TH2F *h2 = new TH2F();
> h1->Copy(h2);
> h2->TNamed("h2","Left-handed Cross-sections at 161 GeV");
>

You can do, either:
TH2F *h1 = new TH2F("hf1","Total Cross-sections at 161GeV",71,19.5,90.5,71,19.5,90.5);
TH2F *h2 = new TH2F();
h1->Copy(*h2);
h2->SetName("h2");
h2->SetTitle("Left-handed Cross-sections at 161 GeV");
or:
TH2F h1("hf1","Total Cross-sections at 161 GeV",71,19.5,90.5,71,19.5,90.5);
TH2F h2();
h1.Copy(h2);
h2.SetName("h2");
h2.SetTitle("Left-handed Cross-sections at 161 GeV");

In version 1.00, one can do directly:
TH2F h2 = h1;

Rene Brun