Hi Alexandr,
Once you have set a max/minimum for an histogram, this min/max value
is not changed by an operation because in general this does not make
sense.
If you do not set the min/max, then GetMaximum/GetMinimum will
return the expected value after the operation.
In your case, you can reset the max/min (see code below).
Then GetMaximum/Minimum will recompute it automatically.
Rene Brun
On 2 Oct 2002, Alexandr Malusek wrote:
> 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);
hc->SetMaximum(-1111); //-1111 is a special value to reset the max/min
hc->SetMinimum(-1111);
>
> 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