Change x-axis of histogram from channels to energy

I have a histogram and the x axis is set on the channels from a file.
Is there a way to change (or calibrate) the x axis if we have a simple linear function that converts: E(KeV)=m*(channel)+b

Here is my macro:

  auto am241=new TH1F("am241",
		     "am241;N_{counts};# occurencies",
		      4095, //number of bins
		      -0.5, //x-axis min
		      4095.5); //x-axis max
  ifstream inp; double x;"Am241.TKA");
  for (int i=0; i<4095; i++) {
    inp >> x;

this is what I get as output: