TH1F variable bin width

Hi guys,

     I need to fill my histogram with a data where I don't have fix width. The data is basically consist of bin number, energy, counts as in the attachment. I tried to write two codes. One is using histogram, and another one is using graph. I couldn't managed to figure out how I should write the histogram part even if I checked so many things on web. There is one option by using the statement below.

TH1* h = new TH1D(
/* name / “h1”,
/
title / “Hist with variable bin width”,
/
number of bins / NBINS,
/
edge array */ edges
);

    The problem with this part is there is no way to  know my bin edges, the data gives me only the bin center which corresponds to my energy, and bin width is varying. 

However, it seems the graph works. I can fit Gaussian and 1st degree polynomial, but it doesn’t give me the right integral. I compared the real result with the MAESTRO or SCINTIVISION programs which ORTEC company gives with detectors. They don’t match at all.

       Could you help me to sort this issue by giving me little script about finding integrals for this kind of case where the binning changes?


     Sincerely yours

EnergyData.txt (92 Bytes)
can.cxx (14.7 KB)
sample.pdf (18.8 KB)
60Codata.txt (17.3 KB)