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.
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.