The number of bins?

hello all ,
how can i choose the number of bins when i make a drawing from chain ?

maybe i should use the definition of histogram :
TH2F *h2=new TH2F(“h2”,“t”,4000,0,4000,4000,0,4000);

but it doesn’t work !

can you help me please :slight_smile:
thank you all

Search for “>>” and “binning” strings here:
In short, you can do: MyTree->Draw(“someY:someX>>MyHisto(NbinsX, Xmin, Xmax, NbinsY, Ymin, Ymax)”);
Note: when a new binning is defined this way, the new values will become the default.
Of course, you can also create a histogram first and then use it:
TH2F *MyHisto = new TH2F(“MyHisto”, “MyHisto”, NbinsX, Xmin, Xmax, NbinsY, Ymin, Ymax);
Note: in this case, the default binning will not be changed.

yes it works ,
thank you