Skip to content

Parameters and names #3

Description

@klieret

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions