What happens when rebinning a histogram with non-divisible number of bins?

  • Thread starter Thread starter ChrisVer
  • Start date Start date
  • Tags Tags
    Histogram Root
Join the discussion
Registration is free. Start your own thread to ask a follow-up.
3 replies · 6K views
Science Advisor
Messages
3,372
Reaction score
465
Hi,

I am having one histogram that contains 101 bins.
I tried rebining it with the TH1::Rebin:
C:
 histogram->Rebin(2.);
But I got the warning message that 2 is not an exact divider of 101.

I looked in ROOT TH1 Rebin's page, and read this note:
If ngroup is not an exact divider of the number of bins,
the top limit of the rebinned histogram is reduced
to the upper edge of the last bin that can make a complete
group. The remaining bins are added to the overflow bin.
Statistics will be recomputed from the new bin contents.

I don't understand what the execution of the program actually does to the bins. Is the initial histogram destroyed? I don't think I understand what they mean with the red-highlighted by me phrase...

Does it mean that it grouped the 100 bins together with 2, and it put the last bin events (101st) in the result's last bin (now 50th)? So more like grouping all the 2 bins in 1 and the last 3 in 1?
 
Physics news on Phys.org
You get the contents of bin 1* and bin 2 in the new bin 1, bin 3 and 4 get combined to the new bin 2 and so on. The "top limit of the rebinned histogram" is the upper edge of bin 50, which is the same as the upper edge of the old bin 100. The contents of bin 101 go to the overflow.

*note: ROOT bins start at 1. Index 0 is reserved for underflow.
 
  • Like
Likes   Reactions: ChrisVer
mfb said:
The contents of bin 101 go to the overflow.

Would it be too much to ask what does that mean too?:sorry: Like those events are discarded from the appearence of the histogram?
 
ROOT has an overflow and underflow bin for all entries that do not fit to the histogram range. Everything that was in the old bin 101 is not within the histogram ranges any more.
 
  • Like
Likes   Reactions: ChrisVer