Draw two branch from different root files on the same canvas

Dear ROOTers

I have two different root files - each of which contains a tree that has multiple branches. I want to compare the same branches from different root files by drawing them on the same canvas.
Any help with writing a macros to do the same would be much appreciated!

Thanks,
Tanvi

Hi,

you don’t draw branches but rather some entity which “reduces” the data it carries, e.g. an histogram.
I think the best way is to draw the two histograms and draw them on the same canvas via the “SAME” draw option.
How are you drawing the content of your trees?

Cheers,
D

Hi Danilo,
Thanks for the reply!
I managed to make the superimposed histograms. In order to compare I normalized each of the distribution to the number of events.

for eg:
h1->GetEntries()
h1->Scale(1/1.56168e+06)
h1->Draw()

But this gives a histograms that has broken lines.

Screen Shot 2017-04-23 at 8.19.29 AM

Do I need to use a different draw option?

Thanks again!

“HIST”: https://root.cern/doc/master/classTHistPainter.html
’’‘
When an histogram has errors it is visualized by default with error bars. To visualize it without errors use the option “HIST” together with the required option (eg “hist same c”). The “HIST” option can also be used to plot only the histogram and not the associated function(s).
’’'
I hope that helps!

Cheers,
D

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.