Hi Simon,
it seems like that if you add 2 pdfs of the same type, the parameters will overwrite each other, even if you assign them different names:
MWE (updated):
from pyroofit.models import Gauss
pdf1 = Gauss(('x', -3, 3), mean=(-1, 0, 1), name="first_gauss")
pdf2 = Gauss(('x', -3, 3), mean=( -1, 0, 1), name="second_gauss")
pdfsum = pdf1 + pdf2
print(pdfsum.parameters)
returns
{'n_first_gauss': <ROOT.RooRealVar object ("n_first_gauss") at 0x4985d40>, 'mean': <ROOT.RooRealVar object ("second_gauss_mean") at 0x4947690>, 'sigma': <ROOT.RooRealVar object ("second_gauss_sigma") at 0x4933690>, 'n_second_gauss': <ROOT.RooRealVar object ("n_second_gauss") at 0x49b7750>}
I think I looked in the code a while ago and you were checking only for the dictionary keys, not for the names of the RooFit objects and therefore overwrite the mean parameter.
Perhaps I'll create a PR for this later if I find the time, just wanted to report this, because it seems to be important to fix this fast.
Cheers,
Kilian
Hi Simon,
it seems like that if you add 2 pdfs of the same type, the parameters will overwrite each other, even if you assign them different names:
MWE (updated):
returns
{'n_first_gauss': <ROOT.RooRealVar object ("n_first_gauss") at 0x4985d40>, 'mean': <ROOT.RooRealVar object ("second_gauss_mean") at 0x4947690>, 'sigma': <ROOT.RooRealVar object ("second_gauss_sigma") at 0x4933690>, 'n_second_gauss': <ROOT.RooRealVar object ("n_second_gauss") at 0x49b7750>}I think I looked in the code a while ago and you were checking only for the dictionary keys, not for the names of theRooFitobjects and therefore overwrite themeanparameter.Perhaps I'll create a PR for this later if I find the time, just wanted to report this, because it seems to be important to fix this fast.
Cheers,
Kilian