TAxis::operator==

TAxis::operator== do not behave in the way one should imagine. Two axes should be equal if their binning is the same:

TH1F h1;
TH1F h2;

h1.GetXaxis() == h2.GetXaxis(); // this return false

is it possible to implement this operator?

Also this is not working in the expected behaviour:

h1.GetXaxis()->GetXbins() == h2.GetXaxis()->GetXbins()

Hi,

This could be done, but on the other hand since we are comparing doubles we should introduce a tolerance in the comparison.
There are some functions but they are protected in TH1, TH1::CheckAxisLimits and TH1::CheckBinLimits.
You could copy the code if you need.

You cannot use now h1.GetXaxis() == h2.GetXaxis(), because it does a pointer comparison.

Lorenzo

Exactly, what I need is TH1::CheckAxisLimits. It would be good to have it implemented as operator== of the TAxis