TTree::Draw with custom binning

Hello,

here is the problem. I’d like to use TTree::Draw to drow a 2D histogram. That can be done by
Draw(“var1:var2>>h(nx,xmin,xmax,ny,ymin,ymax)”). The problem is that I need a not uniform binning.
Is that any option for that?

Or otherwise I could get a TGraph from the TTree::Draw is there then a way to convert it to a TH2 with custom binning?

Regards,
Luca

You can do it if you create the non-fixed-bin histogram before, then use the >>+ syntax for filling with TTree::Draw.

Search for the string “append data to an existing histogram” at http://root.cern.ch/root/html/TTree.html#TTree:Draw@1 to see the relevant doc section.

Jean-François

Thanks Jean-François! This is exactly what I needed!