I have a pretty complicated piece of code that spits out a histogram.
Unfortunately, the histograms x-axis appears completely broken upon being drawn, with all the labels being shown at the very left end of the x-axis. The three bins should be labeled “CR”, “SR1” and “SR2”.
Unfortunately, the problem occurs inside a much larger software package (~100k lines of code), and since “Clone()” will also clone the defect, the only solution is hardcoding the histogram properties into a loop that runs over thousands of histograms that do not exhibit this problem - so that is not really an option.
Unfortunately not. I’ve tried to recreate the things that we do to the histogram in a small script.
However, the result looks fine, so I’m really puzzled what causes the problem. Here’s what I’ve tried so far:
Unfortunately, the example code I posted does not exhibit the problem, so also cloning it doesn’t reproduce the issue. It’s just that when I clone the histogram from the root file I posted that it will also be corrupted.
Ah ok … so the histogram is corrupted in you big program. My guess is that there is some overwriting going there.
Have you tried to compile it in debug mode ? use tool like valgrind to analyse memory corruption ?
This is well possible, I’ll have a look as soon as time permits.
However, I would hope that it would somehow be possible to fix the corruption and reset the axis properties to the defaults, no?
The dump doesn’t show anything weird except the name:
root [3] BDT->GetXaxis()->Dump()
==> Dumping object at: 0x00007fe3d0678058, name=(fmod([EventIndex],2)==0) ? [MVA:weights/run2_vbf_MVA_BDT0_bVeto_ODD.weights.xml] : [MVA:weights/run2_vbf_MVA_BDT0_bVeto_EVEN.weights.xml], class=TAxis
fNbins 3 Number of bins
fXmin 0 low edge of first bin
fXmax 1 upper edge of last bin
fXbins ->7fe3d06780d8 Bin edges array in X
fXbins.*fArray ->0 [fN] Array of fN doubles
fXbins.fN 0 Number of array elements
fFirst 0 first bin to display
fLast 0 last bin to display
fBits2 0 second bit status word
fTimeDisplay false on/off displaying time values instead of numerics
fTimeFormat Date&time format, ex: 09/12/99 12:34:00
fTimeFormat.fRep ->7fe3d0678108 ! String data
fTimeFormat.fRep. ->7fe3d0678108
*fParent ->7fe3d0677fe0 !Object owning this axis
*fLabels ->7fe3d3453710 List of labels
fName (fmod([EventIndex],2object identifier
fName.fRep ->7fe3d0678070 ! String data
fName.fRep. ->7fe3d0678070
fTitle BDT object title
fTitle.fRep ->7fe3d0678088 ! String data
fTitle.fRep. ->7fe3d0678088
fUniqueID 0 object unique identifier
fBits 0x03000008 bit field status word
fNdivisions 510 Number of divisions(10000*n3 + 100*n2 + n1)
fAxisColor 1 color of the line axis
fLabelColor 1 color of labels
fLabelFont 42 font for labels
fLabelOffset 0.005 offset of labels
fLabelSize 0.035 size of labels
fTickLength 0.03 length of tick marks
fTitleOffset 1 offset of axis title
fTitleSize 0.035 size of axis title
fTitleColor 1 color of axis title
fTitleFont 42 font for axis title
I don’t know, I’m a bit suspicious of the “fBits” and “fBits2” flags, but I wouldn’t know what you would expect to see there, so to me, everything looks fine…