first, thank you all for this forum, I often find here the solution of my problems and it gives me a great help.
As in subject, I would like to construct a TF2 object with two TF1s, something like this:
TF1 *f1 = new TF1("f1", "some function f1...", x1min, x1max);
TF1 *f2 = new TF1("f2", "some function f2...", x2min, x2max);
TF2 *f = new TF2("f", "f1(x) * f2(y)", x1min, x1max, x2min, x2max);
It would be better if the TF2 doesn’t have to know what functions are f1 and f2.
I looked for a constructor with TF1s in the TF2 page, but I didn’t find anything.
Is there a way to do this?
Thank you in advance,
Antonio.
This solution is simple and clear, but awfully it doesn’t work in my environment. Could it be because I’m using it inside a class? Explaining in detail, I have just written the following code:
I don’t get any error when compiling, but when I start a run it gives the following error:
Error in TFormula::Compile: Bad numerical expression : "this.f1(x)"
Error in TF2::TF2: function: f2d/this->f1(x) * this->f2(y) has 0 parameters instead of 2
I tried also writing f1(x), instead of this->f1(x), but the outcome is the same.
In fact, even with the macro you sent me, it works with the command ‘root -l f1f2.C’, but not with the Makefile (launching main.exe gives the same error of a bad numerical expression). I can’t imagine a solution for this problem, because I need the Makefile to link all my classes.