I am trying to fit a function to background both above and below a peak. I have a single function (let’s say a simple linear p[0] + p[1]*x), and I want to fit it to a TH1 with multiple discontiguous ranges simultaneously - something like [50, 100] and [150, 200], where the peak is in [100, 150] and thus excluded from the background fit.
Reading the documentation here,
"The ROOT::Fit::DataRange
class supports defining multiple rectangular ranges in each dimension, and supports n-dimension. The function DataRange::AddRange(icoord,xmin,xmax)
adds a range in the coordinate icoord
with lower value xmin
and upper value xmax
"
However when I attempt to add multiple ranges in the same dimension:
range.AddRange(0, 50, 100);
range.AddRange(0, 150, 200);
I get a warning: Warning in <ROOT::Fit::FillData>: support only one range interval for X coordinate
.
Which seems to indicate that only one interval can be specified (per coordinate). My questions are:
- Is there another way to achieve multiple discontiguous regions for a single fit
- Is there a reason for this limitation in the ROOT::Fit framework
N.B. I can achieve something close by creating a TGraphErrors and putting the relevant points into that and fitting it. However, I would like to be able to do a likelihood fit to handle low statistics correctly. As I understand it, this isn’t possible for a TGraph object.
Thanks
Tim
Please read tips for efficient and successful posting and posting code
ROOT Version: 6.27
Platform: macOS
Compiler: clang