-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
- Checked for duplicates
Describe the bug
When passing a argument to a formula based RooFit function (e.g. RooFormulaVar
or RooGenericPdf
), RooFit will search for all occurrences of the object name in the formula and replace them with an ordinal parameter (needed for the underling TFormula
). However, when the argument is a RooConst
the name is just a string containing the value and this can break if there are numeric literals inside the formula.
For example
RooFormulaVar f("f", "2.7*@0", RooFit::RooConst(2.))
becomes inside the TFormula
x[0].7*x[0]
because the name 2 of the RooConst
matched the 2 of the numeric literal. This of course breaks during formula compilation.
Expected behavior
The variables do not replace numeric literals no matter the name. Possibly RooConst
s should be matched only by index?
To Reproduce
RooFormulaVar f("f", "2.7*@0", RooFit::RooConst(2.))
Setup
HEAD of ROOT 6.26 from LCG dev4
Additional context
RooFormulaVar f("f", "2.7*@0", RooFit::RooConst(2.7))
creates x[0]*x[0]
, which is mostly fine but may break if servers are redirected