[ROOT] TH1::GetMinimum(), TH1::GetMaximum() and operator/

From: Alexandr Malusek (Alexandr.Malusek@imv.liu.se)
Date: Wed Oct 02 2002 - 20:37:04 MEST


Hi,

I just wonder if the following is a bug or feature.

Functions GetMinimum() and GetMaximum() don't return minimum and
maximum values for "hc = hb/ha" in the following situation:

$ cat ex_test.C
// A problem with GetMinimum() and GetMaximum()
{
  const Int_t dim = 3;
  // The histogram ha
  TH1F *ha = new TH1F("ha", "ha", dim, 0, 1);
  for (Int_t i = 1; i <= dim; i++)
    ha->SetBinContent(i, i);
  ha->SetMinimum(1);
  ha->SetMaximum(10);

  // The histogram hb
  TH1F *hb = new TH1F("hb", "hb", 3, 0, 1);
  for (Int_t i = 1; i <= dim; i++)
    hb->SetBinContent(i, i*i);
  hb->SetMinimum(0.5);
  hb->SetMaximum(100);

  // The histogram hc
  TH1F *hc = new TH1F(*hb / *ha);
  
  cout << "\tminimum\tmaximum" << endl;
  cout << "ha:\t" << ha->GetMinimum() << '\t' << ha->GetMaximum() << endl;
  cout << "hb:\t" << hb->GetMinimum() << '\t' << hb->GetMaximum() << endl;
  cout << "hc:\t" << hc->GetMinimum() << '\t' << hc->GetMaximum() << endl;
}

root [] .x ex_test.C
        minimum maximum
ha:     1       10          # OK
hb:     0.5     100         # OK
hc:     0.5     100         # I expected min = 1/1 = 1, max = 9/3 = 3

I use root 3.03/08 on IA32 Linux.

--
Alexandr.Malusek@imv.liu.se



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:12 MET