Rebin problem in example tree/tree1.C

Dear all:

I met a problem in rebinning the px (actually all variables) variable in example tree/tree1.C
When I rebin or make any BinOffSet for it, the histogram disappears.

It is really strange, because I also tried the example tree/tree2.C. Everything is Ok there. I can rebin the histogram.

I also tested other histograms without any rebinning problems.
The attached are my testing result for tree1 and tree2 examples.








Thanks a lot.

Fada

Hi,

The histogram produce by TTree::Draw when rebin only use the last (GetEntries() % GetEstimate()) entries of the TTree when doing the rebins. In particular (like in you case) if GetEntries() == GetEstimate(), that means exactly 0 entries …

To have the capability of rebins with all the values, use:mytree->SetEstimate(mytree->GetEntries()+1)Note that it means that all the raw values will be kept in memory alongside the histogram.

Cheers,
Philippe.

Thanks very much!