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
Click For Summary

Discussion Overview

The discussion revolves around the behavior of the ROOT TH1::Rebin function when applied to a histogram with a non-divisible number of bins, specifically focusing on a histogram with 101 bins being rebinned by a factor of 2. Participants explore the implications of this operation on the histogram's structure and data representation.

Discussion Character

  • Technical explanation
  • Conceptual clarification
  • Debate/contested

Main Points Raised

  • One participant describes the warning received when attempting to rebin a histogram with 101 bins using a non-exact divisor (2), expressing confusion about the implications of this operation.
  • Another participant explains that the contents of the original bins are combined into new bins, with the last bin's contents being moved to an overflow bin, clarifying that the top limit of the rebinned histogram corresponds to the upper edge of the last complete group of bins.
  • A participant seeks clarification on the meaning of the overflow bin, questioning whether the events from the original last bin are discarded or simply moved out of the histogram's range.
  • Another participant confirms that the overflow bin is used for entries that do not fit within the new histogram range, indicating that the contents of the original last bin are no longer represented in the rebinned histogram.

Areas of Agreement / Disagreement

Participants generally agree on the mechanics of how the rebinned histogram operates, particularly regarding the movement of data to the overflow bin. However, there is some uncertainty about the implications of this operation on data representation and whether it leads to data loss.

Contextual Notes

Participants express uncertainty regarding the exact nature of the data movement to the overflow bin and its implications for the overall data integrity of the histogram after rebinned operations.

ChrisVer
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?
 
Technology 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

Similar threads

  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 22 ·
Replies
22
Views
2K
  • · Replies 5 ·
Replies
5
Views
1K
  • · Replies 2 ·
Replies
2
Views
518
  • · Replies 16 ·
Replies
16
Views
3K
  • · Replies 0 ·
Replies
0
Views
6K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
Replies
5
Views
2K