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
When rebining a histogram with a non-divisible number of bins, such as 101 bins being rebinned with a factor of 2, the process results in the last bin being excluded from the new histogram. The upper limit of the rebinned histogram is adjusted to the last complete group of bins, which means that the first 100 bins are combined into 50 new bins, while the contents of the 101st bin are moved to the overflow bin. The original histogram remains intact; however, the new histogram reflects the changes in bin contents and statistics. Events from the last bin are not discarded but are instead categorized in the overflow bin, which accounts for entries outside the defined histogram range. This ensures that all data is preserved, albeit in a different structure.
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 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 ChrisVer
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...

Similar threads

  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 22 ·
Replies
22
Views
905
  • · Replies 0 ·
Replies
0
Views
5K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 6 ·
Replies
6
Views
1K
  • · Replies 3 ·
Replies
3
Views
2K
Replies
6
Views
3K
Replies
5
Views
2K
  • · Replies 8 ·
Replies
8
Views
3K