Binning of histograms and accessing spectrum manipulation functions

Hello everyone!

  1. I am completely new to ROOT and data analysis. I have data for histogram in an ASCII file (Energy vs Counts). There are 4096 bins and the width of each bin is 0.5 keV. I want to write this data in a 1D histogram in pyROOT. Can someone please assist, as I am confused about setting the bin width in ROOT.
  2. Additionally, I want to access some spectrum manipulation functions (smoothing, deconvolution, peak finding etc.) maybe in TSpectrum class or something else, in pyROOT. Can you please assist me regarding how to set parameters properly for these functions and how to implement them properly in pyROOT? I have gone through the documentation, but I am not sure.
    Thanks a lot in advance

For 1, you probably want this constructor:

h = ROOT.TH1D('h', 'some title', nbins, xlow, xhigh)

see the Documentation for the meaning of each parameter, and to see other constructors (e.g., you could also define the bins as arrays or vectors, which of course means you have to define the bins one by one). If you want a given bin width for the above constructor, you have to adjust nbins, xlow, xhigh accordingly, given binw = (xhigh-xlow)/nbins.

Thank you for your reply. If possible, can you explain a bit more in detail about what you mean by defining the bins as arrays?