Fit slower when including extra constant parameters

Dear RooFitters,

I’m setting up an analysis where a dataset is scanned using a background+signal model under different hypotheses such as “background only”, “no systematics”, “background+signal”, etc. For ease of implementation, I am accessing these different fitting modes using the same model which I configure appropriately by switching parameters on/off and setting them constant/free.

In principle this works fine, but I am noticing that it costs in terms of fitting time. To demonstrate my concern, I’ve attached a macro which you can run out of the box. It generates pseudo experiments and on each one performs first a fit using a simple exponential (bkg) and then another fit using the same exponential added to a constant Breit-Wigner which is stuck at zero normalization (bkg + 0*const_sig) . You can see distributions of the two fit times for 10000 toys in the following plot:

Although both fits involve only one free parameter, the one including extra constant parameters takes on average 1.8 times longer. (0.00168183s / 0.000923759s) This is only a simple example, and in my case it seems the effect only gets worse with a more complicated model. Is the time difference due to some fundamental reason or is it a technical artifact? If the latter, how can I get around it?


extraConstantParamsSpeedTest.C (1.7 KB)


Thank you for your nice benchmark example. It seems to me that the optimisation of the constant terms ,
which is on by default, it is not working in this case.
This should be fixed. I will open a JIRA ticket on this

Best Regards


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.