Re: Adding histograms

From: Rene Brun <>
Date: Mon, 13 Jun 2005 23:35:41 +0200 (MEST)


Modify hadd.C like in the code fragment below

            TH1 *h2 = (TH1*)key2->ReadObj();
            h2->Scale("your multiplication coefficient); //new line
            h1->Add( h2 );

Rene Brun

On Mon, 13 Jun 2005, Shamim,
Mansoora wrote:

> Hi All,
> I am trying to add histograms(with same name) from different root files. I have looked at the example hadd.C. What I want is the following: before writing one particular final histogram which will be the sum of the histograms from different root files I would like to assign a different weight to each histogram.
> h_final = 0.1*h_from_file1 + 0.4*h_from_file2 + 0.8*h_from_file3 ..etc.
> Could someone tell me how can I do that.I couldn`t find this option in hadd.C
> Thanks
> Mansoora
Received on Mon Jun 13 2005 - 23:35:47 MEST

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:09 MET