How to subtract background from many spectra which were taken with different background intensity? I have two spectra, a spectrum of background signal (let's call it Reference) and measured spectrum consisting of searched signal and background signal. The searched signal is a peak/s with various intensity and width appearing in various parts of the spectrum. However, the intensity of the background signal in the measured spectrum is every time different from the Reference by some unknown coefficient (the shape of the background is always the same, only its intensity is different). To subtract the background, I need to find the coefficient by which the reference will be multiplied before subtracting it from the measured signal. Practically it means to estimate the coefficient by trial and error for every measured signal. Is there an effective algorithm that would take the Reference and measured spectra and find the coefficient for the multiplication?
Thanks a lot.
 A: This is not an easy problem, but it is solvable under some conditions.
One possible set of workable conditions:


*

*You know enough about the expected shape of some portion of the background to perform a reliable fit in that energy range; and that range is not going to have a signal peak in it.1

*You know how the rest of the background scales relative the fitable section(s).2

*You don't have a good theoretical reason to assume the shape of the rest of the background.3
Under these conditions you fit the reliable background section on both runs, use that to establish a scaling factor, scale the background run and subtract the result from the data run.

1 If there is a data peak in the background region you would like to use, then you have to exclude that portion of the data before fitting. But that means know where and how big the peak is...
2 This is the case, for instance, in high purity germanium detectors. The behavior of the low enegy background is complex and not particular reliable from device to device, at varying HV, or even if you turn the machine off and on again; but the beahvior at high energy has a well understood energy dependence and the low enegy background scales linearly with the high energy (as long as the HV is constant, so take your background run(s) in the same operational pass as your data run(s)).
3 I threw condition (3) in there, because if you didn't have that constraints you could simply fit the background from the data run and wouldn't need a separate background measurement.
