Energy Calibration: binned vs unbinned data

Hi everyone,

While trying to transform(calibrate) the channel numbers on X axis to energies using a quadratic polynomial, I am confused as to what shall be the better and error free approach at the same avoiding issues with re-binning, variable bin width, missing bins etc. as highlighted in below posts

The post below highlights that for a linear transformation it’s better to rescale the axis itself
After energy calibration, some histogram bins are empty - #4 by Wile_E_Coyote

1.) The first method that I am thinking is to directly transform the binned data using the. Set(Get)BinContent() as discussed below

2.) Whereas secondly, is to directly transform the unbinnned values and then make a histogram.

Can anyone please share their point of view on which method is better or share any better approaches to achieve this X axis “calibration”.

Any comments, suggestions or recepies will be of tremendous help. Thanks a lot.


Posting a lot these days!
Could you perhaps be a bit more specific with the question you have in mind? Maybe the question you could try to answer is why rescaling according to the value of your calibration function evaluated in the bin center is not ok in your case?



Thanks for noticing that. Sorry for not being specific here.

Sure, Il try the rescaling bin centers for my specific case and share the results.

If you can, always “scale” your raw unbinned data (i.e., from “raw experimental values” to values in “energy units”).
Create your histogram with the axis in “energy units” and fill it with your (still unbinned) “energy calibrated” data.
If you only have a histogram already filled with “raw experimental values”, then you are doomed.

1 Like

Hi @Wile_E_Coyote ,
Thanks for the suggestion.
Yes, so far I was trying to scale the “raw experimental values” according to the calibration function and then binning the scaled version to “calibrated” spectra.

If you only have a histogram already filled with “raw experimental values”, then you are doomed.

I guess due to the problem of empty bins and variable bin widths or there is more to that. Can you please highlight it?

Unfortunately, this was never implemented: “TAxis FixedToVariable and VariableToFixed proposal

Hmmm…okay. Thanks for sharing