How to draw a 2D histogram with box option

I have a root file and there I have two branches (1st DST 2nd D0). I want to plot a 2D histogram by setting DST-D0 along y axis and D0 along x-axis. Can anyone provide a macro to draw 2D histogram like that with box option ?

Thanks in Advance

If “tree” is your tree:

tree->Draw("D0:DST","","BOX");

Thank you very much.It has worked. But Can you provide me a macro where I can set the axis range and other things as well.

auto h2 = new TH2D("h2","h2",nbinx,xmin,xmax,nbiny,ymin,ymax);
tree->Draw("D0:DST>>h2","","BOX");

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