A method comprising: receiving a measured histogram comprising: a plurality of channels Ch1, Ch2,... ChN, wherein channels Ch1, Ch2,... ChN have respective channel numbers C1, C2,... CN; wherein each channel has associated with it a respective count, C1-count, C2-count,... CN-count, representing a number of rays having energies in the range of energy associated with that channel received by an apparatus over a detection period of time; determining that a first-peak channel (ChA with channel number CA, 1 < A < N) represents a first peak in the histogram; determining that ChA is associated with a known first-peak energy which is the energy of gamma rays emitted by a source of gamma rays; determining that a second-peak channel (ChB with channel number CB, 1 < B < N, A ≠ B) represents a second peak in the histogram; determining that ChB is associated with a known second-peak energy, wherein the known second-peak energy is an energy of x-rays produced by gamma ray interaction with tungsten; solving a system of equations for an energy scale, κ, and a zero offset, E0, wherein: a first equation in the system of equations is a function of EA and CA, and a second equation in the system of equations is a function of EB and CB; using a function of EM, CM, κ, and E0 to identify features in the histogram, wherein EM is an energy associated with the Mth channel in the histogram, and CM is the channel number of the Mth channel (ChM) in the histogram; using the identified features in the histogram to calculate a parameter of a formation from which the gamma rays originated; and using the calculated parameter to make a decision about a well. receiving a measured histogram comprising: a plurality of channels Ch1, Ch2,... ChN, wherein channels Ch1, Ch2,... ChN have respective channel numbers C1, C2,... CN; wherein each channel has associated with it a respective count, C1-count, C2-count,... CN-count, representing a number of rays having energies in the range of energy associated with that channel received by an apparatus over a detection period of time; a plurality of channels Ch1, Ch2,... ChN, wherein channels Ch1, Ch2,... ChN have respective channel numbers C1, C2,... CN; wherein each channel has associated with it a respective count, C1-count, C2-count,... CN-count, representing a number of rays having energies in the range of energy associated with that channel received by an apparatus over a detection period of time; determining that a first-peak channel (ChA with channel number CA, 1 < A < N) represents a first peak in the histogram; determining that ChA is associated with a known first-peak energy which is the energy of gamma rays emitted by a source of gamma rays; determining that a second-peak channel (ChB with channel number CB, 1 < B < N, A ≠ B) represents a second peak in the histogram; determining that ChB is associated with a known second-peak energy, wherein the known second-peak energy is an energy of x-rays produced by gamma ray interaction with tungsten; solving a system of equations for an energy scale, κ, and a zero offset, E0, wherein: a first equation in the system of equations is a function of EA and CA, and a second equation in the system of equations is a function of EB and CB; a first equation in the system of equations is a function of EA and CA, and a second equation in the system of equations is a function of EB and CB; using a function of EM, CM, κ, and E0 to identify features in the histogram, wherein EM is an energy associated with the Mth channel in the histogram, and CM is the channel number of the Mth channel (ChM) in the histogram; using the identified features in the histogram to calculate a parameter of a formation from which the gamma rays originated; and using the calculated parameter to make a decision about a well.