Mark's Notes

Spline Fitting

1. The interface is now you pass in a TH2 and get back the spline. No need for gaussian fits to extract the graph of mode vs. y in advance any more.
2. The placement of knots is more regular. The knot locations for the first and last point are pinned to the edges of the T2H histogram. The remaining divide the distribution up evenly in x so that each interval contains the same fraction of the total distribution. The knot locations are allowed to vary within those intervals, but not to cross out of those intervals. This ensures that the knots are placed among the data but still gives them some flexibility.
3. One side effect of this is that you should ensure that the limits of your TH2 encompass all the data. Splines are terrible for extrapolation. We had some adhoc way of dealing with this before. I think the “correct” way is to ensure that the histogram ranges show the full scale where you expect to apply the splines which guarantees the splines only are ever used for interpolation.
4. Under the hood, the need to fit gaussians to peaks to estimate the modes has been replaced with a method I found in a stats journal which slides a weighted average across the distribution to estimate the local probability distribution. No more potentially wonky fits.