TTree::Draw histogram addition

Hi all,

I was wondering if there’s an easy way to use TTree::Draw to plot two variables on the same 1D histogram, adding the distributions (not the variables) together. Normally I would plot both variables to temp histograms then add both histograms, but I was wondering if there’s a simpler way.

Cheers,
N.

T.Draw("var1>>hvar"); T.Draw("var2>>+hvar");
see doc of TTree::Draw

Rene

Hi Rene,

This works well, thanks.
However, when using the binning option, the dest histogram is reset and contains only the last dumped histogram.

t.Draw("x>>h(10,,)");
t.Draw("y>>+h(10,,)");

contains only y.

N.

My mistake.

The second draw should not have the binning and then it works well.