Re: Adding 2D histograms !

From: Rene Brun <Rene.Brun_at_cern.ch>
Date: Tue, 19 May 2009 06:55:45 +0200


You do not show all your code. The error references hist4 that is not in your listed lines.
Note that instead of

 hist1->Add(hist1, hist2);

you should do:

 hist1->Add(hist2);

Rene Brun

Saleem, Muhammad wrote:
> Hi,
>
> I am trying to add 2D histograms.
>
> This is what I do :
>
> TFile* file1 = new TFile("file1.root");
> TFile* ffile2 = new TFile("file2.root");
>
> TH2F* hist1;
> TH2F* hist2;
>
> hist1 = (TH2F*)f1->Get("h1_2D");
> hist2 = (TH2F*)f2->Get("h2_2D");
>
> hist1->Add(hist1, hist2);
>
> I get the following error:
>
> Error: illegal pointer to class object hist4 0x0 1232
> *** Interpreter error recovered ***
>
> Any idea, what am I doing wrong ?
>
> regards,
>
> ---saleem
>
>
>
>
Received on Tue May 19 2009 - 06:56:19 CEST

This archive was generated by hypermail 2.2.0 : Tue May 19 2009 - 11:50:03 CEST