Could not plot a beautiful histogram

Hello, everyone:

When I try to read branches from a root file, and plot variables, the histogram I plot is much different from that TBrowser plots .
I think the problem lies in the TH* constructor, in which I failed to give the right xbins, xmin, xmax.
I wonder is there any way to get the “right” parameters, which can give the same plot TBrowser does.

Thanks for your time.

Hi,

Try usinghist->SetBit(TH1::kCanRebin);

Cheers,
Philippe.

simply specify xmin=xmax=0 and the binning will be automatic

Rene

[quote=“brun”]simply specify xmin=xmax=0 and the binning will be automatic

Rene[/quote]

Like this TH2F* f2 = new TH2F("hello","hello",100,0,0,100,0,0);?

I think I have to use the stupid way. Use TBrowser to plot the branch, then “inspect” the plot to get the bin number Xbin and Xmin, Xmax.
Then TH1F* f1 = new TH2F("hello","hello",Xbin,Xmin,Xmax);

Thanks anyway.

[/code]