[ROOT] ROOT-Error in histogram subtraction

From: Marc-Andre Pleier (Marc-Andre.Pleier@mpi-hd.mpg.de)
Date: Thu Sep 06 2001 - 16:15:14 MEST


Hi,
I just found out there seems to be a bug in ROOT when you
subtract histograms:
Instead of subtracting the values in the stats array (sumw,
sumwx), they are added resulting e.g. in a corrupt mean value
for the histogram.
I crosschecked the subtraction with the same histograms in PAW,
where I get the mean value I expected.

Just as an example:
Take a histogram of your choice, an subtract it with itself:


   form1 = new TFormula("form1","abs(sin(x)/x)");
   sqroot = new TF1("sqroot","x*gaus(0) + [3]*form1",0,10);
   sqroot->SetParameters(10,4,1,20);
   h1f = new TH1F("h1f","Test random numbers",200,0,10);
   h1f->SetFillColor(45);
   h1f->FillRandom("sqroot",10000);
   h1f->Draw();
   h1f->Add(h1f, -1.);
   h1f->Draw();

Have a look at mean, rms,...

The ROOT version I use is:
3.01/06    29 August 2001

Cheers,
Marc-Andre.

-----------------------------------------------------------------------------
  Marc-Andre Pleier                             Tel. : +0049 6221 516506
  MPI Kernphysik                                Fax  : +0049 6221 516603
  Postfach 103980                               Email: Marc-Andre.Pleier
  D-69029 Heidelberg                                   @mpi-hd.mpg.de
-----------------------------------------------------------------------------



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:59 MET