I’m facing an issue while trying to generate histograms with pullplot in ROOT using a script that utilizes two dictionaries: global.yaml and histos2dta.yaml. I can generate the histograms correctly, but I’m unable to get the xlabels to appear on the histograms that have pullplot.
I have attached to this post the script I’m using (script.C) and the two mentioned dictionaries (global.yaml and histos2dta.yaml). They define histogram parameters and general configurations.
The specific problem is that, even though I define the xlabels correctly in both the dictionaries and the script, when I use the function to generate the pullplot, the xlabels are not displayed on the resulting plot. I have checked the ROOT documentation and reviewed the code, but I haven’t been able to identify what is causing this behavior.
My gitlab address is rmacedod and the file is on master. As I’m new to the forum, I can’t upload the file or send the link.
Thanks for the post and welcome to the ROOT Community!
Could you write here in this post a minimal code snippet that reproduces your problem? The information is too terse to even start the guesswork at this point I fear.
This is the part of the code related to reading the xlabels:
# ================NOW LETS READ THE XLABEL FROM THE YAML FILE =======================
#reading the ylabel if it was just above the mais class. like below:
"""
jets:
xlabel: -> heree
pt:
Histograms:
"""
for k,v in dictionary1.items():
if "xlabel" in dictionary1[k]:
if( subclassArray[kl] in dictionary1[k]):
ax1.set_xlabel(dictionary1[k]["xlabel"])
#reading the ylabel just after it was defined in the subclass:
"""
jets:
pt:
xlabel: "here" -> here
Histograms:
rec_jet1Pt:
"""
for k,v in dictionary1.items():
if( subclassArray[kl] in dictionary1[k]):
if "xlabel" in dictionary1[k][subclassArray[kl]]:
ax1.set_xlabel(dictionary1[k][subclassArray[kl]]["xlabel"])
#reading the xlabel if it was defined inside the histogram name.
"""
jets:
xlabel: -> heree
pt:
Histograms:
rec_jet1Pt:
xlabel: "here" -> here
"""
for k,v in dictionary1.items():
#if "ylabel" in dictionary1[k]:
if( subclassArray[kl] in dictionary1[k]):
for j in range(nHistograms):
if( nameArray[j] in dictionary1[k][subclassArray[kl]]["Histograms"]):
if( "xlabel" in dictionary1[k][subclassArray[kl]]["Histograms"][nameArray[j]] ):
ax1.set_xlabel(dictionary1[k][subclassArray[kl]]["Histograms"][nameArray[j]]["xlabel"])
#================ END OF X LABEL READING ===========================================
#seting the maximum and minimum of yaxis
for k,v in dictionary1.items():
if( subclassArray[kl] in dictionary1[k]):
if "ylimmax" in dictionary1[k][subclassArray[kl]]:
ax1.set_ylim( top = dictionary1[k][subclassArray[kl]]["ylimmax"] )
if "ylimmax" in dictionary1[k][subclassArray[kl]] and "ylimmin" in dictionary1[k][subclassArray[kl]]:
ax1.set_ylim(dictionary1[k][subclassArray[kl]]["ylimmin"] , dictionary1[k][subclassArray[kl]]["ylimmax"] )
#else:
# ax1.set_ylim(bottom=1.0)
for k,v in dictionary1.items():
if( subclassArray[kl] in dictionary1[k]):
if "xlimmax" in dictionary1[k][subclassArray[kl]]:
ax1.set_xlim( right = dictionary1[k][subclassArray[kl]]["xlimmax"] )
try:
ax2.set_xlim( right = dictionary1[k][subclassArray[kl]]["xlimmax"] )
except:
pass
if "xlimmin" in dictionary1[k][subclassArray[kl]]:
ax1.set_xlim( left = dictionary1[k][subclassArray[kl]]["xlimmin"] )
try:
ax2.set_xlim( left = dictionary1[k][subclassArray[kl]]["xlimmin"] )
except:
pass
if "xlimmax" in dictionary1[k][subclassArray[kl]] and "xlimmin" in dictionary1[k][subclassArray[kl]]:
ax1.set_xlim(dictionary1[k][subclassArray[kl]]["xlimmin"] , dictionary1[k][subclassArray[kl]]["xlimmax"] )
try:
ax2.set_xlim(dictionary1[k][subclassArray[kl]]["xlimmin"] , dictionary1[k][subclassArray[kl]]["xlimmax"] )
except:
pass
#HERE WE ARE READING THE LABELS OF THE PULL PLOT
for k,v in dictionary1.items():
if( subclassArray[kl] in dictionary1[k]):
if "pullplot" in dictionary1[k][subclassArray[kl]]:
if(dictionary1[k][subclassArray[kl]]["pullplot"]):
for k,v in dictionary1.items():
if "xlabel" in dictionary1[k]:
if( subclassArray[kl] in dictionary1[k]):
ax2.set_xlabel(dictionary1[k]["xlabel"])
#reading the ylabel just after it was defined in the subclass:
"""
jets:
pt:
xlabel: "here" -> here
Histograms:
rec_jet1Pt:
"""
for k,v in dictionary1.items():
if( subclassArray[kl] in dictionary1[k]):
if "xlabel" in dictionary1[k][subclassArray[kl]]:
ax2.set_xlabel(dictionary1[k][subclassArray[kl]]["xlabel"])
#reading the xlabel if it was defined inside the histogram name.
"""
jets:
xlabel: -> heree
pt:
Histograms:
rec_jet1Pt:
xlabel: "here" -> here
"""
for k,v in dictionary1.items():
#if "ylabel" in dictionary1[k]:
if( subclassArray[kl] in dictionary1[k]):
for j in range(nHistograms):
if( nameArray[j] in dictionary1[k][subclassArray[kl]]["Histograms"]):
if( "xlabel" in dictionary1[k][subclassArray[kl]]["Histograms"][nameArray[j]] ):
ax2.set_xlabel(dictionary1[k][subclassArray[kl]]["Histograms"][nameArray[j]]["xlabel"])