The fixes which are present in the TAxis::SetRangeUser method are missing in the TH1::SetAxisRange method.
Thanks Wile! This is for @moneta
Hi,
I guess you are referring to this code:
// fixes for numerical error and for https://savannah.cern.ch/bugs/index.php?99777
if (GetBinUpEdge(ifirst) <= ufirst ) ifirst += 1;
if (GetBinLowEdge(ilast) >= ulast ) ilast -= 1;
SetRange(ifirst, ilast);
I am not sure it is really useful. Do you have an example where it is really needed ?
Unfortunately the link to the Savannah item is lost
Cheers
Lorenzo
{
TH1F *h = new TH1F("h", "h", 100, 0., 100.);
h->GetXaxis()->SetRangeUser(0., 100.);
std::cout << h->GetXaxis()->GetLast() << "\n";
h->SetAxisRange(0., 100.);
std::cout << h->GetXaxis()->GetLast() << "\n";
}
Hi,
Thanks for the example. This is not a fix due to a numerical error, but a bug in Taxis::SetAxisRange
when the upper value is equal to the bin upper edge. yes we need to have:
if (GetBinLowEdge(ilast) >= ulast ) ilast -= 1;
instead I am not sure if the other check is really needed, however is not harmful, so we could keep it
Lorenzo
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.