-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Closed
Copy link
Description
Check duplicate issues.
- Checked for duplicates
Description
TAxis constructor from the bin-edges "allows" the same edges in the list:
import ROOT
axis1 = ROOT.TAxis ( [1,2] ) ## OK
axis2 = ROOT.TAxis ( [2,1] ) ## properly fails: it is OK
axis3 = ROOT.TAxis ( [1,1] ) ## silently acceptd, but it is *NOT* OK
The issue comes from TAxis::Set method, that must checks that edges
are in increasing order, but indeed it checks that the order is non-decreasing:
from TAxis.cxx , see line 803
795void TAxis::Set(Int_t nbins, const Float_t *xbins)
796{
797 Int_t bin;
798 fNbins = nbins;
799 fXbins.Set(fNbins+1);
800 for (bin=0; bin<= fNbins; bin++)
801 fXbins.fArray[bin] = xbins[bin];
802 for (bin=1; bin<= fNbins; bin++)
803 if (fXbins.fArray[bin] < fXbins.fArray[bin-1])
804 Error("TAxis::Set", "bins must be in increasing order");
805 fXmin = fXbins.fArray[0];
806 fXmax = fXbins.fArray[fNbins];
807 if (!fParent) SetDefaults();
808}
809
There should be <= instead of < at line 803
And the same for TAXis::Set method with const Double_t* argument
Reproducer
Reproducer is trivial:
import ROOT
axis1 = ROOT.TAxis ( [1,2] ) ## OK
axis2 = ROOT.TAxis ( [2,1] ) ## properly fails, it is OK
axis3 = ROOT.TAxis ( [1,1] ) ## silently accepts, but it is not OK
ROOT version
I think it is a very ancient code and the problem should be there for all versions of ROOT...
I am working with LCG cvmfs nightlies dev3 slot
Installation method
LCG cvmfs nightlies dev3
Operating system
Linux, el9, lxplus
Additional context
I think it is a very ancient code and the problem should be there for all versions of ROOT...
Metadata
Metadata
Assignees
Type
Projects
Status
No status