RooFormulaVar error in ROOT 6.22.06

I recently updated to macOSX 11.1 and am now using ROOT 6.22.06. I previously used 6.18.04 on OSX 10.14 (or approximate).

When trying to create a RooFormulaVar that is the minimum of two numbers, I now get an error trying to create the object.

Here is an example. When running the code here:

RooRealVar r("MH","MH",5,0,10);
RooFormulaVar("form","form","min(MH,1)",RooArgList(r));

an error is produced like such:

input_line_19:2:66: error: call to 'Min' is ambiguous
Double_t TFormula____id16825570130930576839(Double_t *x){ return TMath::Min(x[0],1) ; }
                                                                 ^~~~~~~~~~
/Users/brentstone/Dropbox/rootBuild_62206/include/TMathBase.h:186:21: note: candidate function
inline Int_t TMath::Min(Int_t a, Int_t b)

...

Error in <prepareMethod>: Can't compile function TFormula____id16825570130930576839 prototype with arguments Double_t*
Error in <TFormula::InputFormulaIntoCling>: Error compiling formula expression in Cling
Error in <TFormula::ProcessFormula>: Formula "min(x[0],1)" is invalid !
[#0] FATAL:InputArguments -- RooFormula 'form' did not compile or is invalid.
Input:
	min(MH,1)
Passed over to TFormula:
	min(x[0],1)
Error in <TRint::HandleTermInput()>: std::runtime_error caught: RooFormula 'form' did not compile or is invalid.
Input:
	min(MH,1)
Passed over to TFormula:
	min(x[0],1)

Previously I had no problem running this code. Any help on how to encode this kind of function in this new version of ROOT would be appreciated. Thanks!


Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


I think @moneta can help you.

Hi,
Now ROoFormula does not compile because you have a small C++ error. From 6.22 RooFormula uses the compilation of Cling which makes it more powerful but also more stringent in term of allowing C++ errors.
min(double, integer) is ambiguous as the error message says.
Just do :

RooFormulaVar("form","form","min(MH,1.)",RooArgList(r));

Lorenzo

Ah ok, thanks a ton @moneta!

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