# Re: summation of histograms

From: nasim <nasim_at_hep.man.ac.uk>
Date: Wed, 1 Feb 2006 14:47:44 +0000 (GMT)

Hi Rene,
Thank you for the reply. But still there is a problem in drawing the histogram
if we have
TH1F h4= n1*(*h1)+n2*(*h2)+n3*(h3)...
where n1 ,n2 and n3 are the normalization factors how can I draw the results (h4 is not a pointer).

I aslo thought if I multiply the first histogram : histo->Multiply(h1,n1);
and then add it to others

I am not sure about how to use multiplication and adding function in this case.

Histo needs to be difined as an TH1F. how can I possibly do that

Many Thanks,
Nasim

On Mon, 30 Jan 2006, Rene Brun wrote:

> Do, for example
>
> TFile *f1 = new TFile("file1.root");
> TH1 *h1 = (TH1*)f1->Get("myhist");
> TFile *f2 = new TFile("file2.root");
> TH1 *h2 = (TH1*)f2->Get("myhist");
> TH1F h3 = (*h1) + (*h2);
>
> Rene Brun
>
>
> On Mon, 30 Jan 2006, nasim wrote:
>
> >
> > Hi,
> >
> > If we have two or more written histograms with the same name in two
> > different files. how we can find the sum of these histograms (H1+H2+...)or
> > (H1-H2);
> >
> > Thanks for any help.
> >
> > Nasim.
> >
>
Received on Wed Feb 01 2006 - 15:47:54 MET

This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:31:57 MET