The number of bins?

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

ch1.Draw("((trt.tracks.tdctc)+(trt.tracks.tdcbc))/2:sqrt((trt.tracks.adcbc)*(trt.tracks.adctc))");
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: http://root.cern.ch/root/html/TTree.html
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);
MyTree->Draw(“someY:someX>>MyHisto”);
Note: in this case, the default binning will not be changed.

yes it works ,
thank you