Parameters "disconnected" from the bind function in RooWorkspace, an unexpected feature

Hi there,

I import a bindFunction to a RooWorkspace and save the RooWorkspace to a file; then read back the bindFunction along with the observable, x, and parameters, p. The returned function behaves as expected when x is changed, but the returned result does not change when p is changed. I guess the connection of the parameters and the bind function is somehow lost.

Please ignore me if this is a known feature, otherwise, I attached three files to reproduce the feature. Please change the Makefile.txt to Makefile, for the latter is disliked by the upload tool. After compiling the code, after make, run ./write and ./read.

Best regards,
Xiangyang
read.cxx (693 Bytes) write.cxx (1.1 KB) Makefile.txt (712 Bytes)

Hi Xiangyang,

I saw something similar to this before, but that was fixed recently.
See here:

Would you be able to test on lxplus?

Hi Stephan,

I tested on lxplus with ROOT version: source /cvmfs/sft.cern.ch/lcg/views/LCG_97/x86_64-centos7-gcc9-opt/setup.sh. The problem preserves.

Best regards
Xiangyang

Ok, thanks. I will investigate a bit more.

I got it:
A TF1 that’s using a functor/C++ function cannot be stored in files. To be more precise:
It stores an array of y values of the function at the time of writing to the file, but the (c++)-function gets lost.

Therefore, you cannot change its values once it comes back from the file. To recreate it, you can put the function in a header, and re-bind to the variables that are in the workspace.

Thanks for the prompt investigation and suggested solution. It should work. I am wondering is there a way to control the array of y values of the function? In the end of the day, we are only interested in the y values as a function of the observable x.

Thanks,
Xiangyang

I don’t know to be honest. Once the function is in the file, it stays as it is.