Data Re-Binning

Did any Rooter can help with this!

if the attached file have the first column “Energy” and the second “Count”.
how can i make the rebinning process for the Energy axes to be with bin width integer 1 or 2 or 4.
(general way),
I dont need any plotting or histogram, Just the calculations way.

file.txt (238.1 KB)


You can specify the binning when creating the histogram.

(You’ll need to provide waaay more details to get a more detailed answer.)


in the file.txt, the interval is almost 1.000597 within the X axes.
i want to make the interval =2 or 4 or … (integer numbers)
as you know the x axes need to re-bin, and also the values from y axes will also need to shifted right or left according to the new values.
i know the way of re-bin from the histogram. but in need to know the reference of this calculations (the re-bin algorithm).

How do you create the histogram? That’s where you can specify the binning.

her is my code to draw the histogram.
through the output canvas i could make re-binning.
But i want to understand the algorithm or rebinning.
this code is a part of big code so i want to write the rebinning equations inside the code
Draw.C (646 Bytes)

here in the attached link, a paper show something like this.
How can to transfere the equations 2 and 3 to code?

This auto h = new TH1D("h","Spectrum",nb,x1-bw/2.,x2+bw/2.); creates the histogram. You can tell it it start at a certain value, end at a certain value, and have a given number of bins. That will cause the bin borders to be at the positions you want. See the TH1D constructors:

Regarding the Arxiv paper, I won’t have the time to write your code for you I’m afraid…

Cheers, Axel.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.