rodian
October 2, 2023, 9:42pm
1
Hi,
I am trying to plot 2 histograms that are on different root file on the same canvas.
tree1.Draw(‘Electron.Eta’)
tree1.Draw(‘Electron.Phi’,‘Same’)
If two different histograms are on the same file, I am able to plot them together like above example.
tree1.Draw(‘Electron.Eta’)
tree2.Draw(‘Electron.Eta’,‘Same’)
But in this example, I cannot plot them together. Histograms are in the branch of the TTree. I couldn’t find any other method to plot the histograms, and with this method I am able to plot them, but I cannot plot them together. How can I fix this problem or do you suggest me any other method? Thank you in advance.
1 Like
Danilo
October 3, 2023, 5:14am
2
Hi,
I would propose to address this question with RDataFrame , the modern way of dealing with ROOT columnar data, like TTrees.
df = ROOT.RDataFrame("myTreeName", "myFileName.root")
h1 = df.Histo1d("Electron.Eta")
h2 = df.Histo1d("Electron.Phi")
h1.Draw()
h2.Draw("Same")
Assuming that plotting eta and phi on the same canvas is the desired objective.
Cheers,
D
1 Like
rodian
October 3, 2023, 5:04pm
3
With this method I can plot them on the same canvas. Thank you so much!
1 Like
system
Closed
October 17, 2023, 5:04pm
4
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.