Dear all,
I want to fit a waveform which is overlapped by two signals like the figure shows(blue line). I choose two gaussian function.
When I tried to use Roofit to handle these data with
x = ROOT.RooRealVar("x", "Time", St[0], St[len(St)-1])
y = ROOT.RooRealVar("y", "Signal", 0,10)
data_set = ROOT.RooDataSet("data", "dataset with x and y", ROOT.RooArgSet(x, y))
for i in range(len(St)):
x.setVal(St[i])
y.setVal(Sa[i])
data_set.add(ROOT.RooArgSet(x, y))
and
mean1 = ROOT.RooRealVar("mean1", "mean of Gaussian 1", 0.0002, 0, 0.003)
sigma1 = ROOT.RooRealVar("sigma1", "width of Gaussian 1", 0.0005, 0.0001, 0.1)
A1 = ROOT.RooRealVar("A1", "amplitude of Gaussian 1", 0.1, 0,10)
mean2 = ROOT.RooRealVar("mean2", "mean of Gaussian 2", 0.0003, 0, 0.004)
sigma2 = ROOT.RooRealVar("sigma2", "width of Gaussian 2", 0.0005, 0.0001, 0.1)
A2 = ROOT.RooRealVar("A2", "amplitude of Gaussian 2", 0.1, 0, 10)
gauss1 = ROOT.RooGaussian("gauss1", "Gaussian 1", x, mean1, sigma1)
gauss2 = ROOT.RooGaussian("gauss2", "Gaussian 2", x, mean2, sigma2)
signal = ROOT.RooAddPdf("signal", "sum of gaussians", ROOT.RooArgList(gauss1, gauss2), ROOT.RooArgList(A1, A2))
signal.fitTo(data_set)
c = ROOT.TCanvas("rf101_basics", "rf101_basics", 800, 400)
frame = x.frame()
data_set.plotOn(frame)
The result is as shown. Why I can’t draw the original waveform? And is there a suitable function to fit it?
ROOT Version: 6.32.02
Platform: macosxarm64
Compiler: clang-1500.3.9.4