Custom binning for Profiles made from TTree

Hi,
Suppose I have a tree and plot a Profile from it:

  mytree -> Draw(v1:v2>>hh1(50,0,50)", "", "prof");

Now, how to set arbitrary binning in this case?
This construction seems not working here:

  mytree -> Draw(v1:v2>>hh1(nbins, *xbins)", "", "prof");

It also doesn’t work if I predefine the hh1 profile with custom binning and then use
mytree -> Draw(v1:v2>>hh1", “”, “prof”);

It worked for a regular TProfile, not made from a tree.
Is there a way?

Thanks

Hi,

You can not call the TProfile constructor taking an array of double using the indirect route (via TTree::Draw). Instead you need to create the TProfile before hand:TProfile *hh1_ptr = new TProfile("hh1","hh1 title",nbins, xbins); mytree -> Draw("v1:v2>>hh1", "", "prof");

Cheers,
Philippe.

Thank you!

I actually tried it… It didn’t work because I misspelled the name of profile.